1
This commit is contained in:
parent
596cd7c96f
commit
651f21adde
@ -26,8 +26,8 @@ func (this *MarketApi) ProductList(c *gin.Context) {
|
||||
Filter struct {
|
||||
PriceMin interface{} `json:"price_min"`
|
||||
PriceMax interface{} `json:"price_max"`
|
||||
ItemIds []int32 `json:"item_ids"`
|
||||
HeroRanks []int32 `json:"hero_ranks"`
|
||||
ItemIds []interface{} `json:"item_ids"`
|
||||
HeroRanks []interface{} `json:"hero_ranks"`
|
||||
} `json:"filter"`
|
||||
Sort struct {
|
||||
Fields [] struct {
|
||||
@ -101,6 +101,13 @@ SELECT * FROM t_order A WHERE idx > %d AND net_id = %d AND status="%s"
|
||||
}
|
||||
{
|
||||
itemIds := map[int32]int32{}
|
||||
if reqJson.Search.Name != "" {
|
||||
mt.Table.Item.Search(reqJson.Search.Name, itemIds)
|
||||
}
|
||||
for _, val := range(reqJson.Filter.ItemIds) {
|
||||
itemId := q5.SafeToInt32(val)
|
||||
itemIds[itemId] = 1
|
||||
}
|
||||
if len(itemIds) > 0 {
|
||||
inSub := `item_id IN (`
|
||||
i := 0
|
||||
|
22
server/marketserver/mt/Contract.go
Normal file
22
server/marketserver/mt/Contract.go
Normal file
@ -0,0 +1,22 @@
|
||||
package mt
|
||||
|
||||
import (
|
||||
"f5"
|
||||
"mtb"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type Contract struct {
|
||||
mtb.Contract
|
||||
}
|
||||
|
||||
type ContractTable struct {
|
||||
f5.NameMetaTable[Contract]
|
||||
itemHash sync.Map //string => Contract
|
||||
}
|
||||
|
||||
func (this *Contract) Init1() {
|
||||
}
|
||||
|
||||
func (this *ContractTable) Search(name string, itemIds map[int32]int32) {
|
||||
}
|
@ -9,6 +9,7 @@ type table struct {
|
||||
NftDb *NftDbTable
|
||||
Config *ConfigTable
|
||||
Item *ItemTable
|
||||
Contract *ContractTable
|
||||
}
|
||||
|
||||
var Table = f5.New(func(this *table) {
|
||||
@ -32,4 +33,9 @@ var Table = f5.New(func(this *table) {
|
||||
this.PrimKey = ""
|
||||
})
|
||||
|
||||
this.Contract = f5.New(func(this *ContractTable) {
|
||||
this.FileName = "../config/contract.json"
|
||||
this.PrimKey = "name"
|
||||
})
|
||||
|
||||
})
|
||||
|
@ -39,6 +39,15 @@ type Item struct {
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
type Contract struct {
|
||||
name string
|
||||
json string
|
||||
address string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
}
|
||||
|
||||
func (this *MarketServerCluster) GetInstanceId() int32 {
|
||||
return this.instance_id
|
||||
}
|
||||
@ -127,6 +136,30 @@ func (this *Item) HasItemId() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Contract) GetName() string {
|
||||
return this.name
|
||||
}
|
||||
|
||||
func (this *Contract) HasName() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Contract) GetJson() string {
|
||||
return this.json
|
||||
}
|
||||
|
||||
func (this *Contract) HasJson() bool {
|
||||
return (this._flags1_ & (uint64(1) << 3)) > 0
|
||||
}
|
||||
|
||||
func (this *Contract) GetAddress() string {
|
||||
return this.address
|
||||
}
|
||||
|
||||
func (this *Contract) HasAddress() bool {
|
||||
return (this._flags1_ & (uint64(1) << 4)) > 0
|
||||
}
|
||||
|
||||
|
||||
func (this *MarketServerCluster) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.instance_id, "instance_id", &this._flags1_, 1, kv)
|
||||
@ -150,3 +183,9 @@ func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.item_id, "item_id", &this._flags1_, 2, kv)
|
||||
}
|
||||
|
||||
func (this *Contract) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.name, "name", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.json, "json", &this._flags1_, 3, kv)
|
||||
f5.ReadMetaTableField(&this.address, "address", &this._flags1_, 4, kv)
|
||||
}
|
||||
|
@ -28,3 +28,10 @@ message Item
|
||||
optional string name = 1;
|
||||
optional int32 item_id = 2;
|
||||
}
|
||||
|
||||
message Contract
|
||||
{
|
||||
optional string name = 1;
|
||||
optional string json = 3;
|
||||
optional string address = 4;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user