Merge pull request 'hotfix' (#75) from hotfix into main

Reviewed-on: lxh/go-wxhelper#75
This commit is contained in:
李寻欢 2024-07-11 15:47:53 +08:00
commit f8f2d384f4
3 changed files with 181 additions and 159 deletions

View File

@ -25,6 +25,19 @@ func GetGroupUsers(ctx *gin.Context) {
ctx.String(http.StatusInternalServerError, "查询失败: %s", err.Error())
return
}
// 暂时先就这样写着,跑通了再改
ctx.JSON(http.StatusOK, records)
result := map[string]any{
"records": records,
}
// 循环数据,统计健在成员
var isOkCount int
for _, record := range records {
if record.IsMember {
isOkCount++
}
}
result["isOkCount"] = isOkCount
// 暂时先就这样写着,跑通了再改
ctx.JSON(http.StatusOK, result)
}

View File

@ -1,6 +1,9 @@
<dialog id="groupUserModal" class="modal">
<div class="modal-box w-11/12 max-w-7xl">
<div class="flex">
<h3 class="font-bold text-lg" id="groupUserModalName">我是群名称</h3>
<h3 class="font-bold text-lg ml-5" id="groupUserCount">(健在成员100人)</h3>
</div>
<div class="divider divider-warning">成员列表</div>
<table class="table table-zebra">
<thead>

View File

@ -162,12 +162,18 @@ function getGroupUsers(groupId, groupName) {
groupId: groupId
}
}).then(function (response) {
// console.log(`返回结果: ${JSON.stringify(response)}`);
// console.log(`返回结果: ${JSON.stringify(response.data)}`);
// 渲染群成员列表
const groupUsers = response.data
const groupUsers = response.data.records;
const groupUserCount = response.data.isOkCount;
// 设置成员总数
const groupUserCountTag = document.getElementById("groupUserCount");
groupUserCountTag.innerHTML = `健在成员: ${groupUserCount}`
// 循环渲染数据
groupUsers.forEach((groupUser, i) => {
console.log(groupUser)
// console.log(groupUser)
const {wxid, nickname, isMember, isAdmin, joinTime, lastActive, leaveTime, skipChatRank} = groupUser;
let row = tbody.insertRow(i);