From f38c02c383f4736e314faec1852abfed1f5187fe Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Thu, 4 Jan 2024 16:47:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/entertainment/api_getlist.go | 7 ++++++- modules/entertainment/module.go | 12 ++++++++++-- modules/hero/api_drawCard.go | 13 +++++-------- modules/modulebase.go | 6 +++--- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/modules/entertainment/api_getlist.go b/modules/entertainment/api_getlist.go index 332b1cb91..21cf500b7 100644 --- a/modules/entertainment/api_getlist.go +++ b/modules/entertainment/api_getlist.go @@ -31,8 +31,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EntertainGetList if !utils.IsToday(list.Rtime) { update := make(map[string]interface{}) list.Rtime = configure.Now().Unix() + list.Playtype = []int32{} + var tmp []int32 for _, v := range this.module.configure.GetGameConsumeIntegral() { - list.Playtype = append(list.Playtype, v.Key) // 配置读取一个玩法 + tmp = append(tmp, v.Key) // 配置读取一个玩法 + } + for _, v := range comm.GetRandWs(tmp, 2) { + list.Playtype = append(list.Playtype, tmp[v]) } list.Touxiang = 3 // 需求 默认3 后面可能走配置 update["touxiang"] = list.Touxiang // 每天投降次数清0 diff --git a/modules/entertainment/module.go b/modules/entertainment/module.go index 008645fd1..efd0ceddc 100644 --- a/modules/entertainment/module.go +++ b/modules/entertainment/module.go @@ -77,8 +77,8 @@ func (this *Entertainment) AddXxlCard(session comm.IUserSession, cards map[strin for k := range cards { if _, err := this.model.module.configure.GetGameConsumeHero(k); err != nil { errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ReqParameterError, - Title: pb.ErrorCode_ReqParameterError.ToString(), + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: err.Error(), } return @@ -271,6 +271,14 @@ func (this *Entertainment) AddXxlSkillCard(session comm.IUserSession, skill map[ return } for k, v := range skill { + if _, err := this.model.module.configure.GetGamePlaySkill(k); err != nil { // 参数校验 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), + } + return + } result.Skill[k] += v } this.model.modifyEntertainmList(session.GetUserId(), map[string]interface{}{ diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index 2427deed5..59c7549d6 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -307,16 +307,13 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq heroRecord.Cur = szCards update["selectcount"] = heroRecord.Selectcount update["cur"] = heroRecord.Cur + } else { + allres = append(allres, reward...) + if errdata, atno = this.module.DispenseAtno(session, allres, true); errdata != nil { //同意发送奖励 + return + } } this.module.modelRecord.ChangeHeroRecord(session.GetUserId(), update) - - if req.DrawType != 1 { - allres = append(allres, reward...) - - } - if errdata, atno = this.module.DispenseAtno(session, allres, true); errdata != nil { //同意发送奖励 - return - } session.SendMsg(string(this.module.GetType()), DrawCard, rsp) if req.DrawType != 1 { diff --git a/modules/modulebase.go b/modules/modulebase.go index ad71b37b0..089ccb84f 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -915,20 +915,20 @@ func (this *ModuleBase) DispenseAtno(session comm.IUserSession, res []*cfg.Gamea N: v, }) } - this.Debugf("发放三消卡片资源资源: %v errdata: %v", xxl, errdata) + this.Debugf("发放三消英雄卡片资源资源: %v errdata: %v", xxl, errdata) } if len(xxlSkill) > 0 { if errdata = this.ModuleEntertain.AddXxlSkillCard(session, xxlSkill, bPush); errdata != nil { return } - for k, v := range xxl { + for k, v := range xxlSkill { atno = append(atno, &pb.UserAtno{ A: comm.TitleType, T: k, N: v, }) } - this.Debugf("发放三消卡片资源资源: %v errdata: %v", xxl, errdata) + this.Debugf("发放三消技能卡片资源资源: %v errdata: %v", xxlSkill, errdata) } return