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)}`);
|
2024-04-12 11:37:21 +08:00
|
|
|
|
alert(`${response.data}`)
|
2023-11-30 17:31:50 +08:00
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
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)}`);
|
2024-04-12 11:37:21 +08:00
|
|
|
|
alert(`${response.data}`)
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
2024-04-12 11:37:21 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 修改水群排行榜状态
|
|
|
|
|
function changeSummaryEnableStatus(wxId) {
|
|
|
|
|
// console.log("修改聊天记录总结开启状态: ", wxId)
|
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/summary/status',
|
|
|
|
|
data: {
|
|
|
|
|
wxId: wxId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
|
|
|
|
alert(`${response.data}`)
|
2023-11-30 17:31:50 +08:00
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
2023-11-30 17:31:50 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2023-12-04 14:24:30 +08:00
|
|
|
|
// 修改欢迎语开启状态
|
|
|
|
|
function changeWelcomeEnableStatus(wxId) {
|
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/welcome/status',
|
|
|
|
|
data: {
|
|
|
|
|
wxId: wxId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
2024-04-12 11:37:21 +08:00
|
|
|
|
alert(`${response.data}`)
|
2023-12-04 14:24:30 +08:00
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
2023-12-04 14:24:30 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-12 22:20:14 +08:00
|
|
|
|
// 修改指令权限启用状态
|
|
|
|
|
function changeCommandEnableStatus(wxId) {
|
|
|
|
|
axios({
|
|
|
|
|
method: 'put',
|
|
|
|
|
url: '/api/command/status',
|
|
|
|
|
data: {
|
|
|
|
|
wxId: wxId
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
2024-04-12 11:37:21 +08:00
|
|
|
|
alert(`${response.data}`)
|
2024-01-12 22:20:14 +08:00
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
2024-01-12 22:20:14 +08:00
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
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)}`);
|
2024-04-12 11:37:21 +08:00
|
|
|
|
alert(`${response.data}`)
|
2023-11-30 17:31:50 +08:00
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
2023-11-30 23:12:38 +08:00
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
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
|
|
|
|
// 循环渲染数据
|
2024-01-12 22:26:06 +08:00
|
|
|
|
groupUsers.forEach((groupUser, i) => {
|
2024-01-25 16:27:12 +08:00
|
|
|
|
console.log(groupUser)
|
|
|
|
|
const { wxid, nickname, isMember, isAdmin, joinTime, lastActive, leaveTime, skipChatRank } = groupUser;
|
2024-01-12 22:26:06 +08:00
|
|
|
|
|
|
|
|
|
let row = tbody.insertRow(i);
|
|
|
|
|
// Insert data into cells
|
|
|
|
|
row.insertCell(0).innerHTML = wxid;
|
|
|
|
|
row.insertCell(1).innerHTML = nickname;
|
|
|
|
|
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;
|
2024-01-25 16:27:12 +08:00
|
|
|
|
row.insertCell(5).innerHTML = lastActive;
|
2024-01-12 22:26:06 +08:00
|
|
|
|
row.insertCell(6).innerHTML = leaveTime;
|
|
|
|
|
row.insertCell(7).innerHTML = `<input type="checkbox" class="toggle toggle-error" ${skipChatRank ? 'checked' : ''} onclick="changeUserGroupRankSkipStatus('${groupId}', '${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
|
|
|
|
})
|
2024-01-31 12:02:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// AI模型变动
|
|
|
|
|
function aiModelChange(event, wxid) {
|
|
|
|
|
// 取出变动后的值
|
|
|
|
|
const modelStr = event.target.value;
|
|
|
|
|
console.log("AI模型变动: ", wxid, modelStr)
|
|
|
|
|
axios({
|
|
|
|
|
method: 'post',
|
|
|
|
|
url: '/api/ai/model',
|
|
|
|
|
data: {
|
|
|
|
|
wxid: wxid,
|
|
|
|
|
model: modelStr
|
|
|
|
|
}
|
|
|
|
|
}).then(function (response) {
|
|
|
|
|
console.log(`返回结果: ${JSON.stringify(response)}`);
|
|
|
|
|
alert(`${response.data}`)
|
|
|
|
|
}).catch(function (error) {
|
|
|
|
|
console.log(`错误信息: ${error}`);
|
|
|
|
|
alert("修改失败")
|
2024-04-23 10:42:08 +08:00
|
|
|
|
}).finally(function () {
|
|
|
|
|
window.location.reload();
|
2024-01-31 12:02:33 +08:00
|
|
|
|
})
|
|
|
|
|
}
|