测试
This commit is contained in:
parent
9517a49997
commit
eda95c519f
@ -138,44 +138,45 @@ func initCookie() {
|
||||
func updateCookie() {
|
||||
cks := GetJdCookies()
|
||||
l := len(cks)
|
||||
for i := 0; i < l-1; i++ {
|
||||
if len(cks[i].WsKey) > 0 {
|
||||
rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, cks[i].WsKey), &Sender{})
|
||||
ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(rsp, -1)
|
||||
if len(ss) > 0 {
|
||||
|
||||
xyb := 0
|
||||
for _, s := range ss {
|
||||
ck := JdCookie{
|
||||
PtKey: s[1],
|
||||
PtPin: s[2],
|
||||
}
|
||||
if CookieOK(&ck) {
|
||||
xyb++
|
||||
if HasKey(ck.PtKey) {
|
||||
(&JdCookie{}).Push(fmt.Sprintf("重复提交"))
|
||||
} else {
|
||||
if nck, err := GetJdCookie(ck.PtPin); err == nil {
|
||||
nck.InPool(ck.PtKey)
|
||||
msg := fmt.Sprintf("定时更新账号,%s", ck.PtPin)
|
||||
(&JdCookie{}).Push(msg)
|
||||
logs.Info(msg)
|
||||
} else {
|
||||
NewJdCookie(&ck)
|
||||
msg := fmt.Sprintf("添加账号,账号名:%s", ck.PtPin)
|
||||
logs.Info(msg)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
(&JdCookie{}).Push(fmt.Sprintf("无效CK转换失败,%s", ck.PtPin))
|
||||
}
|
||||
}
|
||||
}
|
||||
go func() {
|
||||
Save <- &JdCookie{}
|
||||
}()
|
||||
}
|
||||
}
|
||||
logs.Info(l)
|
||||
//for i := 0; i < l-1; i++ {
|
||||
// if len(cks[i].WsKey) > 0 {
|
||||
// rsp := cmd(fmt.Sprintf(`python3 test.py "%s"`, cks[i].WsKey), &Sender{})
|
||||
// ss := regexp.MustCompile(`pt_key=([^;=\s]+);pt_pin=([^;=\s]+)`).FindAllStringSubmatch(rsp, -1)
|
||||
// if len(ss) > 0 {
|
||||
//
|
||||
// xyb := 0
|
||||
// for _, s := range ss {
|
||||
// ck := JdCookie{
|
||||
// PtKey: s[1],
|
||||
// PtPin: s[2],
|
||||
// }
|
||||
// if CookieOK(&ck) {
|
||||
// xyb++
|
||||
// if HasKey(ck.PtKey) {
|
||||
// (&JdCookie{}).Push(fmt.Sprintf("重复提交"))
|
||||
// } else {
|
||||
// if nck, err := GetJdCookie(ck.PtPin); err == nil {
|
||||
// nck.InPool(ck.PtKey)
|
||||
// msg := fmt.Sprintf("定时更新账号,%s", ck.PtPin)
|
||||
// (&JdCookie{}).Push(msg)
|
||||
// logs.Info(msg)
|
||||
// } else {
|
||||
// NewJdCookie(&ck)
|
||||
// msg := fmt.Sprintf("添加账号,账号名:%s", ck.PtPin)
|
||||
// logs.Info(msg)
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// (&JdCookie{}).Push(fmt.Sprintf("无效CK转换失败,%s", ck.PtPin))
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// go func() {
|
||||
// Save <- &JdCookie{}
|
||||
// }()
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
func CookieOK(ck *JdCookie) bool {
|
||||
|
||||
@ -190,6 +190,7 @@ var codeSignals = []CodeSignal{
|
||||
sender.Reply("更新所有账号")
|
||||
logs.Info("更新所有账号")
|
||||
updateCookie()
|
||||
|
||||
return nil
|
||||
},
|
||||
},
|
||||
@ -267,17 +268,17 @@ var codeSignals = []CodeSignal{
|
||||
},
|
||||
},
|
||||
{
|
||||
Command: []string{"我要钱","给点钱","我干","给我钱"},
|
||||
Command: []string{"我要钱", "给点钱", "我干", "给我钱"},
|
||||
Handle: func(sender *Sender) interface{} {
|
||||
cost := Int(sender.JoinContens())
|
||||
if !sender.IsAdmin{
|
||||
if cost>1{
|
||||
if !sender.IsAdmin {
|
||||
if cost > 1 {
|
||||
return "你只能获得1东币"
|
||||
}else{
|
||||
} else {
|
||||
AddCoin(sender.UserID)
|
||||
return "太可怜了,给你1东币"
|
||||
}
|
||||
}else{
|
||||
}
|
||||
} else {
|
||||
AddCoin(sender.UserID)
|
||||
sender.Reply(fmt.Sprintf("你获得1枚东币。"))
|
||||
}
|
||||
@ -285,18 +286,18 @@ var codeSignals = []CodeSignal{
|
||||
},
|
||||
},
|
||||
{
|
||||
Command: []string{"梭哈","拼了","梭了"},
|
||||
Command: []string{"梭哈", "拼了", "梭了"},
|
||||
Handle: func(sender *Sender) interface{} {
|
||||
u := &User{}
|
||||
cost := GetCoin(sender.UserID)
|
||||
|
||||
|
||||
if cost <= 0 || cost > 10000 {
|
||||
cost = 1
|
||||
}
|
||||
|
||||
|
||||
if err := db.Where("number = ?", sender.UserID).First(u).Error; err != nil || u.Coin < cost {
|
||||
return "东币不足,先去打卡吧。"
|
||||
}else{
|
||||
} else {
|
||||
sender.Reply(fmt.Sprintf("你使用%d枚东币。", cost))
|
||||
}
|
||||
baga := 0
|
||||
@ -635,7 +636,7 @@ var codeSignals = []CodeSignal{
|
||||
Handle: func(sender *Sender) interface{} {
|
||||
sender.handleJdCookies(func(ck *JdCookie) {
|
||||
ck.Update(Priority, -1)
|
||||
sender.Reply(fmt.Sprintf("已屏蔽账号%s(%s)", ck.PtPin, ck.Nickname,ck.Priority))
|
||||
sender.Reply(fmt.Sprintf("已屏蔽账号%s(%s)", ck.PtPin, ck.Nickname, ck.Priority))
|
||||
})
|
||||
return nil
|
||||
},
|
||||
@ -646,7 +647,7 @@ var codeSignals = []CodeSignal{
|
||||
Handle: func(sender *Sender) interface{} {
|
||||
sender.handleJdCookies(func(ck *JdCookie) {
|
||||
ck.Update(Priority, 2)
|
||||
sender.Reply(fmt.Sprintf("已取消屏蔽账号%s(%s)", ck.PtPin, ck.Nickname,ck.Priority))
|
||||
sender.Reply(fmt.Sprintf("已取消屏蔽账号%s(%s)", ck.PtPin, ck.Nickname, ck.Priority))
|
||||
})
|
||||
return nil
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user