This commit is contained in:
aozhiwei 2024-08-07 16:52:01 +08:00
parent 01848848c7
commit 389ee8ace7
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{ {
"currency_name": "", "currency_name": "TestToken",
"exchange_rate": 50, "exchange_rate": 50,
"currency_decimal": 6 "currency_decimal": 6
} }

View File

@ -46,7 +46,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
reqJson := struct { reqJson := struct {
NetId int32 `json:"net_id"` NetId int32 `json:"net_id"`
GoodsId int32 `json:"goods_id"` GoodsId int32 `json:"goods_id"`
Num int32 `json:"num"` Num int32 `json:"goods_num"`
AccountAddress string `json:"account_address"` AccountAddress string `json:"account_address"`
}{} }{}
if err := c.ShouldBindJSON(&reqJson); err != nil { if err := c.ShouldBindJSON(&reqJson); err != nil {
@ -82,7 +82,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
f5.RspErr(c, 2, "goods id param error") f5.RspErr(c, 2, "goods id param error")
return return
} }
if reqJson.Num < 0 || reqJson.Num > goodsMeta.GetMaxBuyTimes() { if reqJson.Num <= 0 || reqJson.Num > goodsMeta.GetMaxBuyTimes() {
f5.RspErr(c, 2, "num param error") f5.RspErr(c, 2, "num param error")
return return
} }
@ -130,7 +130,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
Calls []jccommon.ContractCall `json:"calls"` Calls []jccommon.ContractCall `json:"calls"`
}{} }{}
var itemNum int32 = reqJson.Num var itemNum int32 = reqJson.Num
var diamond int64 = currencyMeta.GetExchangeRate() * q5.ToInt64(goodsMeta.GetDiamond()) * int64(itemNum) var diamond int64 = q5.ToInt64(goodsMeta.GetDiamond()) * int64(itemNum)
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3SignCluster.RandElement().GetUrl()) url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3SignCluster.RandElement().GetUrl())
f5.GetHttpCliMgr().SendGoStyleRequest( f5.GetHttpCliMgr().SendGoStyleRequest(
url, url,