2023-11-30 17:31:50 +08:00
|
|
|
|
console.log("打开首页")
|
|
|
|
|
|
|
|
|
|
// 改变AI开启状态
|
|
|
|
|
function changeAiEnableStatus(wxId) {
|
2023-11-30 23:12:38 +08:00
|
|
|
|
// console.log("修改AI开启状态: ", wxId)
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/ai/status',
|
|
|
|
|
data: {
|
|
|
|
|
wxId: wxId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2023-11-30 17:31:50 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改水群排行榜状态
|
|
|
|
|
function changeGroupRankEnableStatus(wxId) {
|
2023-11-30 23:12:38 +08:00
|
|
|
|
// console.log("修改水群排行榜开启状态: ", wxId)
|
2023-11-30 17:31:50 +08:00
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/grouprank/status',
|
|
|
|
|
data: {
|
|
|
|
|
wxId: wxId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2023-11-30 17:31:50 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改群成员是否参与排行榜状态
|
|
|
|
|
function changeUserGroupRankSkipStatus(groupId, userId) {
|
|
|
|
|
console.log("修改水群排行榜开启状态: ", groupId, userId)
|
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/grouprank/skip',
|
|
|
|
|
data: {
|
2023-11-30 23:12:38 +08:00
|
|
|
|
wxId: groupId,
|
2023-11-30 17:31:50 +08:00
|
|
|
|
userId: userId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2023-11-30 17:31:50 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取群成员列表
|
2023-11-30 23:12:38 +08:00
|
|
|
|
function getGroupUsers(groupId, groupName) {
|
|
|
|
|
// 获取表格的tbody部分,以便稍后向其中添加行
|
|
|
|
|
var tbody = document.getElementById("groupUsers");
|
|
|
|
|
tbody.innerHTML = ""
|
|
|
|
|
|
2023-11-30 17:31:50 +08:00
|
|
|
|
// 打开模态框
|
|
|
|
|
const modal = document.getElementById("groupUserModal");
|
|
|
|
|
modal.showModal()
|
|
|
|
|
|
2023-11-30 23:12:38 +08:00
|
|
|
|
// 设置群名称
|
|
|
|
|
const groupNameTag = document.getElementById("groupUserModalName");
|
|
|
|
|
groupNameTag.innerHTML = '<span class="loading loading-dots loading-lg"></span>'
|
|
|
|
|
|
|
|
|
|
// 显示加载框
|
|
|
|
|
// const loading = document.getElementById("groupUserDataLoading");
|
|
|
|
|
// loading.style.display = "block"
|
|
|
|
|
|
2023-11-30 17:31:50 +08:00
|
|
|
|
axios.get('/api/group/users', {
|
|
|
|
|
params: {
|
|
|
|
|
groupId: groupId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
2023-11-30 23:12:38 +08:00
|
|
|
|
// console.log(`返回结果: ${JSON.stringify(response)}`);
|
2023-11-30 17:31:50 +08:00
|
|
|
|
// 渲染群成员列表
|
|
|
|
|
const groupUsers = response.data
|
2023-11-30 23:12:38 +08:00
|
|
|
|
// 循环渲染数据
|
2023-11-30 17:31:50 +08:00
|
|
|
|
for (let i = 0; i < groupUsers.length; i++) {
|
|
|
|
|
const groupUser = groupUsers[i]
|
|
|
|
|
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let row = tbody.insertRow(i); // 插入新行
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
// 微信Id
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let wxId = row.insertCell(0);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
wxId.innerHTML = groupUser.wxid;
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
// 昵称
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let nickname = row.insertCell(1);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
nickname.innerHTML = groupUser.nickname;
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
// 是否群成员
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let isMember = row.insertCell(2);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
if (groupUser.isMember) {
|
|
|
|
|
isMember.innerHTML = '<div class="badge badge-info gap-2">是</div>';
|
|
|
|
|
} else {
|
|
|
|
|
isMember.innerHTML = '<div class="badge badge-error gap-2">否</div>';
|
|
|
|
|
}
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
2023-12-01 10:22:01 +08:00
|
|
|
|
// 加群时间
|
|
|
|
|
let joinTime = row.insertCell(3);
|
|
|
|
|
joinTime.innerHTML = groupUser.joinTime;
|
|
|
|
|
|
2023-11-30 17:31:50 +08:00
|
|
|
|
// 最后活跃时间
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let lastActiveTime = row.insertCell(4);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
lastActiveTime.innerHTML = groupUser.lastActiveTime;
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
// 退群时间
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let leaveTime = row.insertCell(5);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
leaveTime.innerHTML = groupUser.leaveTime;
|
2023-11-30 17:31:50 +08:00
|
|
|
|
|
|
|
|
|
// 是否跳过水群排行榜
|
2023-12-01 10:22:01 +08:00
|
|
|
|
let skipChatRank = row.insertCell(6);
|
|
|
|
|
skipChatRank.innerHTML = `<input type="checkbox" class="toggle toggle-error" ${groupUser.skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus(\'${groupId}\', \'${groupUser.wxid}\')" />`;
|
2023-11-30 17:31:50 +08:00
|
|
|
|
}
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
// 隐藏加载框
|
|
|
|
|
// loading.style.display = "none"
|
|
|
|
|
groupNameTag.innerHTML = groupName
|
2023-11-30 17:31:50 +08:00
|
|
|
|
})
|
|
|
|
|
}
|