Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-11-08 12:06:24 +08:00
commit 7924cc979a
7 changed files with 39 additions and 8 deletions

View File

@ -48,5 +48,15 @@
"n": 20000 "n": 20000
} }
] ]
},
{
"index": "unified_reward",
"var": [
{
"a": "attr",
"t": "gold",
"n": 20000
}
]
} }
] ]

View File

@ -25,8 +25,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
if !expand.CompletePagoda { // 普通塔 if !expand.CompletePagoda { // 普通塔
list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId())
if list == nil { // redis没有数据 if list == nil { // redis没有数据
list = &pb.DBPagoda{} list = &pb.DBPagoda{}
list.Id = primitive.NewObjectID().Hex() list.Id = primitive.NewObjectID().Hex()
@ -40,6 +40,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq
season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId())
if season.Id == "" { if season.Id == "" {
list.Complete = true list.Complete = true
} else {
list = season
} }
} }

View File

@ -87,9 +87,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
update["circle"] = trolltrain.Circle update["circle"] = trolltrain.Circle
} }
leftTime = (int32(t) % circletime) leftTime = (int32(t) % circletime)
// 循环次数
index += circleCount * trainNum // 计算火车的位置信息 index += circleCount * trainNum // 计算火车的位置信息
for _, v := range sz { for pos, v := range sz {
if pos < int(trolltrain.TarinPos-1) { // 起始位置
continue
}
if leftTime <= v { if leftTime <= v {
trolltrain.RefreshTime = time.Now().Unix() trolltrain.RefreshTime = time.Now().Unix()
trolltrain.TarinPos += index trolltrain.TarinPos += index

View File

@ -87,7 +87,9 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain) (c
} }
iCount := this.configure.GetTrollRule(comm.TrollAIBuyCount) iCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
for index = 0; ; index++ { for index = 0; ; index++ {
if index < troll.TarinPos-1 { // 起始位置
continue
}
index := int32(index) % trainNum index := int32(index) % trainNum
troll.RefreshTime += int64(sz[index]) troll.RefreshTime += int64(sz[index])

View File

@ -145,6 +145,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
// 每日签到检测 // 每日签到检测
this.module.modelSign.checkResetSignData(session) this.module.modelSign.checkResetSignData(session)
this.Sign(session, &pb.UserSignReq{})
//推送登录公告 //推送登录公告
this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0) this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0)
mail := &pb.DBMailData{ mail := &pb.DBMailData{

View File

@ -15,6 +15,7 @@ func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.UserSignReq) (
//登录 //登录
func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) {
this.module.modelSign.checkResetSignData(session)
code = this.module.modelSign.checkResetSignData(session)
return return
} }

View File

@ -78,11 +78,12 @@ func (this *ModelSign) updateSignData(uid string, sign *pb.DBSign) (err error) {
} }
// 检测是否达到重置日期 // 检测是否达到重置日期
func (this *ModelSign) checkResetSignData(session comm.IUserSession) { func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.ErrorCode) {
var ( var (
update map[string]interface{} update map[string]interface{}
bReward bool bReward bool
) )
update = make(map[string]interface{}, 0) update = make(map[string]interface{}, 0)
if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil { if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil {
start, _ := utils.GetMonthStartEnd() start, _ := utils.GetMonthStartEnd()
@ -114,8 +115,19 @@ func (this *ModelSign) checkResetSignData(session comm.IUserSession) {
} }
} }
_data := this.module.configure.GetSignConf(sign.Cid, sign.Group) _data := this.module.configure.GetSignConf(sign.Cid, sign.Group)
if bReward && _data != nil { // 发奖 if _data != nil { // 发奖
this.module.DispenseRes(session, _data.Loopgift, true) if bReward {
this.module.DispenseRes(session, _data.Loopgift, true)
}
} else {
globalCnf := this.module.configure.GetGlobalAtnConf("unified_reward") // 获取重置消耗
if globalCnf == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if bReward {
this.module.DispenseRes(session, globalCnf.Var, true) // 发放通用奖励
}
} }
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{ session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
Data: sign, Data: sign,