账号表补充渠道信息

This commit is contained in:
sk 2024-04-23 14:28:13 +08:00
parent 12383a1e20
commit 7ecebe62e6
1 changed files with 34 additions and 0 deletions

View File

@ -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 {