This commit is contained in:
aozhiwei 2024-08-07 15:27:46 +08:00
parent d6fd79d142
commit 6d32241f85
2 changed files with 16 additions and 3 deletions

View File

@ -23,15 +23,28 @@ func (ea *RechargeApi) RechargeList(c *gin.Context) {
rspObj := struct {
ErrCode int32 `json:"errcode"`
ErrMsg string `json:"errmsg"`
CurrencyName string `json:"currency_name"`
CurrencyAddress string `json:"currency_address"`
Rows []interface{} `json:"rows"`
}{}
netId := q5.ToInt32(c.DefaultQuery("net_id", "0"))
currencyMeta := mt.Table.RechargeCurrency.Get(netId)
if currencyMeta == nil {
f5.RspErr(c, 2, "server internal error")
return
}
currencyContractMeta := mt.Table.Contract.GetByNetIdName(netId, currencyMeta.GetCurrencyName())
if currencyContractMeta == nil {
f5.RspErr(c, 2, "server internal error")
return
}
mt.Table.Recharge.RawMetaTable.Traverse(func(tb *mt.Recharge) bool {
tmpmap := map[string]interface{}{}
tmpmap["goods_id"] = tb.GetId()
tmpmap["diamond"] = tb.GetDiamond()
//tmpmap["currency"] = tb.GetRechargeCurrency()
tmpmap["price"] = tb.GetPrice()
tmpmap["max_buy_times"] = tb.GetMaxBuyTimes()
rspObj.Rows = append(rspObj.Rows, tmpmap)
@ -57,7 +70,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
f5.RspErr(c, 2, "num param error")
return
}
currencyMeta := mt.Table.RechargeCurrency.Get()
currencyMeta := mt.Table.RechargeCurrency.Get(reqJson.NetId)
if currencyMeta == nil {
f5.RspErr(c, 2, "server internal error")
return

View File

@ -21,6 +21,6 @@ func (this *RechargeCurrencyTable) PostInit1() {
}
}
func (this *RechargeCurrencyTable) Get() *RechargeCurrency {
func (this *RechargeCurrencyTable) Get(netId int32) *RechargeCurrency {
return this.selfConf
}