Initial commit: web_hghl_server
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package questionnaireapi
|
||||
|
||||
import (
|
||||
"videoweb/app/api/proto"
|
||||
"videoweb/app/service/configser"
|
||||
"videoweb/app/service/searchser"
|
||||
"videoweb/app/service/translationser"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Page 问卷调查页
|
||||
func Page(c *gin.Context) {
|
||||
hotSearch := searchser.GetHotSearchItem(c)
|
||||
data := proto.QuestionnaireHtmlData{
|
||||
Path: c.Request.URL.Path,
|
||||
Translation: translationser.GetTranslationData(),
|
||||
Config: configser.GetRequestConfig(c),
|
||||
Advitise: configser.GetAdvitise(),
|
||||
Announcement: configser.GetAnnouncement(),
|
||||
HotSearch: hotSearch,
|
||||
}
|
||||
configser.RewriteImageCdn(c, &data)
|
||||
c.HTML(200, "questionnaire", gin.H{
|
||||
"data": data,
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package questionnaireapi
|
||||
|
||||
import (
|
||||
"videoweb/app/api/proto"
|
||||
"videoweb/app/service/questionnaireser"
|
||||
"videoweb/pub/common"
|
||||
"videoweb/pub/common/srvdef"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// Submit 提交问卷
|
||||
// @Tags 问卷调查APP
|
||||
// @Summary 提交问卷
|
||||
// @Description 用户提交问题反馈问卷
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param param body proto.QuestionnaireSubmitReq true "提交参数"
|
||||
// @Success 200 {string} string "成功"
|
||||
// @Failure 400 {string} string "失败"
|
||||
// @Router /api/app/questionnaire/submit [post]
|
||||
func Submit(ctx *gin.Context) {
|
||||
var req proto.QuestionnaireSubmitReq
|
||||
if err := ctx.ShouldBindJSON(&req); err != nil {
|
||||
common.ServerJSON(ctx, srvdef.ErrParamError, nil)
|
||||
return
|
||||
}
|
||||
serr := questionnaireser.Submit(ctx, ctx.ClientIP(), &req)
|
||||
if serr != nil {
|
||||
common.ServerJSON(ctx, serr, serr.Tips)
|
||||
return
|
||||
}
|
||||
common.ServerJSON(ctx, srvdef.Success, nil)
|
||||
}
|
||||
Reference in New Issue
Block a user