小游戏发放额外奖励

This commit is contained in:
meixiongfeng 2023-06-26 18:11:55 +08:00
parent d86d604769
commit 4f637ea9bf

View File

@ -14,8 +14,9 @@ func (this *apiComp) PuzzleAwardCheck(session comm.IUserSession, req *pb.UserPuz
//拼图领奖
func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAwardReq) (errdata *pb.ErrorData) {
var (
sign *pb.DBSign
err error
sign *pb.DBSign
err error
completeCount int32
)
if sign, err = this.module.modelSign.GetUserSign(session.GetUserId()); err != nil {
@ -41,6 +42,14 @@ func (this *apiComp) PuzzleAward(session comm.IUserSession, req *pb.UserPuzzleAw
}
sign.Puzzle[req.Index] = 1
for _, v := range sign.Puzzle {
if v == 1 {
completeCount++
}
}
if conf := this.module.configure.GetSignExtarConf(completeCount, sign.Group); conf != nil {
this.module.DispenseRes(session, conf.Extra, true) // 签到额外奖励
}
if err = this.module.modelSign.Change(session.GetUserId(), map[string]interface{}{
"puzzle": sign.Puzzle,
}); err != nil {