local_life_detail.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. log "github.com/sirupsen/logrus"
  6. "youngee_b_api/consts"
  7. "youngee_b_api/model/http_model"
  8. "youngee_b_api/service"
  9. "youngee_b_api/util"
  10. )
  11. func WrapLocalLifeDetailHandler(ctx *gin.Context) {
  12. handler := newLocalLifeDetailHandler(ctx)
  13. baseRun(handler)
  14. }
  15. func newLocalLifeDetailHandler(ctx *gin.Context) *LocalLifeDetailHandler {
  16. return &LocalLifeDetailHandler{
  17. req: http_model.NewShowLocalRequest(),
  18. resp: http_model.NewShowLocalResponse(),
  19. ctx: ctx,
  20. }
  21. }
  22. type LocalLifeDetailHandler struct {
  23. req *http_model.ShowLocalRequest
  24. resp *http_model.CommonResponse
  25. ctx *gin.Context
  26. }
  27. func (h *LocalLifeDetailHandler) getRequest() interface{} {
  28. return h.req
  29. }
  30. func (h *LocalLifeDetailHandler) getContext() *gin.Context {
  31. return h.ctx
  32. }
  33. func (h *LocalLifeDetailHandler) getResponse() interface{} {
  34. return h.resp
  35. }
  36. func (h *LocalLifeDetailHandler) run() {
  37. // auth := middleware.GetSessionAuth(h.ctx)
  38. // enterpriseID := auth.EnterpriseID
  39. // fmt.Printf("projectID %+v", data.ProjectID)
  40. res, err := service.LocalLife.ShowLocalLife(h.ctx, h.req)
  41. if err != nil {
  42. logrus.Errorf("[ShowProjectHandler] call Show err:%+v\n", err)
  43. util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "")
  44. log.Info("ShowProject fail,req:%+v", h.req)
  45. return
  46. }
  47. h.resp.Message = "成功查询项目"
  48. h.resp.Data = res
  49. }
  50. func (h *LocalLifeDetailHandler) checkParam() error {
  51. return nil
  52. }