1
0
Fork 0

🐛 Fix a bug.

This commit is contained in:
李寻欢 2024-01-25 16:33:45 +08:00
parent 61e03a6a7b
commit 5d11cc7c8a
2 changed files with 13 additions and 14 deletions

View File

@ -1,24 +1,23 @@
package entity
import (
"go-wechat/common/types"
"time"
)
// Friend
// @description: 好友列表
type Friend struct {
Wxid string `json:"wxid"` // 微信原始Id
CustomAccount string `json:"customAccount"` // 微信号
Nickname string `json:"nickname"` // 昵称
Pinyin string `json:"pinyin"` // 昵称拼音大写首字母
PinyinAll string `json:"pinyinAll"` // 昵称全拼
LastActive types.DateTime `json:"lastActive"` // 最后活跃时间
EnableAi bool `json:"enableAI" gorm:"type:tinyint(1) default 0 not null"` // 是否使用AI
AiModel string `json:"aiModel"` // AI模型
EnableChatRank bool `json:"enableChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否使用聊天排行
EnableWelcome bool `json:"enableWelcome" gorm:"type:tinyint(1) default 0 not null"` // 是否启用迎新
IsOk bool `json:"isOk" gorm:"type:tinyint(1) default 0 not null"` // 是否正常
Wxid string `json:"wxid"` // 微信原始Id
CustomAccount string `json:"customAccount"` // 微信号
Nickname string `json:"nickname"` // 昵称
Pinyin string `json:"pinyin"` // 昵称拼音大写首字母
PinyinAll string `json:"pinyinAll"` // 昵称全拼
LastActive time.Time `json:"lastActive"` // 最后活跃时间
EnableAi bool `json:"enableAI" gorm:"type:tinyint(1) default 0 not null"` // 是否使用AI
AiModel string `json:"aiModel"` // AI模型
EnableChatRank bool `json:"enableChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否使用聊天排行
EnableWelcome bool `json:"enableWelcome" gorm:"type:tinyint(1) default 0 not null"` // 是否启用迎新
IsOk bool `json:"isOk" gorm:"type:tinyint(1) default 0 not null"` // 是否正常
}
func (Friend) TableName() string {

View File

@ -73,7 +73,7 @@ func updateLastActive(msg entity.Message) {
err = client.MySQL.Model(&entity.GroupUser{}).
Where("group_id = ?", msg.FromUser).
Where("wxid = ?", msg.GroupUser).
Update("last_active", msg.CreateTime).Error
Update("last_active", msg.CreateAt).Error
if err != nil {
log.Printf("更新群成员最后活跃时间失败, 错误信息: %v", err)
}
@ -81,7 +81,7 @@ func updateLastActive(msg entity.Message) {
// 更新群或者好友活跃时间
err = client.MySQL.Model(&entity.Friend{}).
Where("wxid = ?", msg.FromUser).
Update("last_active", msg.CreateTime).Error
Update("last_active", msg.CreateAt).Error
if err != nil {
log.Printf("更新群或者好友活跃时间失败, 错误信息: %v", err)
}