update
This commit is contained in:
parent
b65e44ee95
commit
48306f8119
@ -94,17 +94,16 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
|
||||
//不是新账号
|
||||
if !isNewUser {
|
||||
//set user other info
|
||||
user.Logintime = time.Now().Unix()
|
||||
user.Lastloginip = session.GetIP()
|
||||
update := utils.StructToMap(user)
|
||||
update := map[string]interface{}{
|
||||
"logintime": time.Now().Unix(),
|
||||
"lastloginip": session.GetIP(),
|
||||
}
|
||||
err = this.module.modelUser.Change(user.Uid, update)
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
if this.module.modelUser.isLoginFirst(user.Logintime) {
|
||||
//清空日常
|
||||
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_DAILY)
|
||||
@ -113,18 +112,19 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
||||
this.module.ModuleTask.ResetTask(user.Uid, comm.TASK_WEEKLY)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
rsp.Data = user
|
||||
|
||||
expand, err := this.module.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
if expand, err := this.module.GetUserExpand(session.GetUserId()); err != nil {
|
||||
if err != mongo.ErrNoDocuments {
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
rsp.Ex = expand
|
||||
}
|
||||
|
||||
}
|
||||
mail := &pb.DBMailData{
|
||||
ObjId: primitive.NewObjectID().Hex(),
|
||||
Uid: user.Uid,
|
||||
|
Loading…
Reference in New Issue
Block a user