This commit is contained in:
parent
2af0719f51
commit
454b5f0980
@ -1,15 +1,17 @@
|
||||
package entity
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"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"` // 昵称全拼
|
||||
Wxid string `json:"wxid"` // 微信原始Id
|
||||
EnableAi bool `json:"enableAI" gorm:"type:tinyint(1) default 0 not null"` // 是否使用AI
|
||||
EnableChatRank bool `json:"enableChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否使用聊天排行
|
||||
IsOk bool `json:"isOk" gorm:"type:tinyint(1) default 0 not null"` // 是否正常
|
||||
@ -23,11 +25,12 @@ func (Friend) TableName() string {
|
||||
// @description: 群成员
|
||||
type GroupUser struct {
|
||||
GroupId string `json:"groupId"` // 群Id
|
||||
Wxid string `json:"wxid"` // 微信Id
|
||||
Account string `json:"account"` // 账号
|
||||
HeadImage string `json:"headImage"` // 头像
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
Wxid string `json:"wxid"` // 微信Id
|
||||
IsMember bool `json:"isMember" gorm:"type:tinyint(1) default 0 not null"` // 是否群成员
|
||||
JoinTime time.Time `json:"joinTime"` // 加入时间
|
||||
LeaveTime *time.Time `json:"leaveTime"` // 离开时间
|
||||
SkipChatRank bool `json:"skipChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否跳过聊天排行
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ func GetGroupUsersByGroupId(groupId string) (records []vo.GroupUserItem, err err
|
||||
Select("tgu.*", "MAX(tm.create_at) AS last_active_time").
|
||||
Where("tgu.group_id = ?", groupId).
|
||||
Group("tgu.group_id, tgu.wxid").
|
||||
Order("tgu.wxid ASC").
|
||||
Order("tgu.join_time DESC").
|
||||
Find(&records).Error
|
||||
return
|
||||
}
|
||||
|
@ -154,6 +154,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
|
||||
Nickname: cp.Nickname,
|
||||
Wxid: cp.Wxid,
|
||||
IsMember: true,
|
||||
JoinTime: time.Now().Local(),
|
||||
}).Error
|
||||
if err != nil {
|
||||
log.Printf("新增群成员失败: %s", err.Error())
|
||||
|
@ -165,6 +165,7 @@
|
||||
<th>微信Id</th>
|
||||
<th>昵称</th>
|
||||
<th>是否群成员</th>
|
||||
<th>加群时间</th>
|
||||
<th>最后活跃时间</th>
|
||||
<th>退群时间</th>
|
||||
<th>是否跳过水群排行榜</th>
|
||||
|
@ -83,42 +83,39 @@ function getGroupUsers(groupId, groupName) {
|
||||
for (let i = 0; i < groupUsers.length; i++) {
|
||||
const groupUser = groupUsers[i]
|
||||
|
||||
var row = tbody.insertRow(i); // 插入新行
|
||||
let row = tbody.insertRow(i); // 插入新行
|
||||
|
||||
// 微信Id
|
||||
var wxId = row.insertCell(0);
|
||||
let wxId = row.insertCell(0);
|
||||
wxId.innerHTML = groupUser.wxid;
|
||||
|
||||
// 昵称
|
||||
var nickname = row.insertCell(1);
|
||||
let nickname = row.insertCell(1);
|
||||
nickname.innerHTML = groupUser.nickname;
|
||||
|
||||
// 是否群成员
|
||||
var isMember = row.insertCell(2);
|
||||
let isMember = row.insertCell(2);
|
||||
if (groupUser.isMember) {
|
||||
isMember.innerHTML = '<div class="badge badge-info gap-2">是</div>';
|
||||
} else {
|
||||
isMember.innerHTML = '<div class="badge badge-error gap-2">否</div>';
|
||||
}
|
||||
|
||||
// 加群时间
|
||||
let joinTime = row.insertCell(3);
|
||||
joinTime.innerHTML = groupUser.joinTime;
|
||||
|
||||
// 最后活跃时间
|
||||
var lastActiveTime = row.insertCell(3);
|
||||
let lastActiveTime = row.insertCell(4);
|
||||
lastActiveTime.innerHTML = groupUser.lastActiveTime;
|
||||
|
||||
// 退群时间
|
||||
var leaveTime = row.insertCell(4);
|
||||
let leaveTime = row.insertCell(5);
|
||||
leaveTime.innerHTML = groupUser.leaveTime;
|
||||
|
||||
// 是否跳过水群排行榜
|
||||
var skipChatRank = row.insertCell(5);
|
||||
let skipChatRankHtml = `<input type="checkbox" class="toggle toggle-error" ${groupUser.skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus(\'${groupId}\', \'${groupUser.wxid}\')" />`
|
||||
skipChatRank.innerHTML = skipChatRankHtml;
|
||||
|
||||
// if (groupUser.skipChatRank) {
|
||||
//
|
||||
// } else {
|
||||
// skipChatRank.innerHTML = '<input type="checkbox" class="toggle toggle-error" />';
|
||||
// }
|
||||
let skipChatRank = row.insertCell(6);
|
||||
skipChatRank.innerHTML = `<input type="checkbox" class="toggle toggle-error" ${groupUser.skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus(\'${groupId}\', \'${groupUser.wxid}\')" />`;
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.log(`错误信息: ${error}`);
|
||||
|
@ -26,6 +26,7 @@ type GroupUserItem struct {
|
||||
HeadImage string `json:"headImage"` // 头像
|
||||
Nickname string `json:"nickname"` // 昵称
|
||||
IsMember bool `json:"isMember" ` // 是否群成员
|
||||
JoinTime types.DateTime `json:"joinTime"` // 加入时间
|
||||
LastActiveTime types.DateTime `json:"lastActiveTime"` // 最后活跃时间
|
||||
LeaveTime types.DateTime `json:"leaveTime"` // 离开时间
|
||||
SkipChatRank bool `json:"skipChatRank" ` // 是否跳过聊天排行
|
||||
|
Loading…
Reference in New Issue
Block a user