This commit is contained in:
shoopea 2020-01-12 21:46:41 +08:00
parent 64ab463a92
commit d481d63de9
2 changed files with 6 additions and 4 deletions

5
def.go
View File

@ -97,8 +97,9 @@ type ChatWarsUser struct {
} }
type ChatWarsItem struct { type ChatWarsItem struct {
ObjID64 int64 `json:"obj_id"` ObjID64 int64
ItemTypeID int64 `json:"item_type_id"` ItemTypeID int64
ItemType string `json:"item_type"`
Code string `json:"code"` Code string `json:"code"`
Names []string `json:"names"` Names []string `json:"names"`
Weight int64 `json:"weight"` Weight int64 `json:"weight"`

5
obj.go
View File

@ -758,7 +758,7 @@ func addObjItem(code string, name string, itemTypeID64 int64, weight int64, exch
res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id)
VALUES (` + strconv.FormatInt(cacheObjType[`item`], 10) + `,` + fmt.Sprintf("%d", itemTypeID64) + `);`) VALUES (` + strconv.FormatInt(cacheObjType[`item`], 10) + `,` + fmt.Sprintf("%d", itemTypeID64) + `);`)
logOnError(err, "addObjItem : exec insert obj") logOnError(err, "addObjItem : exec insert obj ("+code+", "+name+")")
if err != nil { if err != nil {
err2 := tx.Rollback() err2 := tx.Rollback()
logOnError(err2, "addObjItem : rollback insert obj") logOnError(err2, "addObjItem : rollback insert obj")
@ -941,7 +941,8 @@ func loadObjItem2() error {
Auction: i.Auction, Auction: i.Auction,
Code: i.Code, Code: i.Code,
Exchange: i.Exchange, Exchange: i.Exchange,
ItemTypeID: i.ItemTypeID, ItemType: i.ItemType
ItemTypeID: cacheObjSubType[i.ItemType],
Weight: i.Weight, Weight: i.Weight,
Craft: ChatWarsItemCraft{}, Craft: ChatWarsItemCraft{},
Names: make([]string, 0), Names: make([]string, 0),