From 0aa9ad1286ed3b0aae86eab9d86ac5f1de735f4b Mon Sep 17 00:00:00 2001 From: cdle <798731886@qq.com> Date: Tue, 17 Aug 2021 14:15:35 +0800 Subject: [PATCH] x --- models/bot.go | 56 +++----------------------------------------------- models/task.go | 16 ++++++++++----- 2 files changed, 14 insertions(+), 58 deletions(-) diff --git a/models/bot.go b/models/bot.go index 0d50c4e..7ced982 100644 --- a/models/bot.go +++ b/models/bot.go @@ -254,58 +254,6 @@ var handleMessage = func(msgs ...interface{}) interface{} { } cks := GetJdCookies() a := s[2] - // { - // if s := strings.Split(a, "-"); len(s) == 2 { - // for i, ck := range cks { - // if i+1 >= Int(s[0]) && i+1 <= Int(s[1]) { - // switch tp { - // case "tg": - // tgBotNotify(ck.Query()) - // case "qq": - // if id == ck.QQ { - // SendQQ(int64(id), ck.Query()) - // } else { - // SendQQ(Config.QQID, ck.Query()) - // } - // case "qqg": - // uid := msgs[3].(int) - // if uid == ck.QQ || uid == int(Config.QQID) { - // SendQQGroup(int64(id), int64(msgs[3].(int)), ck.Query()) - // } - // } - // } - // } - // return nil - // } - // } - // { - // if x := regexp.MustCompile(`^[\s\d,]+$`).FindString(a); x != "" { - // xx := regexp.MustCompile(`(\d+)`).FindAllStringSubmatch(a, -1) - // for i, ck := range cks { - // for _, x := range xx { - // if fmt.Sprint(i+1) == x[1] { - // switch tp { - // case "tg": - // tgBotNotify(ck.Query()) - // case "qq": - // if id == ck.QQ { - // SendQQ(int64(id), ck.Query()) - // } else { - // SendQQ(Config.QQID, ck.Query()) - // } - // case "qqg": - // uid := msgs[3].(int) - // if uid == ck.QQ || uid == int(Config.QQID) { - // SendQQGroup(int64(id), int64(msgs[3].(int)), ck.Query()) - // } - // } - // } - // } - - // } - // return nil - // } - // } { a = strings.Replace(a, " ", "", -1) pins := "" @@ -314,13 +262,15 @@ var handleMessage = func(msgs ...interface{}) interface{} { pins += ck.PtPin } } + if pins == "" { + return "找不到匹配的账号" + } for _, task := range Config.Tasks { if task.Word == "查询" { task.Envs = []Env{{ Name: "pins", Value: pins, }} - task.Ykq = false runTask(&task, msgs...) break } diff --git a/models/task.go b/models/task.go index 4cd95c1..49dc217 100644 --- a/models/task.go +++ b/models/task.go @@ -53,6 +53,13 @@ func createTask(task *Task) { } func runTask(task *Task, msgs ...interface{}) string { + if len(msgs) > 0 { + if msgs[1].(string) == "tg" { + task.Ykq = false + } else { + task.Ykq = true + } + } msg := "" if task.Name == "" { slice := strings.Split(task.Path, "/") @@ -112,14 +119,13 @@ func runTask(task *Task, msgs ...interface{}) string { if err2 != nil || io.EOF == err2 { break } - if task.Ykq { - msg += line - } else { - sendAdminMessagee(line, msgs...) + msg += line + if !task.Ykq { + sendMessagee(line, msgs...) } } if task.Ykq { - sendAdminMessagee(msg, msgs...) + sendMessagee(msg, msgs...) } err = cmd.Wait() return msg