diff --git a/entity/friend.go b/entity/friend.go
index 8f8ebd9e..626dbe45 100644
--- a/entity/friend.go
+++ b/entity/friend.go
@@ -31,6 +31,7 @@ type GroupUser struct {
HeadImage string `json:"headImage"` // 头像
Nickname string `json:"nickname"` // 昵称
IsMember bool `json:"isMember" gorm:"type:tinyint(1) default 0 not null"` // 是否群成员
+ IsAdmin bool `json:"isAdmin" 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"` // 是否跳过聊天排行
diff --git a/tasks/friends/friends.go b/tasks/friends/friends.go
index 81940df5..238a7370 100644
--- a/tasks/friends/friends.go
+++ b/tasks/friends/friends.go
@@ -155,6 +155,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
Nickname: cp.Nickname,
Wxid: cp.Wxid,
IsMember: true,
+ IsAdmin: wxid == baseResp.Data.Admin,
JoinTime: time.Now().Local(),
}).Error
if err != nil {
@@ -168,6 +169,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
"head_image": cp.HeadImage,
"nickname": cp.Nickname,
"is_member": true,
+ "is_admin": wxid == baseResp.Data.Admin,
"leave_time": nil,
}
err = tx.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Where("wxid = ?", wxid).Updates(pm).Error
diff --git a/views/index.html b/views/index.html
index b860fbb4..1339217c 100644
--- a/views/index.html
+++ b/views/index.html
@@ -100,7 +100,7 @@
是否启用AI |
是否启用水群排行榜 |
是否启用迎新 |
- 是否启用l指令 |
+ 是否启用指令 |
操作 |
@@ -201,6 +201,7 @@
微信Id |
昵称 |
是否群成员 |
+ 是否群主 |
加群时间 |
最后活跃时间 |
退群时间 |
diff --git a/views/static/js/index.js b/views/static/js/index.js
index 804cb08c..c01a214f 100644
--- a/views/static/js/index.js
+++ b/views/static/js/index.js
@@ -112,43 +112,20 @@ function getGroupUsers(groupId, groupName) {
// 渲染群成员列表
const groupUsers = response.data
// 循环渲染数据
- for (let i = 0; i < groupUsers.length; i++) {
- const groupUser = groupUsers[i]
+ groupUsers.forEach((groupUser, i) => {
+ const { wxid, nickname, isMember, isAdmin, joinTime, lastActiveTime, leaveTime, skipChatRank } = groupUser;
- let row = tbody.insertRow(i); // 插入新行
-
- // 微信Id
- let wxId = row.insertCell(0);
- wxId.innerHTML = groupUser.wxid;
-
- // 昵称
- let nickname = row.insertCell(1);
- nickname.innerHTML = groupUser.nickname;
-
- // 是否群成员
- let isMember = row.insertCell(2);
- if (groupUser.isMember) {
- isMember.innerHTML = '是
';
- } else {
- isMember.innerHTML = '否
';
- }
-
- // 加群时间
- let joinTime = row.insertCell(3);
- joinTime.innerHTML = groupUser.joinTime;
-
- // 最后活跃时间
- let lastActiveTime = row.insertCell(4);
- lastActiveTime.innerHTML = groupUser.lastActiveTime;
-
- // 退群时间
- let leaveTime = row.insertCell(5);
- leaveTime.innerHTML = groupUser.leaveTime;
-
- // 是否跳过水群排行榜
- let skipChatRank = row.insertCell(6);
- skipChatRank.innerHTML = ``;
- }
+ let row = tbody.insertRow(i);
+ // Insert data into cells
+ row.insertCell(0).innerHTML = wxid;
+ row.insertCell(1).innerHTML = nickname;
+ row.insertCell(2).innerHTML = `${isMember ? '是' : '否'}
`;
+ row.insertCell(3).innerHTML = `${isAdmin ? '是' : '否'}
`;
+ row.insertCell(4).innerHTML = joinTime;
+ row.insertCell(5).innerHTML = lastActiveTime;
+ row.insertCell(6).innerHTML = leaveTime;
+ row.insertCell(7).innerHTML = ``;
+ });
}).catch(function (error) {
console.log(`错误信息: ${error}`);
}).finally(function () {
diff --git a/vo/friend.go b/vo/friend.go
index b9165655..f8704d2e 100644
--- a/vo/friend.go
+++ b/vo/friend.go
@@ -28,6 +28,7 @@ type GroupUserItem struct {
HeadImage string `json:"headImage"` // 头像
Nickname string `json:"nickname"` // 昵称
IsMember bool `json:"isMember" ` // 是否群成员
+ IsAdmin bool `json:"isAdmin"` // 是否群主
JoinTime types.DateTime `json:"joinTime"` // 加入时间
LastActiveTime types.DateTime `json:"lastActiveTime"` // 最后活跃时间
LeaveTime types.DateTime `json:"leaveTime"` // 离开时间