This commit is contained in:
liwei1dao 2023-09-19 16:41:59 +08:00
commit 37bb93a7b9
2 changed files with 41 additions and 43 deletions

View File

@ -200,6 +200,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
groupID int32 groupID int32
) )
this.module.Debugf("config lotterId:%d, vipLv:%d, lv :%d", lotteryId, vipLv, lv)
// 随机小组id // 随机小组id
for _, v := range this._lotteryType1[lotteryId] { for _, v := range this._lotteryType1[lotteryId] {
if _data := this.GetLotterConfById(v); _data != nil { if _data := this.GetLotterConfById(v); _data != nil {
@ -313,7 +314,7 @@ func (this *MCompConfigure) GetGroupDataByLottery(lotteryId int32, vipLv int32,
} }
} }
} }
this.module.Debugf("drop result:%v", items)
return return
} }

View File

@ -68,48 +68,25 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
return return
} }
expand = &pb.DBUserExpand{} expand = &pb.DBUserExpand{}
} else { }
// 玩家是否已在线 // 玩家是否已在线
if isession, ok := this.module.ModuleBase.GetUserSession(user.Uid); ok { if isession, ok := this.module.ModuleBase.GetUserSession(user.Uid); ok {
isession.SendMsg(string(this.module.GetType()), "othertermlogin", &pb.UserOtherTermLoginPush{Uid: user.Uid}) isession.SendMsg(string(this.module.GetType()), "othertermlogin", &pb.UserOtherTermLoginPush{Uid: user.Uid})
isession.SyncPush() isession.SyncPush()
isession.UnBind() isession.UnBind()
this.module.PutUserSession(isession) this.module.PutUserSession(isession)
} }
lastLoginTime = user.Logintime lastLoginTime = user.Logintime
user.Logintime = configure.Now().Unix() user.Logintime = configure.Now().Unix()
user.Lastloginip = session.GetIP() user.Lastloginip = session.GetIP()
user.Offlinetime = 0 user.Offlinetime = 0
user.Area = req.Area user.Area = req.Area
user.Channel = req.Channel user.Channel = req.Channel
user.Vcode = req.Vcode user.Vcode = req.Vcode
user.Vname = req.Vname user.Vname = req.Vname
update := utils.StructToMap(user) update := utils.StructToMap(user)
if expand, err = this.module.GetUserExpand(session.GetUserId()); err != nil { if expand, err = this.module.GetUserExpand(user.Uid); err != nil {
if err != mongo.ErrNoDocuments { if err != mongo.ErrNoDocuments {
errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(),
Message: err.Error(),
}
return
}
}
if !utils.IsToday(lastLoginTime) { //当天第一次登录
user.Nologindays = int32(utils.DiffDays(lastLoginTime, configure.Now().Unix()))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1))
this.module.modelExpand.Change(session.GetUserId(), map[string]interface{}{
"loginAddCount": expand.LoginAddCount + 1,
"globalbuff": 0,
"consumPs": 0, // 重置每日消耗体力
"loginContinueCount": expand.LoginContinueCount + 1,
})
// 清理点赞
}
err = this.module.modelUser.Change(user.Uid, update)
if err != nil {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_DBError, Code: pb.ErrorCode_DBError,
Title: pb.ErrorCode_DBError.ToString(), Title: pb.ErrorCode_DBError.ToString(),
@ -119,6 +96,26 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (err
} }
} }
if !utils.IsToday(lastLoginTime) { //当天第一次登录
user.Nologindays = int32(utils.DiffDays(lastLoginTime, configure.Now().Unix()))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype8, 1))
this.module.modelExpand.Change(user.Uid, map[string]interface{}{
"loginAddCount": expand.LoginAddCount + 1,
"globalbuff": 0,
"consumPs": 0, // 重置每日消耗体力
"loginContinueCount": expand.LoginContinueCount + 1,
})
}
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
}
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype7, 1))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday()))) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype230, 1, int32(configure.Now().Weekday())))
//缓存user session //缓存user session