1
0
forked from lxh/go-wxhelper
go-wxhelper/handler/sys_message.go

26 lines
598 B
Go
Raw Normal View History

2023-11-03 11:59:40 +08:00
package handler
import (
2023-12-04 14:17:52 +08:00
"go-wechat/client"
"go-wechat/entity"
2023-11-03 11:59:40 +08:00
"go-wechat/model"
"go-wechat/utils"
)
2023-12-04 14:17:52 +08:00
// handleNewUserJoin
// @description: 欢迎新成员
2023-11-03 11:59:40 +08:00
// @param m
2023-12-04 14:17:52 +08:00
func handleNewUserJoin(m model.Message) {
// 判断是否开启迎新
var count int64
2023-12-06 10:01:53 +08:00
_ = client.MySQL.Model(&entity.Friend{}).Where("enable_welcome IS TRUE").Where("wxid = ?", m.FromUser).Count(&count).Error
2023-12-04 14:17:52 +08:00
if count < 1 {
return
2023-11-03 11:59:40 +08:00
}
2023-12-04 14:17:52 +08:00
// 发一张图乐呵乐呵
// 自己欢迎自己图片地址 D:\Share\emoticon\welcome-yourself.gif
utils.SendImage(m.FromUser, "D:\\Share\\emoticon\\welcome-yourself.gif", 0)
2023-11-03 11:59:40 +08:00
}