1
This commit is contained in:
parent
389ee8ace7
commit
dc8c2e6495
@ -20,6 +20,7 @@ type RechargeApi struct {
|
||||
}
|
||||
|
||||
func (ea *RechargeApi) RechargeList(c *gin.Context) {
|
||||
//netId := q5.ToInt64(c.Param("net_id"))
|
||||
rspObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
|
@ -1,7 +1,9 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"q5"
|
||||
"f5"
|
||||
"fmt"
|
||||
"main/mtb"
|
||||
"main/constant"
|
||||
)
|
||||
@ -11,7 +13,7 @@ type RechargeCurrency struct {
|
||||
}
|
||||
|
||||
type RechargeCurrencyTable struct {
|
||||
f5.IdMetaTable[RechargeCurrency]
|
||||
f5.CustomMetaTable
|
||||
selfConf *RechargeCurrency
|
||||
}
|
||||
|
||||
@ -35,7 +37,6 @@ func (this *RechargeCurrency) Init1() {
|
||||
}
|
||||
|
||||
func (this *RechargeCurrencyTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(0))
|
||||
if this.selfConf == nil {
|
||||
panic("无法读取recharge_currency.json")
|
||||
}
|
||||
@ -44,3 +45,32 @@ func (this *RechargeCurrencyTable) PostInit1() {
|
||||
func (this *RechargeCurrencyTable) Get(netId int32) *RechargeCurrency {
|
||||
return this.selfConf
|
||||
}
|
||||
|
||||
func (this *RechargeCurrencyTable) Load() {
|
||||
nets := []int64{}
|
||||
{
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
|
||||
if err := q5.DecodeJson(jsonStr, &nets); err != nil {
|
||||
panic(fmt.Sprintf("load metafile json decode error %s %s", "nets.json", err))
|
||||
}
|
||||
} else {
|
||||
panic(fmt.Sprintf("load metafile error %s %s", "nets.json", err))
|
||||
}
|
||||
}
|
||||
{
|
||||
for _, val := range nets {
|
||||
netId := val
|
||||
fileName := fmt.Sprintf("../config/nets/%d/currency.json", netId)
|
||||
if jsonStr, err := f5.ReadJsonFile(fileName); err == nil {
|
||||
currencys := []struct {
|
||||
CurrencyName string `json:"currency_name"`
|
||||
ExchangeRate int64 `json:"exchange_rate"`
|
||||
CurrencyDecimal int64 `json:"currency_decimal"`
|
||||
}{}
|
||||
if err := q5.DecodeJson(jsonStr, ¤cys); err != nil {
|
||||
panic(fmt.Sprintf("load metafile json decode error %s %s", "currency.json", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,10 +67,7 @@ var Table = f5.New(func(this *table) {
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.RechargeCurrency = f5.New(func(this *RechargeCurrencyTable) {
|
||||
this.FileName = "../config/recharge_currency@recharge_currency.json"
|
||||
this.PrimKey = ""
|
||||
})
|
||||
this.RechargeCurrency = new(RechargeCurrencyTable)
|
||||
|
||||
this.Recharge = f5.New(func(this *RechargeTable) {
|
||||
this.FileName = "../res/recharge@recharge.json"
|
||||
|
Loading…
x
Reference in New Issue
Block a user