This commit is contained in:
shoopea 2019-05-06 11:59:19 +08:00
parent 00209a69ad
commit 3cc96d8bce
2 changed files with 20 additions and 3 deletions

17
def.go
View File

@ -1,9 +1,26 @@
package main package main
type ChatWarsMessage struct { type ChatWarsMessage struct {
UserID64 int64 `json:"user_id"`
SenderUserID64 int64 `json:"sender_user_id"` SenderUserID64 int64 `json:"sender_user_id"`
Date int32 `json:"date"` Date int32 `json:"date"`
ID64 int64 `json:"id"` ID64 int64 `json:"id"`
ChatID64 int64 `json:"chat_id"` ChatID64 int64 `json:"chat_id"`
Text string `json:"text"` Text string `json:"text"`
} }
const (
objTypeUser = 1
objTypeGuild = 2
objTypeMessage = 3
objSubTypeMessageUnprocess = 1
objSubTypeMessageUnknown = 2
objSubTypeMessageReport = 3
objSubTypeMessageGReport = 4
objSubTypeMessageQuest = 5
objSubTypeMessageFight = 6
objSubTypeMessageHero = 7
objSubTypeMessageMe = 8
objSubTypeMessageInventory = 9
)

6
sql.go
View File

@ -115,9 +115,9 @@ func initDB() {
failOnError(err, "initDB : create table obj_msg_report") failOnError(err, "initDB : create table obj_msg_report")
_, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name) _, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name)
VALUES (1, "user", "User") VALUES (` + objTypeUser + `, "user", "User")
,(2, "guild", "Guild") ,(` + objTypeGuild + `, "guild", "Guild")
,(3, "msg", "Message");`) ,(` + objTypeMessage + `, "msg", "Message");`)
failOnError(err, "initDB : populate table code_obj_type") failOnError(err, "initDB : populate table code_obj_type")
_, err = db.Exec(`INSERT INTO code_obj_sub_type (id, intl_id, name, obj_type_id) _, err = db.Exec(`INSERT INTO code_obj_sub_type (id, intl_id, name, obj_type_id)