新增删除指定账号 新增清理过期账号

This commit is contained in:
ZJY 2021-09-08 14:36:39 +08:00
parent 208928d028
commit 6f2375e604
2 changed files with 34 additions and 0 deletions

View File

@ -627,6 +627,31 @@ var codeSignals = []CodeSignal{
return nil
},
},
{
Command: []string{"删除", "clean"},
Admin: true,
Handle: func(sender *Sender) interface{} {
sender.handleJdCookies(func(ck *JdCookie) {
ck.Removes(ck)
sender.Reply(fmt.Sprintf("已删除账号%s", ck.Nickname))
})
return nil
},
},
{
Command: []string{"清理过期账号"},
Admin: true,
Handle: func(sender *Sender) interface{} {
sender.Reply(fmt.Sprintf("删除所有false账号请慎用"))
sender.handleJdCookies(func(ck *JdCookie) {
if ck.Available == False {
ck.Removes(ck)
sender.Reply(fmt.Sprintf("已清理账号%s", ck.Nickname))
}
})
return nil
},
},
{
Command: []string{"取消屏蔽", "unhack"},
Admin: true,

View File

@ -195,6 +195,15 @@ func (ck *JdCookie) Update(column string, value interface{}) {
}
}
func (ck *JdCookie) Removes(values interface{}) {
if ck.ID != 0 {
db.Model(ck).Delete(values)
}
if ck.PtPin != "" {
db.Model(ck).Where(PtPin+" = ?", ck.PtPin).Delete(values)
}
}
func (ck *JdCookie) InPool(pt_key string) error {
if ck.ID != 0 {
date := Date()