From 0ef91c73618f90ff3a94fd385c698c4ab0ac9fba Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 11 May 2019 13:11:47 +0800 Subject: [PATCH] test --- bot.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bot.go b/bot.go index 10a22ae..2bce7af 100644 --- a/bot.go +++ b/bot.go @@ -69,6 +69,10 @@ func botText(m *tb.Message) { } func botMsgRescan(m *tb.Message) (string, error) { + var ( + p JobPayloadRescanMsg + q string + ) fmt.Println("botRescanMsg :", m.Text) if !m.Private() { fmt.Println("botRescanMsg : !m.Private()") @@ -76,8 +80,8 @@ func botMsgRescan(m *tb.Message) (string, error) { } r := regexp.MustCompile("^[0-9]+$") if r.MatchString(m.Payload) { - var p JobPayloadRescanMsg - fmt.Sprintf(p.Query, "SELECT o.id from obj o where o.id = %s and o.obj_type_id = %d and o.obj_sub_type_id = %d;", m.Payload, objTypeMessage, objSubTypeMessageUnknown) + fmt.Sprintf(s, "SELECT o.id from obj o where o.id = %s and o.obj_type_id = %d and o.obj_sub_type_id = %d;", m.Payload, objTypeMessage, objSubTypeMessageUnknown) + p.Query = s b, _ := json.Marshal(p) log.Printf("botMsgRescan : %s\n", string(b)) err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanMsg, time.Now(), b) @@ -91,8 +95,8 @@ func botMsgRescan(m *tb.Message) (string, error) { } r = regexp.MustCompile("^all$") if r.MatchString(m.Payload) { - var p JobPayloadRescanMsg - fmt.Sprintf(p.Query, "SELECT o.id from obj o where o.obj_type_id = %d and o.obj_sub_type_id = %d;", objTypeMessage, objSubTypeMessageUnknown) + fmt.Sprintf(s, "SELECT o.id from obj o where o.obj_type_id = %d and o.obj_sub_type_id = %d;", objTypeMessage, objSubTypeMessageUnknown) + p.Query = s b, _ := json.Marshal(p) log.Printf("botMsgRescan : %s\n", string(b)) err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanAllMsg, time.Now(), b)