Initial commit: web_hghl_server
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package web_questionnaire
|
||||
|
||||
import (
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
"videoweb/web/service/srv_questionnaire"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// @Tags 问卷调查
|
||||
// @Summary 查询问卷列表
|
||||
// @Description 支持分页及条件筛选(question_type、status、时间范围)
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_questionnaire.ListReq true "查询参数"
|
||||
// @Success 200 {object} srv_questionnaire.ListResp "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/web/questionnaire/list [POST]
|
||||
func List(ctx *gin.Context) {
|
||||
var req srv_questionnaire.ListReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
resp, serr := srv_questionnaire.List(ctx, &req)
|
||||
if serr != nil {
|
||||
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, resp)
|
||||
}
|
||||
|
||||
// @Tags 问卷调查
|
||||
// @Summary 处理问卷
|
||||
// @Description 只有状态为"待处理"的问卷才允许更新
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body srv_questionnaire.HandleReq true "处理参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/web/questionnaire/handle [POST]
|
||||
func Handle(ctx *gin.Context) {
|
||||
var req srv_questionnaire.HandleReq
|
||||
if err := ctx.ShouldBind(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := srv_questionnaire.Handle(ctx, &req)
|
||||
if serr != nil {
|
||||
common.ServerJSON(ctx, serr.Code, serr.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user