This commit is contained in:
cdle 2021-08-17 13:36:11 +08:00
parent 537fbc0ef3
commit 59edf4a728
4 changed files with 461 additions and 8 deletions

View File

@ -164,23 +164,34 @@ var handleMessage = func(msgs ...interface{}) interface{} {
case "查询", "query":
cks := GetJdCookies()
find := false
pins := ""
for _, ck := range cks {
if tp == "qq" {
if ck.QQ == id {
find = true
SendQQ(int64(id), ck.Query())
// SendQQ(int64(id), ck.Query())
pins += ck.PtPin
}
} else if tp == "qqg" {
if ck.QQ == msgs[3].(int) {
find = true
SendQQGroup(int64(id), int64(msgs[3].(int)), ck.Query())
// SendQQGroup(int64(id), int64(msgs[3].(int)), ck.Query())
pins += ck.PtPin
}
}
}
if !find {
return "你尚未绑定🐶东账号,请对我说扫码,扫码后即可查询账户资产信息。"
}
for _, task := range Config.Tasks {
if task.Word == msg {
task.Envs = []Env{{
Name: "pins",
Value: pins,
}}
runTask(&task, msgs...)
}
}
return nil
default:
{ //tyt

View File

@ -42,7 +42,25 @@ func initHandle() {
if err != nil {
logs.Warn("创建jdCookie.js失败", err)
}
f.WriteString("module.exports =" + cookies)
f.WriteString(fmt.Sprintf(`
var cookies = %s
var pins = process.env.pins
if(pins){
pins = pins.split("&")
for (var key in cookies) {
c = false
for (var pin of pins) {
if (cookies[key].indexOf(pin) != -1) {
c = true
break
}
}
if (!c) {
delete cookies[key]
}
}
}
module.exports = cookies`, cookies))
f.Close()
if Config.Mode == Parallel {
for i := range Config.Containers {

View File

@ -23,6 +23,8 @@ type Task struct {
Name string
Timeout int
Envs []Env
Args string
Ykq bool
}
type Env struct {
@ -49,6 +51,7 @@ func createTask(task *Task) {
}
func runTask(task *Task, msgs ...interface{}) {
msg := ""
if task.Name == "" {
slice := strings.Split(task.Path, "/")
len := len(slice)
@ -95,7 +98,7 @@ func runTask(task *Task, msgs ...interface{}) {
return
}
cmd.Dir = ExecPath + "/scripts/"
// cmd.Stderr = os.Stderr
cmd.Stderr = os.Stderr
err = cmd.Start()
if err != nil {
logs.Warn("%v", err)
@ -107,9 +110,14 @@ func runTask(task *Task, msgs ...interface{}) {
if err2 != nil || io.EOF == err2 {
break
}
// if len(msgs) > 0 {
sendAdminMessagee(line, msgs...)
// }
if task.Ykq {
msg += line
} else {
sendAdminMessagee(line, msgs...)
}
}
if task.Ykq {
sendAdminMessagee(msg, msgs...)
}
err = cmd.Wait()
return

416
scripts/jd_all_bean_change.js Executable file

File diff suppressed because one or more lines are too long