🆕 群成员新增是否群主
This commit is contained in:
parent
01051ff606
commit
6a879cbef6
@ -31,6 +31,7 @@ type GroupUser struct {
|
|||||||
HeadImage string `json:"headImage"` // 头像
|
HeadImage string `json:"headImage"` // 头像
|
||||||
Nickname string `json:"nickname"` // 昵称
|
Nickname string `json:"nickname"` // 昵称
|
||||||
IsMember bool `json:"isMember" gorm:"type:tinyint(1) default 0 not null"` // 是否群成员
|
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"` // 加入时间
|
JoinTime time.Time `json:"joinTime"` // 加入时间
|
||||||
LeaveTime *time.Time `json:"leaveTime"` // 离开时间
|
LeaveTime *time.Time `json:"leaveTime"` // 离开时间
|
||||||
SkipChatRank bool `json:"skipChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否跳过聊天排行
|
SkipChatRank bool `json:"skipChatRank" gorm:"type:tinyint(1) default 0 not null"` // 是否跳过聊天排行
|
||||||
|
@ -155,6 +155,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
|
|||||||
Nickname: cp.Nickname,
|
Nickname: cp.Nickname,
|
||||||
Wxid: cp.Wxid,
|
Wxid: cp.Wxid,
|
||||||
IsMember: true,
|
IsMember: true,
|
||||||
|
IsAdmin: wxid == baseResp.Data.Admin,
|
||||||
JoinTime: time.Now().Local(),
|
JoinTime: time.Now().Local(),
|
||||||
}).Error
|
}).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -168,6 +169,7 @@ func syncGroupUsers(tx *gorm.DB, gid string) {
|
|||||||
"head_image": cp.HeadImage,
|
"head_image": cp.HeadImage,
|
||||||
"nickname": cp.Nickname,
|
"nickname": cp.Nickname,
|
||||||
"is_member": true,
|
"is_member": true,
|
||||||
|
"is_admin": wxid == baseResp.Data.Admin,
|
||||||
"leave_time": nil,
|
"leave_time": nil,
|
||||||
}
|
}
|
||||||
err = tx.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Where("wxid = ?", wxid).Updates(pm).Error
|
err = tx.Model(&entity.GroupUser{}).Where("group_id = ?", gid).Where("wxid = ?", wxid).Updates(pm).Error
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
<th>是否启用AI</th>
|
<th>是否启用AI</th>
|
||||||
<th>是否启用水群排行榜</th>
|
<th>是否启用水群排行榜</th>
|
||||||
<th>是否启用迎新</th>
|
<th>是否启用迎新</th>
|
||||||
<th>是否启用l指令</th>
|
<th>是否启用指令</th>
|
||||||
<th>操作</th>
|
<th>操作</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -201,6 +201,7 @@
|
|||||||
<th>微信Id</th>
|
<th>微信Id</th>
|
||||||
<th>昵称</th>
|
<th>昵称</th>
|
||||||
<th>是否群成员</th>
|
<th>是否群成员</th>
|
||||||
|
<th>是否群主</th>
|
||||||
<th>加群时间</th>
|
<th>加群时间</th>
|
||||||
<th>最后活跃时间</th>
|
<th>最后活跃时间</th>
|
||||||
<th>退群时间</th>
|
<th>退群时间</th>
|
||||||
|
@ -112,43 +112,20 @@ function getGroupUsers(groupId, groupName) {
|
|||||||
// 渲染群成员列表
|
// 渲染群成员列表
|
||||||
const groupUsers = response.data
|
const groupUsers = response.data
|
||||||
// 循环渲染数据
|
// 循环渲染数据
|
||||||
for (let i = 0; i < groupUsers.length; i++) {
|
groupUsers.forEach((groupUser, i) => {
|
||||||
const groupUser = groupUsers[i]
|
const { wxid, nickname, isMember, isAdmin, joinTime, lastActiveTime, leaveTime, skipChatRank } = groupUser;
|
||||||
|
|
||||||
let row = tbody.insertRow(i); // 插入新行
|
let row = tbody.insertRow(i);
|
||||||
|
// Insert data into cells
|
||||||
// 微信Id
|
row.insertCell(0).innerHTML = wxid;
|
||||||
let wxId = row.insertCell(0);
|
row.insertCell(1).innerHTML = nickname;
|
||||||
wxId.innerHTML = groupUser.wxid;
|
row.insertCell(2).innerHTML = `<div class="badge badge-${isMember ? 'info' : 'error'} gap-2">${isMember ? '是' : '否'}</div>`;
|
||||||
|
row.insertCell(3).innerHTML = `<div class="badge badge-${isAdmin ? 'info' : 'error'} gap-2">${isAdmin ? '是' : '否'}</div>`;
|
||||||
// 昵称
|
row.insertCell(4).innerHTML = joinTime;
|
||||||
let nickname = row.insertCell(1);
|
row.insertCell(5).innerHTML = lastActiveTime;
|
||||||
nickname.innerHTML = groupUser.nickname;
|
row.insertCell(6).innerHTML = leaveTime;
|
||||||
|
row.insertCell(7).innerHTML = `<input type="checkbox" class="toggle toggle-error" ${skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus('${groupId}', '${wxid}')" />`;
|
||||||
// 是否群成员
|
});
|
||||||
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;
|
|
||||||
|
|
||||||
// 最后活跃时间
|
|
||||||
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 = `<input type="checkbox" class="toggle toggle-error" ${groupUser.skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus(\'${groupId}\', \'${groupUser.wxid}\')" />`;
|
|
||||||
}
|
|
||||||
}).catch(function (error) {
|
}).catch(function (error) {
|
||||||
console.log(`错误信息: ${error}`);
|
console.log(`错误信息: ${error}`);
|
||||||
}).finally(function () {
|
}).finally(function () {
|
||||||
|
@ -28,6 +28,7 @@ type GroupUserItem struct {
|
|||||||
HeadImage string `json:"headImage"` // 头像
|
HeadImage string `json:"headImage"` // 头像
|
||||||
Nickname string `json:"nickname"` // 昵称
|
Nickname string `json:"nickname"` // 昵称
|
||||||
IsMember bool `json:"isMember" ` // 是否群成员
|
IsMember bool `json:"isMember" ` // 是否群成员
|
||||||
|
IsAdmin bool `json:"isAdmin"` // 是否群主
|
||||||
JoinTime types.DateTime `json:"joinTime"` // 加入时间
|
JoinTime types.DateTime `json:"joinTime"` // 加入时间
|
||||||
LastActiveTime types.DateTime `json:"lastActiveTime"` // 最后活跃时间
|
LastActiveTime types.DateTime `json:"lastActiveTime"` // 最后活跃时间
|
||||||
LeaveTime types.DateTime `json:"leaveTime"` // 离开时间
|
LeaveTime types.DateTime `json:"leaveTime"` // 离开时间
|
||||||
|
Loading…
Reference in New Issue
Block a user