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 @@