feat(M5): 前端完善 + 部署 — Vue3 全量页面、仪表盘统计与我的审计接口、systemd/sudoers/迁移脚本、部署文档
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// 仪表盘统计接口(admin):GET /admin/stats(PLAN §8 仪表盘数据)。
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"ws_usernode/internal/service"
|
||||
)
|
||||
|
||||
// StatsHandler 仪表盘统计。
|
||||
type StatsHandler struct {
|
||||
userSvc *service.UserService
|
||||
}
|
||||
|
||||
// NewStatsHandler 创建统计 handler。
|
||||
func NewStatsHandler(userSvc *service.UserService) *StatsHandler {
|
||||
return &StatsHandler{userSvc: userSvc}
|
||||
}
|
||||
|
||||
// Stats GET /admin/stats —— 用户状态分布、近期待过期、待审批数。
|
||||
func (h *StatsHandler) Stats(c *gin.Context) {
|
||||
st, err := h.userSvc.Stats(c.Request.Context())
|
||||
if err != nil {
|
||||
fail(c, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
ok(c, st)
|
||||
}
|
||||
Reference in New Issue
Block a user