From ff4866c7bfd7ff9abea49963c19e33d2049bc833 Mon Sep 17 00:00:00 2001 From: shoopea Date: Thu, 2 Jan 2020 23:38:53 +0800 Subject: [PATCH] test --- obj.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/obj.go b/obj.go index 7e50895..7779b1d 100644 --- a/obj.go +++ b/obj.go @@ -232,7 +232,7 @@ func addObjMsg(msgID64 int64, msgChatID64 int64, msgTGUserID64 int64, msgTGSende } res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) - VALUES (` + strconv.Itoa(cacheObjType[`msg`]) + `,` + strconv.FormatInt(cacheObjSubType[`msg`], 10) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`msg`], 10) + `,` + strconv.FormatInt(cacheObjSubType[`msg`], 10) + `);`) if err != nil { err2 := tx.Rollback() logOnError(err2, "addObjMsg : rollback insert obj") @@ -359,7 +359,7 @@ func addObjCastle(logo string, name string) (int64, error) { } res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) - VALUES (` + strconv.Itoa(cacheObjType[`castle`]) + `,` + strconv.Itoa(cacheObjSubType[`castle`]) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`castle`], 10) + `,` + strconv.FormatInt(cacheObjSubType[`castle`], 10) + `);`) logOnError(err, "addObjCastle : exec insert obj") if err != nil { err2 := tx.Rollback() @@ -451,7 +451,7 @@ func addObjGuild(tag string, name string) (int64, error) { } res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) - VALUES (` + strconv.Itoa(cacheObjType[`guild`]) + `,` + strconv.Itoa(cacheObjSubType[`guild`]) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`guild`], 10) + `,` + strconv.FormatInt(cacheObjSubType[`guild`], 10) + `);`) logOnError(err, "addObjGuild : exec insert obj") if err != nil { err2 := tx.Rollback() @@ -546,7 +546,7 @@ func addObjUser(name string) (int64, error) { } res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) - VALUES (` + strconv.Itoa(cacheObjType[`user`]) + `,` + strconv.Itoa(cacheObjSubType[`user`]) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`user`], 10) + `,` + strconv.FormatInt(cacheObjSubType[`user`], 10) + `);`) logOnError(err, "addObjUser : exec insert obj") if err != nil { err2 := tx.Rollback() @@ -688,7 +688,7 @@ func addObjXP(userID64 int64, expNow int64, expLvl int64, level int64, date time return objId, nil } -func addObjQuest(userID64 int64, questTypeID int, duration time.Duration, date time.Time) (int64, error) { +func addObjQuest(userID64 int64, questTypeID64 int64, duration time.Duration, date time.Time) (int64, error) { tx, err := db.Begin() logOnError(err, "addObjQuest : start transaction") if err != nil { @@ -696,7 +696,7 @@ func addObjQuest(userID64 int64, questTypeID int, duration time.Duration, date t } res, err := tx.Exec(`INSERT INTO obj (obj_type_id, obj_sub_type_id) - VALUES (` + strconv.Itoa(cacheObjType[`quest`]) + `,` + strconv.Itoa(questTypeID) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`quest`], 10) + `,` + strconv.FormatInt(questTypeID64, 10) + `);`) logOnError(err, "addObjQuest : exec insert obj") if err != nil { err2 := tx.Rollback() @@ -764,7 +764,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.Itoa(cacheObjType[`item`]) + `,` + fmt.Sprintf("%d", itemTypeID64) + `);`) + VALUES (` + strconv.FormatInt(cacheObjType[`item`], 10) + `,` + fmt.Sprintf("%d", itemTypeID64) + `);`) logOnError(err, "addObjItem : exec insert obj") if err != nil { err2 := tx.Rollback()