Merge branch 'dev' of git.kingsome.cn:server/game2006go into dev

This commit is contained in:
yangduo 2024-08-29 16:21:23 +08:00
commit b7bb22140f
6 changed files with 80 additions and 3 deletions

View File

@ -99,6 +99,10 @@
"switch_name": "ui.contribution.show", "switch_name": "ui.contribution.show",
"switch_desc": "25-贡献点是否显示" "switch_desc": "25-贡献点是否显示"
}, },
{
"switch_name": "ui.activationCode",
"switch_desc": "26-激活码是否显示"
},
{ {
"switch_name": "only.allowed.superWhiteList", "switch_name": "only.allowed.superWhiteList",
"switch_desc": "100-只允许至尊白名单用户登录登录" "switch_desc": "100-只允许至尊白名单用户登录登录"

View File

@ -135,6 +135,42 @@ CREATE TABLE `t_super_whitelist` (
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_whitelist`
--
DROP TABLE IF EXISTS `t_whitelist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_whitelist` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`user_identity` varchar(60) NOT NULL COMMENT 'account_id or account_address or email',
`enable` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `user_identity` (`user_identity`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_blacklist`
--
DROP TABLE IF EXISTS `t_blacklist`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_blacklist` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`user_identity` varchar(60) NOT NULL COMMENT 'account_id or account_address or email',
`enable` int(11) NOT NULL DEFAULT '0' COMMENT '是否生效',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `user_identity` (`user_identity`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;

View File

@ -101,9 +101,13 @@ func (this *RechargeApi) BuyWithEmail(c *gin.Context) {
CurrencyAddress string `json:"currency_address"` CurrencyAddress string `json:"currency_address"`
}{} }{}
if err := c.ShouldBindJSON(&reqJson); err != nil { if err := c.ShouldBindJSON(&reqJson); err != nil {
f5.GetSysLog().Info("BuyWithEmail passport_address:%s err:%s",
passportAddress, err)
f5.RspErr(c, 1, err.Error()) f5.RspErr(c, 1, err.Error())
return return
} }
f5.GetSysLog().Info("BuyWithEmail passport_address:%s email:%s reqJson:%s",
passportAddress, email, q5.EncodeJson(&reqJson))
if email == "" { if email == "" {
f5.RspErr(c, 1, "email is empty") f5.RspErr(c, 1, "email is empty")
return return
@ -119,28 +123,34 @@ func (this *RechargeApi) internalBuy(c *gin.Context,
passportAddress = strings.ToLower(passportAddress) passportAddress = strings.ToLower(passportAddress)
currencyMeta := mt.Table.Currency.GetByNetIdAddress(netId, currencyAddress) currencyMeta := mt.Table.Currency.GetByNetIdAddress(netId, currencyAddress)
if currencyMeta == nil { if currencyMeta == nil {
f5.GetSysLog().Info("internalBuy error:1")
f5.RspErr(c, 2, "server internal error") f5.RspErr(c, 2, "server internal error")
return return
} }
currencyContractMeta := currencyMeta.GetContract() currencyContractMeta := currencyMeta.GetContract()
if currencyContractMeta == nil { if currencyContractMeta == nil {
f5.GetSysLog().Info("internalBuy error:2")
f5.RspErr(c, 2, "server internal error") f5.RspErr(c, 2, "server internal error")
return return
} }
goodsMeta := mt.Table.Recharge.GetById(q5.ToInt64(goodsId)) goodsMeta := mt.Table.Recharge.GetById(q5.ToInt64(goodsId))
if goodsMeta == nil { if goodsMeta == nil {
f5.GetSysLog().Info("internalBuy error:3")
f5.RspErr(c, 2, "goods id param error") f5.RspErr(c, 2, "goods id param error")
return return
} }
if goodsMeta.GetPrice() <= 0 { if goodsMeta.GetPrice() <= 0 {
f5.GetSysLog().Info("internalBuy error:4")
f5.RspErr(c, 2, "goods id param error") f5.RspErr(c, 2, "goods id param error")
return return
} }
if goodsNum <= 0 || goodsNum > goodsMeta.GetMaxBuyTimes() { if goodsNum <= 0 || goodsNum > goodsMeta.GetMaxBuyTimes() {
f5.GetSysLog().Info("internalBuy error:5")
f5.RspErr(c, 2, "num param error") f5.RspErr(c, 2, "num param error")
return return
} }
if email != "" && goodsMeta.GetCanEmailBuy() == 0 { if email != "" && goodsMeta.GetCanEmailBuy() == 0 {
f5.GetSysLog().Info("internalBuy error:6")
f5.RspErr(c, 2, "cant email buy") f5.RspErr(c, 2, "cant email buy")
return return
} }
@ -161,6 +171,7 @@ func (this *RechargeApi) internalBuy(c *gin.Context,
var err error var err error
orderId, err = transId.ToString() orderId, err = transId.ToString()
if err != nil { if err != nil {
f5.GetSysLog().Info("internalBuy error:6")
f5.RspErr(c, 2, "server internal error") f5.RspErr(c, 2, "server internal error")
return return
} }
@ -175,13 +186,16 @@ func (this *RechargeApi) internalBuy(c *gin.Context,
f5.GetSysLog().Info("recharge net_id:%d currency_name:%s decimal:%d srcPrice:%d bnPrice:%s", f5.GetSysLog().Info("recharge net_id:%d currency_name:%s decimal:%d srcPrice:%d bnPrice:%s",
netId, currencyMeta.GetCurrencyName(), currencyMeta.GetCurrencyDecimal(), srcPrice, bnPrice.String()); netId, currencyMeta.GetCurrencyName(), currencyMeta.GetCurrencyDecimal(), srcPrice, bnPrice.String());
if bnPrice.Cmp(big.NewInt(0)) < 0 || bnPrice.Cmp(big.NewInt(srcPrice)) < 0 { if bnPrice.Cmp(big.NewInt(0)) < 0 || bnPrice.Cmp(big.NewInt(srcPrice)) < 0 {
f5.GetSysLog().Info("internalBuy error:7")
f5.RspErr(c, 3, "server internal error") f5.RspErr(c, 3, "server internal error")
return return
} }
if ok, err := service.User.InBlackList(accountAddress); err != nil { if ok, err := service.User.InBlackList(accountAddress); err != nil {
f5.GetSysLog().Info("internalBuy error:8")
f5.RspErr(c, 500, "server internal error") f5.RspErr(c, 500, "server internal error")
return return
} else if ok { } else if ok {
f5.GetSysLog().Info("internalBuy error:9")
f5.RspErr(c, 501, "illegal user") f5.RspErr(c, 501, "illegal user")
return return
} }
@ -210,10 +224,12 @@ func (this *RechargeApi) internalBuy(c *gin.Context,
params, params,
func(rsp f5.HttpCliResponse) { func(rsp f5.HttpCliResponse) {
if rsp.GetErr() != nil { if rsp.GetErr() != nil {
f5.GetSysLog().Info("internalBuy error:a")
f5.RspErr(c, 500, "server internal error") f5.RspErr(c, 500, "server internal error")
return return
} }
if q5.DecodeJson(rsp.GetRawData(), &jsonRspObj) != nil { if q5.DecodeJson(rsp.GetRawData(), &jsonRspObj) != nil {
f5.GetSysLog().Info("internalBuy error:b")
f5.RspErr(c, 500, "server internal error") f5.RspErr(c, 500, "server internal error")
return return
} }
@ -236,9 +252,18 @@ func (this *RechargeApi) internalBuy(c *gin.Context,
diamond, diamond,
presentDiamond, presentDiamond,
email) { email) {
f5.GetSysLog().Info("internalBuy error:c")
f5.RspErr(c, 500, "server internal error") f5.RspErr(c, 500, "server internal error")
return return
} }
f5.GetSysLog().Info("recharge net_id:%d currency_name:%s decimal:%d srcPrice:%d bnPrice:%s calls.len:%d jsonRsp:%s",
netId,
currencyMeta.GetCurrencyName(),
currencyMeta.GetCurrencyDecimal(),
srcPrice,
bnPrice.String(),
len(jsonRspObj.Calls),
q5.EncodeJson(&jsonRspObj));
c.JSON(200, jsonRspObj) c.JSON(200, jsonRspObj)
}) })
} }

View File

@ -11,6 +11,13 @@ type gameSwitch struct {
time int64 time int64
} }
func (this *gameSwitch) init() {
this.GetSwitchList()
}
func (this *gameSwitch) unInit() {
}
func (this *gameSwitch) GetSwitchList() map[string]int32 { func (this *gameSwitch) GetSwitchList() map[string]int32 {
now := f5.GetApp().GetRealSeconds() now := f5.GetApp().GetRealSeconds()
if now > this.time+30 { if now > this.time+30 {

View File

@ -6,9 +6,11 @@ type serviceMgr struct {
func (this *serviceMgr) Init() { func (this *serviceMgr) Init() {
Contribution.init() Contribution.init()
User.init() User.init()
GameSwitches.init()
} }
func (this *serviceMgr) UnInit() { func (this *serviceMgr) UnInit() {
Contribution.unInit() Contribution.unInit()
User.unInit() User.unInit()
GameSwitches.unInit()
} }

View File

@ -1,9 +1,9 @@
package service package service
import ( import (
"f5" //"f5"
"main/constant" //"main/constant"
"q5" //"q5"
) )
//"strings" //"strings"
@ -18,6 +18,8 @@ func (this *user) unInit() {
} }
func (this *user) InBlackList(userIdentity string) (bool, error) { func (this *user) InBlackList(userIdentity string) (bool, error) {
return false, nil
/*
if userIdentity == "" { if userIdentity == "" {
return true, nil return true, nil
} }
@ -37,4 +39,5 @@ func (this *user) InBlackList(userIdentity string) (bool, error) {
blocked = ds.Next() && q5.SafeToInt32(ds.GetByName("blocked")) != 0 && q5.SafeToInt32(ds.GetByName("deleted")) == 0 blocked = ds.Next() && q5.SafeToInt32(ds.GetByName("blocked")) != 0 && q5.SafeToInt32(ds.GetByName("deleted")) == 0
}) })
return blocked, queryerr return blocked, queryerr
*/
} }