From d46f9d91d6750a3569d814ca23809c9ab828e488 Mon Sep 17 00:00:00 2001 From: shoopea Date: Sat, 11 May 2019 13:14:59 +0800 Subject: [PATCH] test --- bot.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bot.go b/bot.go index 72b319a..890fccb 100644 --- a/bot.go +++ b/bot.go @@ -69,10 +69,7 @@ func botText(m *tb.Message) { } func botMsgRescan(m *tb.Message) (string, error) { - var ( - p JobPayloadRescanMsg - q string - ) + var q string fmt.Println("botRescanMsg :", m.Text) if !m.Private() { fmt.Println("botRescanMsg : !m.Private()") @@ -81,9 +78,12 @@ func botMsgRescan(m *tb.Message) (string, error) { r := regexp.MustCompile("^[0-9]+$") if r.MatchString(m.Payload) { fmt.Sprintf(q, "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 = q + p := JobPayloadRescanMsg{ + Query: q, + } b, _ := json.Marshal(p) - log.Printf("botMsgRescan : %s\n", string(b)) + log.Printf("botMsgRescan : query : %s\n", q) + log.Printf("botMsgRescan : json : %s\n", string(b)) err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanMsg, time.Now(), b) logOnError(err, "botMsgRescan : createJob(objSubTypeJobRescanMsg)") if err != nil { @@ -96,9 +96,12 @@ func botMsgRescan(m *tb.Message) (string, error) { r = regexp.MustCompile("^all$") if r.MatchString(m.Payload) { fmt.Sprintf(q, "SELECT o.id from obj o where o.obj_type_id = %d and o.obj_sub_type_id = %d;", objTypeMessage, objSubTypeMessageUnknown) - p.Query = q + p := JobPayloadRescanMsg{ + Query: q, + } b, _ := json.Marshal(p) - log.Printf("botMsgRescan : %s\n", string(b)) + log.Printf("botMsgRescan : query : %s\n", q) + log.Printf("botMsgRescan : json : %s\n", string(b)) err := createJob(objSubTypeJobRescanMsg, objJobPriorityRescanAllMsg, time.Now(), b) logOnError(err, "botMsgRescan : createJob(objSubTypeJobRescanMsg)") if err != nil {