1
0
forked from lxh/go-wxhelper

🎨 优化写法

This commit is contained in:
李寻欢 2023-12-07 23:00:57 +08:00
parent ac9f68c80d
commit 8b7487b42b

View File

@ -6,7 +6,6 @@ import (
"go-wechat/entity"
"go-wechat/model"
"go-wechat/utils"
"log"
)
// handleNewUserJoin
@ -15,12 +14,8 @@ import (
func handleNewUserJoin(m model.Message) {
// 判断是否开启迎新
var count int64
err := client.MySQL.Model(&entity.Friend{}).
Where("enable_welcome IS TRUE").
Where("wxid = ?", m.FromUser).
Count(&count).Error
if err != nil {
log.Printf("查询是否开启迎新失败: %s", err.Error())
client.MySQL.Model(&entity.Friend{}).Where("enable_welcome IS TRUE").Where("wxid = ?", m.FromUser).Count(&count)
if count < 1 {
return
}
if count < 1 {