From aae164bec7728a8335016445970e40c96c85f8da Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 2 Dec 2022 10:57:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=AB=9E=E6=8A=80=E5=9C=BA?= =?UTF-8?q?=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 1 + modules/user/module.go | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/comm/const.go b/comm/const.go index 0f47ce036..576d9fc3f 100644 --- a/comm/const.go +++ b/comm/const.go @@ -295,6 +295,7 @@ const ( ResFriend = "friendPoint" //友情点 StarCoin = "starcoin" //星座币 SociatyCoin = "guildcoin" //公会币 + ArenaCoin = "arenacoin" //竞技场币 ) const ( Gold int32 = 1 //金币 diff --git a/modules/user/module.go b/modules/user/module.go index 2eac87352..7d2e1bc07 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -326,6 +326,14 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha } } change.Guildcoin += add + case comm.ArenaCoin: + if add < 0 { + if userEx.ArenaCoin+add < 0 { + code = pb.ErrorCode_UserSociatyCoinNoEnough + return + } + } + change.Guildcoin += add default: err = errors.New(fmt.Sprintf("%s no supported", attr)) return