This commit is contained in:
shoopea 2020-01-26 16:40:59 +08:00
parent 1d0d0c9a01
commit 9c8ee7a4fa

View File

@ -191,18 +191,18 @@ func setObjItemWeight(objID64 int64, weight int64) error {
func setObjItemCraft(objID64 int64, cmd string, mana int64) error {
log.Printf("setObjItemCraft[%d] : %s - %d\n", objID64, cmd, mana)
stmt, err := db.Prepare(`INSERT INTO obj_craft_item (obj_id, cmd, mana)
VALUES (?, ?, ?)
stmt, err := db.Prepare(`INSERT INTO obj_craft (obj_id, cmd, mana)
VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE cmd = ?, mana = ?;`)
logOnError(err, "setObjItemCraft : prepare update obj_craft_item")
logOnError(err, "setObjItemCraft : prepare update obj_craft")
if err != nil {
return err
}
defer stmt.Close()
_, err = stmt.Exec(objID64, cmd, mana, cmd, mana)
logOnError(err, fmt.Sprintf("setObjItemCraft : update obj_craft_item(%d)", objID64))
logOnError(err, fmt.Sprintf("setObjItemCraft : update obj_craft(%d)", objID64))
if err != nil {
return err
}