From 7ecebe62e670565c4470bd87a648157fef42797e Mon Sep 17 00:00:00 2001 From: sk <123456@qq.com> Date: Tue, 23 Apr 2024 14:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E8=A1=A8=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=B8=A0=E9=81=93=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbproxy/svc/u_account.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/dbproxy/svc/u_account.go b/dbproxy/svc/u_account.go index ae8cdab..6529d4c 100644 --- a/dbproxy/svc/u_account.go +++ b/dbproxy/svc/u_account.go @@ -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 {