From ce60c619a880f8eb4f0e192655cdf9559c9aba44 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Fri, 22 Jul 2022 23:14:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/robot/hero.go | 6 +++--- modules/task/model_task.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/robot/hero.go b/cmd/robot/hero.go index b841760ba..243dea09a 100644 --- a/cmd/robot/hero.go +++ b/cmd/robot/hero.go @@ -24,7 +24,7 @@ var ( fmt.Printf("%d- %v\n", (i + 1), v) } }, - // enabled: true, + enabled: true, next: func(robot *Robot, rsp proto.Message) { tcs := []*TestCase{} if _, ok := rsp.(*pb.HeroListResp); ok { @@ -33,9 +33,9 @@ var ( mainType: string(comm.ModuleHero), subType: hero.StrengthenUplv, req: &pb.HeroStrengthenUplvReq{ - HeroObjID: "62dab21d9efd6536b1cc1bb5", + HeroObjID: "62dabaacd8c5789e2cc8b95e", ExpCards: map[string]int32{ - "62dab23b9efd6536b1cc1c2a": 1, + "62dabac1d8c5789e2cc8b9d3": 1, }, }, rsp: &pb.HeroStrengthenUplvResp{}, diff --git a/modules/task/model_task.go b/modules/task/model_task.go index c2f3f96ff..f21dd0367 100644 --- a/modules/task/model_task.go +++ b/modules/task/model_task.go @@ -211,6 +211,20 @@ func (this *ModelTask) UpHeroLevel(uid string, taskId int32, tp *pb.TaskParam) * task.Progress = progress task.Status = 1 return task + } else { + progress = task.Progress - tp.Second + if progress <= 0 { + progress = 0 + } + update := map[string]interface{}{ + "progress": progress, + } + if err := this.modifyUserTask(task.Uid, task.Id, update); err != nil { + log.Errorf("err %v", err) + return nil + } + task.Progress = progress + return task } } return nil