special_local_list.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_b_api/consts"
  6. "youngee_b_api/model/http_model"
  7. "youngee_b_api/pack"
  8. "youngee_b_api/service"
  9. "youngee_b_api/util"
  10. )
  11. func WrapSpecialLocalListHandler(ctx *gin.Context) {
  12. handler := newSpecialLocalListHandler(ctx)
  13. baseRun(handler)
  14. }
  15. func newSpecialLocalListHandler(ctx *gin.Context) *SpecialLocalListHandler {
  16. return &SpecialLocalListHandler{
  17. req: http_model.NewSpecialLocalListRequest(),
  18. resp: http_model.NewSpecialLocalListResponse(),
  19. ctx: ctx,
  20. }
  21. }
  22. type SpecialLocalListHandler struct {
  23. req *http_model.SpecialLocalListRequest
  24. resp *http_model.CommonResponse
  25. ctx *gin.Context
  26. }
  27. func (h *SpecialLocalListHandler) getRequest() interface{} {
  28. return h.req
  29. }
  30. func (h *SpecialLocalListHandler) getContext() *gin.Context {
  31. return h.ctx
  32. }
  33. func (h *SpecialLocalListHandler) getResponse() interface{} {
  34. return h.resp
  35. }
  36. func (h *SpecialLocalListHandler) run() {
  37. // enterpriseID := middleware.GetSessionAuth(h.ctx).EnterpriseID
  38. condition := pack.HttpSpecialLocalLifeListRequestToCondition(h.req)
  39. data, err := service.LocalLife.GetSpecialLocalLifeList(h.ctx, h.req.PageSize, h.req.PageNum-1, condition)
  40. if err != nil {
  41. logrus.WithContext(h.ctx).Errorf("[FullListHandler] error GetFullProjectList, err:%+v", err)
  42. util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
  43. h.resp.Message = "err"
  44. h.resp.Status = 40000
  45. return
  46. }
  47. h.resp.Data = data
  48. h.resp.Message = "ok"
  49. h.resp.Status = 20000
  50. }
  51. func (h *SpecialLocalListHandler) checkParam() error {
  52. return nil
  53. }