Merge branch 'cdle:main' into main

This commit is contained in:
a251231 2021-08-20 09:30:43 +08:00 committed by GitHub
commit f33b6ed0ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 4 deletions

View File

@ -161,6 +161,7 @@ func CookieOK(ck *JdCookie) bool {
if ui.Msg == "not login" {
if ck.Available == True {
ck.Push(fmt.Sprintf("失效账号,%s", ck.PtPin))
JdCookie{}.Push(fmt.Sprintf("失效账号,%s", ck.Nickname))
}
return false
}

View File

@ -100,13 +100,20 @@ var handleMessage = func(msgs ...interface{}) interface{} {
if len(msgs) == 4 {
gid = msgs[3].(int)
}
go NewActiveUser(tp, uid, msgs...)
switch msg {
case "取消屏蔽":
if !isAdmin(msgs...) {
return "你没有权限操作"
}
return fmt.Sprintf("操作成功,更新%d条记录", db.Model(JdCookie{}).Update(Hack, False).RowsAffected)
case "status", "状态":
if !isAdmin(msgs...) {
return "你没有权限操作"
}
return Count()
case "打卡", "签到", "sign":
NewActiveUser(tp, uid, msgs...)
case "许愿币":
return fmt.Sprintf("余额%d", GetCoin(uid))
case "qrcode", "扫码", "二维码", "scan":

View File

@ -55,16 +55,19 @@ func NewActiveUser(class string, uid int, msgs ...interface{}) {
} else {
if zero.Unix() > u.ActiveAt.Unix() {
first = true
db.Updates(map[string]interface{}{
db.Model(&u).Updates(map[string]interface{}{
"active_at": ntime,
"coin": gorm.Expr("coin+1"),
})
u.Coin++
} else {
msg += fmt.Sprintf("你打过卡了,许愿币余额%d。", u.Coin)
sendMessagee(msg, msgs...)
}
}
if first {
db.Model(User{}).Select("count(id) as total").Where("active_at > ?", zero).Pluck("total", &total)
msg += fmt.Sprintf("你是今天第%d个发言的用户,奖励%d个许愿币许愿币余额%d。", total[0]+1, 1, u.Coin)
msg += fmt.Sprintf("你是打卡第%d人,奖励%d个许愿币许愿币余额%d。", total[0]+1, 1, u.Coin)
// fmt.Println(msg)
sendMessagee(msg, msgs...)
}

View File

@ -11,7 +11,7 @@ import (
"github.com/beego/beego/v2/core/logs"
)
var version = "2021081905"
var version = "2021082005"
var AppName = "xdd"
var pname = regexp.MustCompile(`/([^/\s]+)`).FindStringSubmatch(os.Args[0])[1]