Initial commit: web_hghl_server
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package web_user
|
||||
|
||||
import (
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/web/service/srv_user"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 用户管理
|
||||
// @Summary 查询用户列表
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_user.UserListReq true "查询参数"
|
||||
// @Success 200 {object} srv_user.UserListResp "成功"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/user/list [POST]
|
||||
func GetUserList(ctx *gin.Context) {
|
||||
var req srv_user.UserListReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, serr := srv_user.GetUsers(ctx, &req)
|
||||
if serr != nil {
|
||||
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 用户管理
|
||||
// @Summary 更新用户信息
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_user.UserUpdateReq true "更新参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Security ApiKeyAuth
|
||||
// @Router /api/web/user/update [POST]
|
||||
func UpdateUser(ctx *gin.Context) {
|
||||
var req srv_user.UserUpdateReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
if serr := srv_user.UpdateUser(ctx, req.Id, req.Param); serr != nil {
|
||||
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, "")
|
||||
}
|
||||
Reference in New Issue
Block a user