user if nil

This commit is contained in:
wh_zcy 2022-10-13 14:33:43 +08:00
parent cd47c52680
commit 0117c511f2
2 changed files with 10 additions and 5 deletions

View File

@ -147,6 +147,11 @@ func (this *toyUserInfo) dataListener() {
logrus.Error("unmarshal err") logrus.Error("unmarshal err")
return return
} }
if rsp.Data == nil {
logrus.Debug("没有用户数据返回")
}
this.setProp(1, common.USERINFO_SERVER, rsp.Data.Sid) this.setProp(1, common.USERINFO_SERVER, rsp.Data.Sid)
this.setProp(2, common.USERINFO_NAME, rsp.Data.Name) this.setProp(2, common.USERINFO_NAME, rsp.Data.Name)
this.setProp(3, common.USERINFO_AVATAR, rsp.Data.Avatar) this.setProp(3, common.USERINFO_AVATAR, rsp.Data.Avatar)

View File

@ -78,6 +78,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
return return
} }
} }
} }
//bind user //bind user
@ -103,11 +104,10 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
//不是新账号 //不是新账号
if !isNewUser { if !isNewUser {
lastLoginTime := user.Logintime lastLoginTime := user.Logintime
update := map[string]interface{}{ user.Logintime = time.Now().Unix()
"logintime": time.Now().Unix(), user.Lastloginip = session.GetIP()
"lastloginip":session.GetIP(), update := utils.StructToMap(user)
}
err = this.module.modelUser.Change(user.Uid, update) err = this.module.modelUser.Change(user.Uid, update)
if err != nil { if err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError