1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package v1
- import (
- "git.getensh.com/common/gopkgs/logger"
- "git.getensh.com/common/gopkgs/tasker/httptasker"
- "git.getensh.com/common/gopkgs/util"
- "github.com/gin-gonic/gin"
- "go.uber.org/zap"
- "net/http"
- "xingjia-official-gateway/apis"
- "xingjia-official-gateway/consts"
- "xingjia-official-gateway/errors"
- "xingjia-official-gateway/impl/v1/jt"
- param_v1 "xingjia-official-gateway/param/v1"
- )
- //
- // @Summary 党风廉洁列表
- // @Description 党风廉洁列表
- // @Tags 党风廉洁
- // @Accept json
- // @Produce json
- // @Param page query int false " "
- // @Param page_size query int false " "
- // @Success 200 {object} v1.JtContentListResponse
- // @Failure 500 {object} base.HTTPError
- // @Router /api/v1/jt/df [get]
- func (c *Controller) JtDfList(ctx *gin.Context) {
- // 解析参数
- req := ¶m_v1.JtContentListRequest{}
- parseParamTask := func() error {
- err := util.ShouldBind(ctx, nil, nil, &req.JtContentListQuery, nil)
- if err != nil {
- logger.Error("func",
- zap.String("call", "util.ShouldBind"),
- zap.String("error", err.Error()))
- return errors.ParamsError
- }
- return nil
- }
- // 业务处理
- handleServiceTask := func() error {
- // 响应数据
- resp := param_v1.JtContentListResponse{}
- rpcReq := &apis.JtContentListRequest{
- ContentType: consts.OperationModuleDangfeng,
- PageSize: req.PageSize,
- Page: req.Page,
- }
- rpcRsp, err := jt.JtContentList(ctx, rpcReq)
- if err != nil {
- s, _ := json.MarshalToString(req)
- logger.Error("func",
- zap.String("call", "jt.JtContentList"),
- zap.String("params", s),
- zap.String("error", err.Error()))
- return errors.ErrorTransForm(err)
- }
- if rpcRsp.List == nil {
- rpcRsp.List = make([]*apis.JtContentItem, 0)
- }
- resp.Data = *rpcRsp
- ctx.JSON(http.StatusOK, resp)
- return nil
- }
- // 执行任务
- httptasker.Exec(ctx, parseParamTask, handleServiceTask)
- }
|