test
This commit is contained in:
parent
01d5ce3f2b
commit
f6f5f6108c
57
sql.go
57
sql.go
|
@ -199,35 +199,36 @@ func getObjSubTypeId(objId int64) (int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func insertMsgReport(objId int64, war_date int32, atk int32, def int32, exp int32, gold int32, stock int32, crit bool, stamina bool) error {
|
func insertMsgReport(objId int64, war_date int32, atk int32, def int32, exp int32, gold int32, stock int32, crit bool, stamina bool) error {
|
||||||
objSubTypeId, err := getObjSubTypeId(objId)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if objSubTypeId != objSubTypeMessageUnprocess {
|
|
||||||
return errors.New("Message is not of type Unknown")
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
obj_id BIGINT UNSIGNED NOT NULL
|
objSubTypeId, err := getObjSubTypeId(objId)
|
||||||
,war_date TIMESTAMP NOT NULL
|
if err != nil {
|
||||||
,attack SMALLINT UNSIGNED NOT NULL
|
return err
|
||||||
,defense SMALLINT UNSIGNED NOT NULL
|
}
|
||||||
,gold SMALLINT UNSIGNED NOT NULL
|
if objSubTypeId != objSubTypeMessageUnprocess {
|
||||||
,stock MALLINT UNSIGNED NOT NULL
|
return errors.New("Message is not of type Unknown")
|
||||||
,exp SMALLINT UNSIGNED NOT NULL
|
}
|
||||||
,stamina TINYINT NOT NULL
|
|
||||||
,crit TINYINT NOT NULL
|
obj_id BIGINT UNSIGNED NOT NULL
|
||||||
|
,war_date TIMESTAMP NOT NULL
|
||||||
|
,attack SMALLINT UNSIGNED NOT NULL
|
||||||
|
,defense SMALLINT UNSIGNED NOT NULL
|
||||||
|
,gold SMALLINT UNSIGNED NOT NULL
|
||||||
|
,stock MALLINT UNSIGNED NOT NULL
|
||||||
|
,exp SMALLINT UNSIGNED NOT NULL
|
||||||
|
,stamina TINYINT NOT NULL
|
||||||
|
,crit TINYINT NOT NULL
|
||||||
|
|
||||||
|
stmt, err := db.Prepare(`INSERT INTO obj_msg_report (obj_id, war_date, attack, defense, gold, stock, exp, stamina, crit)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?FROM_UNIXTIME(?), ?);`)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer stmt.Close()
|
||||||
|
|
||||||
|
_, err = stmt.Exec(objId, m.ID64, m.ChatID64, m.UserID64, m.SenderUserID64, m.Date, m.Text)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
*/
|
*/
|
||||||
stmt, err := db.Prepare(`INSERT INTO obj_msg_report (obj_id, war_date, attack, defense, gold, stock, exp, stamina, crit)
|
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?FROM_UNIXTIME(?), ?);`)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
defer stmt.Close()
|
|
||||||
|
|
||||||
_, err = stmt.Exec(objId, m.ID64, m.ChatID64, m.UserID64, m.SenderUserID64, m.Date, m.Text)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user