This commit is contained in:
shoopea 2020-02-03 14:53:51 +08:00
parent 39c575676f
commit 491c9a8029

5
sql.go
View File

@ -641,7 +641,6 @@ func insertMsgDuelFight(m *ChatWarsMessageDuelFight) error {
}
func insertMsgTributesStats(m *ChatWarsMessageTributesStatsAck) error {
log.Printf("insertMsgTributesStats : starting\n")
objSubTypeId, err := getObjSubTypeId(m.Msg.ObjID64)
if err != nil {
return err
@ -650,7 +649,6 @@ func insertMsgTributesStats(m *ChatWarsMessageTributesStatsAck) error {
return errors.New("Message type mismatch")
}
log.Printf("insertMsgTributesStats : preppring stmt\n")
stmt, err := db.Prepare(`INSERT INTO obj_tribute (tg_user_id, item_id, quantity, exp, date)
VALUES (?, ?, ?, ?, ?);`)
logOnError(err, "insertMsgTributesStats : Prepare")
@ -660,13 +658,10 @@ func insertMsgTributesStats(m *ChatWarsMessageTributesStatsAck) error {
defer stmt.Close()
for _, t := range m.Tributes {
log.Printf("insertMsgTributesStats : #%d / #%d : %d + %d (%v)\n", m.Msg.TGUserID64, t.ItemID64, t.Quantity, t.Exp, t.Date)
_, err = stmt.Exec(m.Msg.TGUserID64, t.ItemID64, t.Quantity, t.Exp, t.Date)
logOnError(err, "insertMsgTributesStats Exec")
}
log.Printf("insertMsgTributesStats : returning\n")
return nil
}