feat: 从黄果 NET hgdjnet-server 9bfbafe 导入 HKDJ 官网后端

来源:hgdjnet-server 9bfbafe10d417deea959bd53117bc88a10e60a83
项目身份 HKDJ / JHA-216,独立官网仓库,Jenkins 守卫键 hkdjnet
测试目录 /server/hkdj_net,App/Web API 30331/30332

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 11:20:04 +08:00
co-authored by Claude Opus 4.7
parent 99a4854def
commit 85c0071fd8
653 changed files with 85000 additions and 0 deletions
+119
View File
@@ -0,0 +1,119 @@
package web_user
import (
"hkdj-web-server/pub/common"
"hkdj-web-server/pub/common/srvdef"
"hkdj-web-server/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, "")
}
// @Tags 用户管理
// @Summary 赠送/扣除用户金币
// @Description coin 为正数表示赠送,为负数表示扣除;操作会自动记录金币流水
// @Accept json
// @Produce json
// @Param param body srv_user.GiftCoinReq true "赠送参数"
// @Success 200 {string} string "成功"
// @Security ApiKeyAuth
// @Router /api/web/user/giftcoin [POST]
func GiftCoin(ctx *gin.Context) {
var req srv_user.GiftCoinReq
if err := ctx.ShouldBind(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if serr := srv_user.GiftCoin(ctx, &req); serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// @Tags 用户管理
// @Summary 修改用户会员
// @Description 根据会员畅享套餐ID修改用户会员信息,不处理赠送金币
// @Accept json
// @Produce json
// @Param param body srv_user.UpdateVipReq true "修改会员参数"
// @Success 200 {string} string "成功"
// @Security ApiKeyAuth
// @Router /api/web/user/vip/update [POST]
func UpdateVip(ctx *gin.Context) {
var req srv_user.UpdateVipReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if serr := srv_user.UpdateVip(ctx, &req); serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}
// ResetPassword web端按用户ID重置密码
// @Tags 用户管理
// @Summary 重置用户密码
// @Description 传入用户ID和明文密码,服务端按 app 登录相同规则哈希后写入
// @Accept json
// @Produce json
// @Param param body srv_user.ResetPasswordReq true "重置密码参数"
// @Success 200 {string} string "成功"
// @Security ApiKeyAuth
// @Router /api/web/user/resetPassword [POST]
func ResetPassword(ctx *gin.Context) {
var req srv_user.ResetPasswordReq
if err := ctx.ShouldBindJSON(&req); err != nil {
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
return
}
if serr := srv_user.ResetPassword(ctx, &req); serr != nil {
common.ServerJSON(ctx, serr.Code, serr.Tips)
return
}
common.ServerJSON(ctx, srvdef.Success, "")
}