1
This commit is contained in:
parent
07275ceb46
commit
1f961f8917
@ -15,7 +15,7 @@ type RechargeCurrency struct {
|
||||
|
||||
type RechargeCurrencyTable struct {
|
||||
f5.CustomMetaTable
|
||||
netIdHash *q5.ConcurrentMap[int64, *RechargeCurrency]
|
||||
netIdHash *q5.ConcurrentMap[int32, *RechargeCurrency]
|
||||
}
|
||||
|
||||
func (this *RechargeCurrency) init(currencyName string, exchangeRate int64, currencyDecimal int64) {
|
||||
@ -56,12 +56,16 @@ func (this *RechargeCurrency) check() {
|
||||
}
|
||||
|
||||
func (this *RechargeCurrencyTable) Get(netId int32) *RechargeCurrency {
|
||||
return nil
|
||||
if v, ok := this.netIdHash.Load(netId); ok {
|
||||
return *v
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func (this *RechargeCurrencyTable) Load() {
|
||||
this.netIdHash = new(q5.ConcurrentMap[int64, *RechargeCurrency])
|
||||
nets := []int64{}
|
||||
this.netIdHash = new(q5.ConcurrentMap[int32, *RechargeCurrency])
|
||||
nets := []int32{}
|
||||
{
|
||||
if jsonStr, err := f5.ReadJsonFile("../config/nets.json"); err == nil {
|
||||
if err := q5.DecodeJson(jsonStr, &nets); err != nil {
|
||||
@ -86,6 +90,7 @@ func (this *RechargeCurrencyTable) Load() {
|
||||
}
|
||||
p := new(RechargeCurrency)
|
||||
p.init(currencyCfg.CurrencyName, currencyCfg.ExchangeRate, currencyCfg.CurrencyDecimal)
|
||||
p.check()
|
||||
this.netIdHash.Store(netId, p)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user