From 5d11cc7c8a572c81912982d4764dca26c0b9bcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Thu, 25 Jan 2024 16:33:45 +0800 Subject: [PATCH] :bug: Fix a bug. --- entity/friend.go | 23 +++++++++++------------ service/friend.go | 4 ++-- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/entity/friend.go b/entity/friend.go index 8012c27..4261784 100644 --- a/entity/friend.go +++ b/entity/friend.go @@ -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 { diff --git a/service/friend.go b/service/friend.go index f5e44a4..3ba8cc2 100644 --- a/service/friend.go +++ b/service/friend.go @@ -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) }