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 {
ObjID64 int64 `json:"obj_id"`
ItemTypeID int64 `json:"item_type_id"`
ObjID64 int64
ItemTypeID int64
ItemType string `json:"item_type"`
Code string `json:"code"`
Names []string `json:"names"`
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)
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 {
err2 := tx.Rollback()
logOnError(err2, "addObjItem : rollback insert obj")
@ -941,7 +941,8 @@ func loadObjItem2() error {
Auction: i.Auction,
Code: i.Code,
Exchange: i.Exchange,
ItemTypeID: i.ItemTypeID,
ItemType: i.ItemType
ItemTypeID: cacheObjSubType[i.ItemType],
Weight: i.Weight,
Craft: ChatWarsItemCraft{},
Names: make([]string, 0),