账号表补充渠道信息
This commit is contained in:
parent
12383a1e20
commit
7ecebe62e6
|
|
@ -59,6 +59,11 @@ func (svc *AccountSvc) AccountIsExist(args *model.AccIsExistArg, ret *model.AccR
|
|||
}
|
||||
|
||||
acc := &model.Account{}
|
||||
defer func() {
|
||||
// 修改旧数据
|
||||
// 补充渠道信息
|
||||
svc.setParam(acc)
|
||||
}()
|
||||
|
||||
switch args.LoginType {
|
||||
case common.LoginTypeGuest:
|
||||
|
|
@ -229,6 +234,35 @@ func (svc *AccountSvc) AccountIsExist(args *model.AccIsExistArg, ret *model.AccR
|
|||
return nil
|
||||
}
|
||||
|
||||
func (svc *AccountSvc) setParam(acc *model.Account) {
|
||||
if acc == nil || (acc.Channel != "" && acc.Channel != "0") {
|
||||
return
|
||||
}
|
||||
|
||||
c := PlayerDataCollection(acc.Platform)
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
p := new(model.PlayerData)
|
||||
err := c.Find(bson.M{"snid": acc.SnId}).One(p)
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("setChannel error:%v", err)
|
||||
return
|
||||
}
|
||||
|
||||
c = AccountCollection(acc.Platform)
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
acc.Channel = p.Channel
|
||||
if acc.Channel != "" {
|
||||
err = c.Update(bson.M{"_id": acc.AccountId}, bson.D{{"$set", bson.D{{"channel", acc.Channel}}}})
|
||||
if err != nil {
|
||||
logger.Logger.Errorf("setChannel error:%v", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (svc *AccountSvc) AccountTelIsRegiste(args *model.AccIsExistArg, exist *bool) error {
|
||||
caccounts := AccountCollection(args.Platform)
|
||||
if caccounts != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue