This commit is contained in:
aozhiwei 2024-06-21 11:27:04 +08:00
parent 31a788f5cb
commit 444aa2c403
4 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@ func (this *ItemTable) Search(name string, itemIds map[int32]int32) {
this.Traverse( this.Traverse(
func (ele *Item) bool { func (ele *Item) bool {
if strings.Contains(ele.lowerName, name) { if strings.Contains(ele.lowerName, name) {
itemIds[ele.GetItemId()] = 1 itemIds[ele.GetId()] = 1
} }
return true return true
}) })

View File

@ -42,8 +42,8 @@ var Table = f5.New(func(this *table) {
}) })
this.Item = f5.New(func(this *ItemTable) { this.Item = f5.New(func(this *ItemTable) {
this.FileName = "../config/item.json" this.FileName = "../res/item@item.json"
this.PrimKey = "" this.PrimKey = "id"
}) })
this.Contract = f5.New(func(this *ContractTable) { this.Contract = f5.New(func(this *ContractTable) {

View File

@ -56,7 +56,7 @@ type Config struct {
type Item struct { type Item struct {
name string name string
item_id int32 id int32
_flags1_ uint64 _flags1_ uint64
_flags2_ uint64 _flags2_ uint64
@ -245,11 +245,11 @@ func (this *Item) HasName() bool {
return (this._flags1_ & (uint64(1) << 1)) > 0 return (this._flags1_ & (uint64(1) << 1)) > 0
} }
func (this *Item) GetItemId() int32 { func (this *Item) GetId() int32 {
return this.item_id return this.id
} }
func (this *Item) HasItemId() bool { func (this *Item) HasId() bool {
return (this._flags1_ & (uint64(1) << 2)) > 0 return (this._flags1_ & (uint64(1) << 2)) > 0
} }
@ -315,7 +315,7 @@ func (this *Config) LoadFromKv(kv map[string]interface{}) {
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.item_id, "item_id", &this._flags1_, 2, kv) f5.ReadMetaTableField(&this.id, "id", &this._flags1_, 2, kv)
} }
func (this *Contract) LoadFromKv(kv map[string]interface{}) { func (this *Contract) LoadFromKv(kv map[string]interface{}) {

View File

@ -45,7 +45,7 @@ message Config
message Item message Item
{ {
optional string name = 1; optional string name = 1;
optional int32 item_id = 2; optional int32 id = 2;
} }
message Contract message Contract