From d802cbd6ca90585979803adb119e315c0e96eb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AF=BB=E6=AC=A2?= Date: Thu, 11 Jul 2024 15:46:49 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E4=BC=98=E5=8C=96=E7=BE=A4=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=98=BE=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/group.go | 15 +- main.go | 2 +- views/groupuser.html | 5 +- views/static/js/index.js | 320 ++++++++++++++++++++------------------- 4 files changed, 182 insertions(+), 160 deletions(-) diff --git a/app/group.go b/app/group.go index 9b22f931..518b45d3 100644 --- a/app/group.go +++ b/app/group.go @@ -25,6 +25,19 @@ func GetGroupUsers(ctx *gin.Context) { ctx.String(http.StatusInternalServerError, "查询失败: %s", err.Error()) return } + + result := map[string]any{ + "records": records, + } + // 循环数据,统计健在成员 + var isOkCount int + for _, record := range records { + if record.IsMember { + isOkCount++ + } + } + result["isOkCount"] = isOkCount + // 暂时先就这样写着,跑通了再改 - ctx.JSON(http.StatusOK, records) + ctx.JSON(http.StatusOK, result) } diff --git a/main.go b/main.go index 0ca0fbe0..603ab697 100644 --- a/main.go +++ b/main.go @@ -79,7 +79,7 @@ func main() { }) // 初始化路由 router.Init(app) - if err := app.Run(":8080"); err != nil { + if err := app.Run(":18080"); err != nil { log.Panicf("服务启动失败:%v", err) } } diff --git a/views/groupuser.html b/views/groupuser.html index 984c6cde..516e59cc 100644 --- a/views/groupuser.html +++ b/views/groupuser.html @@ -1,6 +1,9 @@