test
This commit is contained in:
parent
47461360b8
commit
25282a324e
19
def.go
19
def.go
@ -13,16 +13,21 @@ const (
|
||||
objTypeUser = 1
|
||||
objTypeGuild = 2
|
||||
objTypeMessage = 3
|
||||
objTypeWar = 4
|
||||
objTypeWarReport = 5
|
||||
|
||||
objSubTypeMessageUnprocess = 1
|
||||
objSubTypeMessageUnknown = 2
|
||||
objSubTypeMessageReport = 3
|
||||
objSubTypeMessageGReport = 4
|
||||
objSubTypeMessageQuest = 5
|
||||
objSubTypeMessageFight = 6
|
||||
objSubTypeMessageHero = 7
|
||||
objSubTypeMessageMe = 8
|
||||
objSubTypeMessageInventory = 9
|
||||
objSubTypeMessageWar = 3
|
||||
objSubTypeMessageMiniWar = 4
|
||||
objSubTypeMessageGuildWar = 5
|
||||
objSubTypeMessageReport = 6
|
||||
objSubTypeMessageGReport = 7
|
||||
objSubTypeMessageQuest = 8
|
||||
objSubTypeMessageFight = 9
|
||||
objSubTypeMessageHero = 10
|
||||
objSubTypeMessageMe = 11
|
||||
objSubTypeMessageInventory = 12
|
||||
|
||||
MQGetMsgWorkers = 3
|
||||
SQLCWMsgWorkers = 6
|
||||
|
33
sql.go
33
sql.go
@ -90,6 +90,14 @@ func initDB() {
|
||||
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`)
|
||||
failOnError(err, "initDB : create table obj_guild")
|
||||
|
||||
_, err = db.Exec(`CREATE TABLE obj_war (
|
||||
obj_id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT
|
||||
,start_time TIMESTAMP NOT NULL
|
||||
,end_time TIMESTAMP NOT NULL
|
||||
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
|
||||
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`)
|
||||
failOnError(err, "initDB : create table obj_war")
|
||||
|
||||
_, err = db.Exec(`CREATE TABLE obj_msg (
|
||||
obj_id BIGINT UNSIGNED NOT NULL
|
||||
,msg_id BIGINT NOT NULL
|
||||
@ -105,7 +113,16 @@ func initDB() {
|
||||
|
||||
_, err = db.Exec(`CREATE TABLE obj_msg_report (
|
||||
obj_id BIGINT UNSIGNED NOT NULL
|
||||
,war_date TIMESTAMP NOT NULL
|
||||
,war_id BIGINT UNSIGNED NOT NULL
|
||||
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
|
||||
,FOREIGN KEY (war_id) REFERENCES obj(id) ON DELETE CASCADE
|
||||
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`)
|
||||
failOnError(err, "initDB : create table obj_msg_report")
|
||||
|
||||
_, err = db.Exec(`CREATE TABLE obj_war_report (
|
||||
obj_id BIGINT UNSIGNED NOT NULL
|
||||
,user_id BIGINT UNSIGNED NOT NULL
|
||||
,war_id BIGINT UNSIGNED NOT NULL
|
||||
,attack SMALLINT UNSIGNED NOT NULL
|
||||
,defense SMALLINT UNSIGNED NOT NULL
|
||||
,gold SMALLINT UNSIGNED NOT NULL
|
||||
@ -114,20 +131,28 @@ func initDB() {
|
||||
,stamina TINYINT NOT NULL
|
||||
,crit TINYINT NOT NULL
|
||||
,FOREIGN KEY (obj_id) REFERENCES obj(id) ON DELETE CASCADE
|
||||
,FOREIGN KEY (war_id) REFERENCES obj(id) ON DELETE CASCADE
|
||||
,UNIQUE KEY (user_id, war_id)
|
||||
) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci;`)
|
||||
failOnError(err, "initDB : create table obj_msg_report")
|
||||
|
||||
_, err = db.Exec(`INSERT INTO code_obj_type (id, intl_id, name)
|
||||
VALUES (` + strconv.Itoa(objTypeUser) + `, "user", "User")
|
||||
,(` + strconv.Itoa(objTypeGuild) + `, "guild", "Guild")
|
||||
,(` + strconv.Itoa(objTypeMessage) + `, "msg", "Message");`)
|
||||
,(` + strconv.Itoa(objTypeMessage) + `, "msg", "Message")
|
||||
,(` + strconv.Itoa(objTypeWar) + `, "war", "War")
|
||||
,(` + strconv.Itoa(objTypeWarReport) + `, "war_report", "War Report")
|
||||
;`)
|
||||
failOnError(err, "initDB : populate table code_obj_type")
|
||||
|
||||
_, err = db.Exec(`INSERT INTO code_obj_sub_type (id, intl_id, name, obj_type_id)
|
||||
VALUES (` + strconv.Itoa(objSubTypeMessageUnprocess) + `, "unprocessed", "Unprocessed", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageUnknown) + `, "unknown", "Unknown", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageReport) + `, "report", "War report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGReport) + `, "g_report", "Guild War report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageWar) + `, "war", "War report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageMiniWar) + `, "mini_war", "Mini war reprot", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGuildWar) + `, "guild_war", "Guilds war report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageReport) + `, "report", "Player war report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageGReport) + `, "g_report", "Player guilds war report", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageQuest) + `, "quest", "Quest result", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageFight) + `, "fight", "Fight result", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
,(` + strconv.Itoa(objSubTypeMessageHero) + `, "hero", "Hero summary", ` + strconv.Itoa(objTypeMessage) + `)
|
||||
|
@ -92,6 +92,7 @@ func SQLIdentifyMsgWorker(id int, objIds <-chan int64) {
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Stock : %s (%d)\n", r.ReplaceAllString(m.Text, "${Stock}"), objId)
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Stamina : %s (%d)\n", r.ReplaceAllString(m.Text, "${Stamina}"), objId)
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Crit : %s (%d)\n", r.ReplaceAllString(m.Text, "${Crit}"), objId)
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Test : %s (%d)\n", r.ReplaceAllString(m.Text, "${Test}"), objId)
|
||||
} else {
|
||||
log.Printf("SQLIdentifyMsgWorker["+strconv.Itoa(id)+"] : Unknown message type (%d)\n", objId)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user