This commit is contained in:
xiangheng
2024-11-08 17:43:07 +08:00
parent 61e3d904f9
commit fe33721abf
6 changed files with 6445 additions and 4008 deletions

View File

@@ -18,22 +18,22 @@ type UserProtocolHandler struct {
requestGroup singleflight.Group
}
// @Summary 用户协议列表
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param PageNo query int true "页码"
// @Param PageSize query int true "每页数量"
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
// @Summary 用户协议列表
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param PageNo query int true "页码"
// @Param PageSize query int true "每页数量"
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
//
// @Success 200 {object} response.Response{ data=response.PageResp{ lists=[]UserProtocolResp}} "成功"
// @Router /api/admin/user_protocol/list [get]
// @Success 200 {object} response.Response{ data=response.PageResp{ lists=[]UserProtocolResp}} "成功"
// @Router /api/admin/user_protocol/list [get]
func (hd *UserProtocolHandler) List(c *gin.Context) {
var page request.PageReq
var listReq UserProtocolListReq
@@ -47,18 +47,18 @@ func (hd *UserProtocolHandler) List(c *gin.Context) {
response.CheckAndRespWithData(c, res, err)
}
// @Summary 用户协议列表-所有
// @Tags user_protocol-用户协议
// @Produce json
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
// @Success 200 {object} response.Response{ data=[]UserProtocolResp} "成功"
// @Router /api/admin/user_protocol/listAll [get]
// @Summary 用户协议列表-所有
// @Tags user_protocol-用户协议
// @Produce json
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
// @Success 200 {object} response.Response{ data=[]UserProtocolResp} "成功"
// @Router /api/admin/user_protocol/listAll [get]
func (hd *UserProtocolHandler) ListAll(c *gin.Context) {
var listReq UserProtocolListReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
@@ -68,13 +68,13 @@ func (hd *UserProtocolHandler) ListAll(c *gin.Context) {
response.CheckAndRespWithData(c, res, err)
}
// @Summary 用户协议详情
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id query number false ""
// @Success 200 {object} response.Response{ data=UserProtocolResp} "成功"
// @Router /api/admin/user_protocol/detail [get]
// @Summary 用户协议详情
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id query number false "Id"
// @Success 200 {object} response.Response{ data=UserProtocolResp} "成功"
// @Router /api/admin/user_protocol/detail [get]
func (hd *UserProtocolHandler) Detail(c *gin.Context) {
var detailReq UserProtocolDetailReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &detailReq)) {
@@ -88,15 +88,15 @@ func (hd *UserProtocolHandler) Detail(c *gin.Context) {
response.CheckAndRespWithData(c, res, err)
}
// @Summary 用户协议新增
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Title body string false "标题"
// @Param Content body string false "协议内容"
// @Param Sort body number false "排序"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/add [post]
// @Summary 用户协议新增
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Title body string false "标题"
// @Param Content body string false "协议内容"
// @Param Sort body number false "排序"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/add [post]
func (hd *UserProtocolHandler) Add(c *gin.Context) {
var addReq UserProtocolAddReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &addReq)) {
@@ -106,16 +106,16 @@ func (hd *UserProtocolHandler) Add(c *gin.Context) {
response.CheckAndRespWithData(c, createId, e)
}
// @Summary 用户协议编辑
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id body number false ""
// @Param Title body string false "标题"
// @Param Content body string false "协议内容"
// @Param Sort body number false "排序"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/edit [post]
// @Summary 用户协议编辑
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id body number false "Id"
// @Param Title body string false "标题"
// @Param Content body string false "协议内容"
// @Param Sort body number false "排序"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/edit [post]
func (hd *UserProtocolHandler) Edit(c *gin.Context) {
var editReq UserProtocolEditReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &editReq)) {
@@ -124,13 +124,13 @@ func (hd *UserProtocolHandler) Edit(c *gin.Context) {
response.CheckAndRespWithData(c, editReq.Id, UserProtocolService.Edit(editReq))
}
// @Summary 用户协议删除
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id body number false ""
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/del [post]
// @Summary 用户协议删除
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Id body number false "Id"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/del [post]
func (hd *UserProtocolHandler) Del(c *gin.Context) {
var delReq UserProtocolDelReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
@@ -139,14 +139,14 @@ func (hd *UserProtocolHandler) Del(c *gin.Context) {
response.CheckAndResp(c, UserProtocolService.Del(delReq.Id))
}
// @Summary 用户协议删除-批量
// @Tags user_protocol-用户协议
// @Summary 用户协议删除-批量
// @Tags user_protocol-用户协议
//
// @Produce json
// @Param Token header string true "token"
// @Param Ids body string false "逗号分割的id"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/delBatch [post]
// @Produce json
// @Param Token header string true "token"
// @Param Ids body string false "逗号分割的id"
// @Success 200 {object} response.Response "成功"
// @Router /api/admin/user_protocol/delBatch [post]
func (hd *UserProtocolHandler) DelBatch(c *gin.Context) {
var delReq UserProtocolDelBatchReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
@@ -161,18 +161,18 @@ func (hd *UserProtocolHandler) DelBatch(c *gin.Context) {
response.CheckAndResp(c, UserProtocolService.DelBatch(Ids))
}
// @Summary 用户协议导出
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
// @Router /api/admin/user_protocol/ExportFile [get]
// @Summary 用户协议导出
// @Tags user_protocol-用户协议
// @Produce json
// @Param Token header string true "token"
// @Param Title query string false "标题"
// @Param Content query string false "协议内容"
// @Param Sort query number false "排序"
// @Param CreateTimeStart query string false "创建时间"
// @Param CreateTimeEnd query string false "创建时间"
// @Param UpdateTimeStart query string false "更新时间"
// @Param UpdateTimeEnd query string false "更新时间"
// @Router /api/admin/user_protocol/ExportFile [get]
func (hd *UserProtocolHandler) ExportFile(c *gin.Context) {
var listReq UserProtocolListReq
if response.IsFailWithResp(c, util.VerifyUtil.VerifyQuery(c, &listReq)) {
@@ -191,10 +191,10 @@ func (hd *UserProtocolHandler) ExportFile(c *gin.Context) {
excel2.DownLoadExcel("用户协议"+time.Now().Format("20060102-150405"), c.Writer, f)
}
// @Summary 用户协议导入
// @Tags user_protocol-用户协议
// @Produce json
// @Router /api/admin/user_protocol/ImportFile [post]
// @Summary 用户协议导入
// @Tags user_protocol-用户协议
// @Produce json
// @Router /api/admin/user_protocol/ImportFile [post]
func (hd *UserProtocolHandler) ImportFile(c *gin.Context) {
file, _, err := c.Request.FormFile("file")
if err != nil {