1
This commit is contained in:
parent
db0139e719
commit
138c46f7f1
@ -50,10 +50,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
|
|||||||
AccountAddress string `json:"account_address"`
|
AccountAddress string `json:"account_address"`
|
||||||
}{}
|
}{}
|
||||||
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
if err := c.ShouldBindJSON(&reqJson); err != nil {
|
||||||
c.JSON(http.StatusOK, gin.H{
|
f5.RspErr(c, 1, err.Error())
|
||||||
"errcode": 1,
|
|
||||||
"errmsg": err.Error(),
|
|
||||||
})
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
currencyMeta := mt.Table.Contract.GetByNetIdName(reqJson.NetId, "TestToken")
|
currencyMeta := mt.Table.Contract.GetByNetIdName(reqJson.NetId, "TestToken")
|
||||||
@ -66,6 +63,10 @@ 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 {
|
||||||
|
f5.RspErr(c, 2, "num param error")
|
||||||
|
return
|
||||||
|
}
|
||||||
nowTime := q5.ToInt32(f5.GetApp().GetRealSeconds())
|
nowTime := q5.ToInt32(f5.GetApp().GetRealSeconds())
|
||||||
shortOrderId := f5.GetApp().NewLockNodeUuid()
|
shortOrderId := f5.GetApp().NewLockNodeUuid()
|
||||||
orderId := ""
|
orderId := ""
|
||||||
@ -76,7 +77,7 @@ func (this *RechargeApi) Buy(c *gin.Context) {
|
|||||||
nowTime,
|
nowTime,
|
||||||
0,
|
0,
|
||||||
[3]int64{
|
[3]int64{
|
||||||
0,
|
q5.ToInt64(reqJson.Num),
|
||||||
q5.ToInt64(goodsMeta.GetId()),
|
q5.ToInt64(goodsMeta.GetId()),
|
||||||
shortOrderId,
|
shortOrderId,
|
||||||
})
|
})
|
||||||
|
14
server/marketserver/mt/RechargeCurrency.go
Normal file
14
server/marketserver/mt/RechargeCurrency.go
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package mt
|
||||||
|
|
||||||
|
import (
|
||||||
|
"f5"
|
||||||
|
"main/mtb"
|
||||||
|
)
|
||||||
|
|
||||||
|
type RechargeCurrency struct {
|
||||||
|
mtb.RechargeCurrency
|
||||||
|
}
|
||||||
|
|
||||||
|
type RechargeCurrencyTable struct {
|
||||||
|
f5.IdMetaTable[RechargeCurrency]
|
||||||
|
}
|
@ -16,6 +16,7 @@ type table struct {
|
|||||||
Web3ServiceCluster *Web3ServiceClusterTable
|
Web3ServiceCluster *Web3ServiceClusterTable
|
||||||
Web3SignCluster *Web3SignClusterTable
|
Web3SignCluster *Web3SignClusterTable
|
||||||
Recharge *RechargeTable
|
Recharge *RechargeTable
|
||||||
|
RechargeCurrency *RechargeCurrencyTable
|
||||||
}
|
}
|
||||||
|
|
||||||
var Table = f5.New(func(this *table) {
|
var Table = f5.New(func(this *table) {
|
||||||
@ -66,6 +67,11 @@ var Table = f5.New(func(this *table) {
|
|||||||
this.PrimKey = ""
|
this.PrimKey = ""
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.RechargeCurrency = f5.New(func(this *RechargeCurrencyTable) {
|
||||||
|
this.FileName = "../config/recharge_currency@recharge_currency.json"
|
||||||
|
this.PrimKey = ""
|
||||||
|
})
|
||||||
|
|
||||||
this.Recharge = f5.New(func(this *RechargeTable) {
|
this.Recharge = f5.New(func(this *RechargeTable) {
|
||||||
this.FileName = "../res/recharge@recharge.json"
|
this.FileName = "../res/recharge@recharge.json"
|
||||||
this.PrimKey = "id"
|
this.PrimKey = "id"
|
||||||
|
@ -60,6 +60,15 @@ type Config struct {
|
|||||||
_flags2_ uint64
|
_flags2_ uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type RechargeCurrency struct {
|
||||||
|
currency_name string
|
||||||
|
exchange_rate int32
|
||||||
|
currency_decimal int32
|
||||||
|
|
||||||
|
_flags1_ uint64
|
||||||
|
_flags2_ uint64
|
||||||
|
}
|
||||||
|
|
||||||
type Item struct {
|
type Item struct {
|
||||||
name string
|
name string
|
||||||
id int32
|
id int32
|
||||||
@ -313,6 +322,30 @@ func (this *Config) HasJwksUri() bool {
|
|||||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) GetCurrencyName() string {
|
||||||
|
return this.currency_name
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) HasCurrencyName() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) GetExchangeRate() int32 {
|
||||||
|
return this.exchange_rate
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) HasExchangeRate() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) GetCurrencyDecimal() int32 {
|
||||||
|
return this.currency_decimal
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) HasCurrencyDecimal() bool {
|
||||||
|
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Item) GetName() string {
|
func (this *Item) GetName() string {
|
||||||
return this.name
|
return this.name
|
||||||
}
|
}
|
||||||
@ -475,6 +508,12 @@ func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
|||||||
f5.ReadMetaTableField(&this.jwks_uri, "jwks_uri", &this._flags1_, 2, kv)
|
f5.ReadMetaTableField(&this.jwks_uri, "jwks_uri", &this._flags1_, 2, kv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *RechargeCurrency) LoadFromKv(kv map[string]interface{}) {
|
||||||
|
f5.ReadMetaTableField(&this.currency_name, "currency_name", &this._flags1_, 1, kv)
|
||||||
|
f5.ReadMetaTableField(&this.exchange_rate, "exchange_rate", &this._flags1_, 2, kv)
|
||||||
|
f5.ReadMetaTableField(&this.currency_decimal, "currency_decimal", &this._flags1_, 3, kv)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
||||||
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
|
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
|
||||||
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 2, kv)
|
f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 2, kv)
|
||||||
|
@ -48,6 +48,13 @@ message Config
|
|||||||
optional string jwks_uri = 2;
|
optional string jwks_uri = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message RechargeCurrency
|
||||||
|
{
|
||||||
|
optional string currency_name = 1;
|
||||||
|
optional int32 exchange_rate = 2;
|
||||||
|
optional int32 currency_decimal = 3;
|
||||||
|
}
|
||||||
|
|
||||||
message Item
|
message Item
|
||||||
{
|
{
|
||||||
optional string name = 1;
|
optional string name = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user