🎨 逻辑优化
This commit is contained in:
@@ -4,12 +4,18 @@ import (
|
||||
"go-wechat/client"
|
||||
"go-wechat/entity"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// SaveMessage
|
||||
// @description: 消息入库
|
||||
// @param msg
|
||||
func SaveMessage(msg entity.Message) {
|
||||
if flag, _ := strconv.ParseBool(os.Getenv("DONT_SAVE")); flag {
|
||||
return
|
||||
}
|
||||
|
||||
// 检查消息是否存在,存在就跳过
|
||||
var count int64
|
||||
err := client.MySQL.Model(&entity.Message{}).Where("msg_id = ?", msg.MsgId).Count(&count).Error
|
||||
|
||||
Reference in New Issue
Block a user