From 2ecebd23fdf31ef0d4232e2a66a8a65c72938727 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Sat, 7 Jan 2023 14:46:47 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E5=85=B3=E6=98=9F=E7=BA=A7=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E5=88=B0=E6=8C=87=E5=AE=9A=E7=9A=84=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/hero_test.go | 26 ++++++++++++++++---------- modules/mline/api_challengeover.go | 13 ++++++++++--- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/modules/hero/hero_test.go b/modules/hero/hero_test.go index ccd28ac06..48b28ad47 100644 --- a/modules/hero/hero_test.go +++ b/modules/hero/hero_test.go @@ -18,7 +18,6 @@ import ( "go_dreamfactory/sys/configure" "go_dreamfactory/sys/db" "go_dreamfactory/utils" - "math" "reflect" "strings" "testing" @@ -72,15 +71,22 @@ func GetMonthStartEnd() (int64, int64) { } func Test_Main(t *testing.T) { - var l int64 - var l1 int64 - var i int32 - var f float64 - i = math.MaxInt32 - l = int64(i) << 31 - l1 = 1 << 31 - f = float64(l) - fmt.Printf("%d,%d,%f", l, l1, f) + var star1, star2, star3 int32 + var rst int32 + star1 = 1 << 2 + star2 = 1 << 1 + star3 = 1 << 0 + + //rst = star1 ^ star2 ^ star3 // 三星 + //rst = star1 ^ star2 // 2星 + rst ^= star1 + rst ^= star2 + // 校验星 + b1 := (rst&star1 == star1) + b2 := (rst&star2 == star2) + b3 := (rst&star3 == star3) + fmt.Printf("%d,%d,%d,%d", star1, star2, star3, rst) + fmt.Printf("%v,%v,%v,%d", b1, b2, b3, rst) var list []int32 var list2 []int32 list = []int32{1, 2, 3, 4, 5, 6, 7, 8, 9} diff --git a/modules/mline/api_challengeover.go b/modules/mline/api_challengeover.go index 822ef64d6..95152258f 100644 --- a/modules/mline/api_challengeover.go +++ b/modules/mline/api_challengeover.go @@ -76,16 +76,23 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.MlineChall code = pb.ErrorCode_ConfigNoFound return } + var star1, star2, star3 int32 + star1 = 1 << 2 + star2 = 1 << 1 + star3 = 1 << 0 for i, v := range stageConf.StarType { if v == comm.MainStarType1 { - star += stageConf.Star[i] + //star += stageConf.Star[i] + star ^= star1 } else if v == comm.MainStarType2 { if req.Report.Death <= stageConf.StarValue[i] { - star += stageConf.Star[i] + //star += stageConf.Star[i] + star ^= star2 } } else if v == comm.MainStarType3 { if req.Report.Round <= stageConf.StarValue[i] { - star += stageConf.Star[i] + //star += stageConf.Star[i] + star ^= star3 } } }