This commit is contained in:
cdle 2021-08-20 07:53:41 +08:00
parent 577aa4a672
commit 996d377a6a
2 changed files with 7 additions and 2 deletions

View File

@ -100,13 +100,15 @@ var handleMessage = func(msgs ...interface{}) interface{} {
if len(msgs) == 4 {
gid = msgs[3].(int)
}
go NewActiveUser(tp, uid, msgs...)
switch msg {
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

@ -60,11 +60,14 @@ func NewActiveUser(class string, uid int, msgs ...interface{}) {
"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...)
}