123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- package handler
- import (
- "github.com/gin-gonic/gin"
- "github.com/sirupsen/logrus"
- "youngee_b_api/consts"
- "youngee_b_api/db"
- "youngee_b_api/middleware"
- "youngee_b_api/model/http_model"
- "youngee_b_api/util"
- )
- func WrapGetReceiveInfoHandler(ctx *gin.Context) {
- handler := newGetReceiveInfoHandler(ctx)
- baseRun(handler)
- }
- type GetReceiveInfoHandler struct {
- ctx *gin.Context
- req *http_model.GetReceiveInfoRequest
- resp *http_model.CommonResponse
- }
- func (g GetReceiveInfoHandler) getContext() *gin.Context {
- return g.ctx
- }
- func (g GetReceiveInfoHandler) getResponse() interface{} {
- return g.resp
- }
- func (g GetReceiveInfoHandler) getRequest() interface{} {
- return g.req
- }
- func (g GetReceiveInfoHandler) run() {
- auth := middleware.GetSessionAuth(g.ctx)
- enterpriseID := auth.EnterpriseID
- data, err := db.GetReceiveInfo(g.ctx, enterpriseID)
- if err != nil {
- // 数据库查询失败,返回5001
- logrus.Errorf("[GetReceiveInfoHandler] call GetReceiveInfo err:%+v\n", err)
- util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, "")
- logrus.Info("GetReceiveInfo fail,req:%+v", g.req)
- return
- }
- g.resp.Data = data
- }
- func (g GetReceiveInfoHandler) checkParam() error {
- return nil
- }
- func newGetReceiveInfoHandler(ctx *gin.Context) *GetReceiveInfoHandler {
- return &GetReceiveInfoHandler{
- ctx: ctx,
- req: http_model.NewGetReceiveInfoRequest(),
- resp: http_model.NewGetReceiveInfoResponse(),
- }
- }
|