上传用户登录代码
This commit is contained in:
parent
44f02046f2
commit
f4c49864dc
@ -2,6 +2,7 @@ package user
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
|
"go_dreamfactory/lego/sys/event"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"go_dreamfactory/sys/configure"
|
"go_dreamfactory/sys/configure"
|
||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
@ -131,6 +132,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
session.SetSession(session.GetIP(), session.GetSessionId(), session.GetServiecTag(), session.GetGatewayServiceId(), user.Uid)
|
||||||
session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, &pb.UserLoginResp{
|
session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, &pb.UserLoginResp{
|
||||||
Data: user,
|
Data: user,
|
||||||
Ex: expand,
|
Ex: expand,
|
||||||
@ -138,6 +140,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
|
|||||||
})
|
})
|
||||||
|
|
||||||
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) {
|
||||||
|
event.TriggerEvent(comm.EventUserLogin, session)
|
||||||
this.module.ModuleFriend.ResetFriend(user.Uid)
|
this.module.ModuleFriend.ResetFriend(user.Uid)
|
||||||
this.module.modelSign.UserSign(session)
|
this.module.modelSign.UserSign(session)
|
||||||
this.module.ModuleItems.InitItemBagData(session)
|
this.module.ModuleItems.InitItemBagData(session)
|
||||||
@ -147,81 +150,5 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// 在logintime更新前判断是否是昨天
|
|
||||||
// if utils.IsYestoday(user.Logintime) {
|
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype9, 1))
|
|
||||||
// } else {
|
|
||||||
// this.module.ModuleBuried.ResetBuriedByType(user.Uid, comm.Rtype9)
|
|
||||||
// }
|
|
||||||
|
|
||||||
//不是新账号
|
|
||||||
// if !isNewUser {
|
|
||||||
// lastLoginTime = user.Logintime
|
|
||||||
// user.Logintime = configure.Now().Unix()
|
|
||||||
// user.Lastloginip = session.GetIP()
|
|
||||||
// user.Offlinetime = 0
|
|
||||||
// user.Area = req.Area
|
|
||||||
// user.Channel = req.Channel
|
|
||||||
// user.Vcode = req.Vcode
|
|
||||||
// user.Vname = req.Vname
|
|
||||||
// update := utils.StructToMap(user) //尽量不要更新整个数据
|
|
||||||
// err = this.module.modelUser.Change(user.Uid, update)
|
|
||||||
// if err != nil {
|
|
||||||
// errdata = &pb.ErrorData{
|
|
||||||
// Code: pb.ErrorCode_DBError,
|
|
||||||
// Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
// Message: err.Error(),
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if this.module.modelUser.isLoginFirst(lastLoginTime) {
|
|
||||||
// this.module.ModuleHero.NoLoginDay(user.Uid, int32(utils.DiffDays(lastLoginTime, configure.Now().Unix())))
|
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1))
|
|
||||||
// this.module.modelExpand.updateLoginDay(user.Uid, lastLoginTime)
|
|
||||||
// // 清理点赞
|
|
||||||
// this.module.ModuleFriend.ResetFriend(user.Uid)
|
|
||||||
// this.module.modelSign.UserSign(session)
|
|
||||||
// this.module.ModuleItems.InitItemBagData(session)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // 判断昨日是否登录
|
|
||||||
|
|
||||||
// rsp.Data = user
|
|
||||||
|
|
||||||
// // 查询玩家扩展数据
|
|
||||||
// if expand, err := this.module.GetUserExpand(session.GetUserId()); err != nil {
|
|
||||||
// if err != mongo.ErrNoDocuments {
|
|
||||||
// errdata = &pb.ErrorData{
|
|
||||||
// Code: pb.ErrorCode_DBError,
|
|
||||||
// Title: pb.ErrorCode_DBError.ToString(),
|
|
||||||
// Message: err.Error(),
|
|
||||||
// }
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// rsp.Ex = expand
|
|
||||||
// }
|
|
||||||
// } else { //新号
|
|
||||||
// rsp.Ex = &pb.DBUserExpand{}
|
|
||||||
// this.module.modelSign.UserSign(session)
|
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1))
|
|
||||||
// }
|
|
||||||
|
|
||||||
// this.module.ModuleHero.CheckPeachReward(session, user.Ctime)
|
|
||||||
// go this.module.RecoverUserPsStart(session.Clone())
|
|
||||||
// // 日常登录任务
|
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1))
|
|
||||||
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday())))
|
|
||||||
// this.module.ModulePrivilege.CheckDailyPrivilegeMail(session)
|
|
||||||
|
|
||||||
// rsp.Data = user
|
|
||||||
// rsp.TimeNow = configure.Now().Unix() // 设置服务器时间
|
|
||||||
// session.SendMsg(string(this.module.GetType()), UserSubTypeLogin, rsp)
|
|
||||||
// if len(tasks) > 0 {
|
|
||||||
// go this.module.ModuleBuried.TriggerBuried(session.Clone(), tasks...)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// event.TriggerEvent(comm.EventUserLogin, session.Clone())
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user