今日签到 增加积分 记录积分功能
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"fmt"
|
||||
"github.com/eatmoreapple/openwechat"
|
||||
"github.com/robfig/cron/v3"
|
||||
"go-bot/bot/database"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -52,6 +54,11 @@ func SignIn(msg *openwechat.Message, self *openwechat.Self) {
|
||||
sender, err := msg.SenderInGroup()
|
||||
nickName := sender.NickName
|
||||
|
||||
//查询数据库是否有此人 或此人就获得积分
|
||||
integration := database.SelectUserIntegrationByNickName(nickName)
|
||||
fmt.Println(integration)
|
||||
integration = database.UpDataUserIntegrationByNickName(nickName, integration)
|
||||
|
||||
// 获取群聊组
|
||||
groups, err := self.Groups()
|
||||
name := groups.GetByNickName("叫啥好呢")
|
||||
@@ -59,6 +66,5 @@ func SignIn(msg *openwechat.Message, self *openwechat.Self) {
|
||||
|
||||
// 当前时间
|
||||
timeStr := time.Now().Format("2006-01-02 15:04:05")
|
||||
self.SendTextToGroup(name, nickName+":今日打卡成功!\n"+
|
||||
"时间:"+timeStr)
|
||||
self.SendTextToGroup(name, nickName+":今日打卡成功!\n"+"积分:"+strconv.Itoa(integration)+"\n时间:"+timeStr)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user