From 6efdfa4fb114d75343497bbeb27b81c18386ac42 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 13 Jan 2023 19:16:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E7=BB=93=E6=9D=9F=E9=AB=98?= =?UTF-8?q?=E6=98=9F=E8=A6=86=E7=9B=96=E4=BD=8E=E6=98=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/mline/api_challengeover.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 3a760ceaf..73ec47152 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -96,16 +96,35 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall } } } + // 判断是不是首通 if _, ok := curChapter.Star[req.StageId]; !ok { first = true curChapter.Star[req.StageId] = star // 星级赋值 update["star"] = curChapter.Star } - if curChapter.Star[req.StageId] > star { // 给最高星 - curChapter.Star[req.StageId] = star - update["star"] = curChapter.Star + + // 判断星数 + var ( + totalStar int32 + preStar int32 + ) + if curChapter.Star[req.StageId] != star { + for _, v := range szStar { + if star&v == v { + totalStar++ + } + + if curChapter.Star[req.StageId]&v == v { + preStar++ + } + } + if totalStar >= preStar { // 给最高星 + curChapter.Star[req.StageId] = star + update["star"] = curChapter.Star + } } + curChapter.Ps[req.StageId] = 0 // 清空预扣体力值 update["ps"] = curChapter.Ps