job_detail.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_m_api/consts"
  6. "youngee_m_api/db"
  7. "youngee_m_api/model/http_model"
  8. "youngee_m_api/util"
  9. )
  10. func WrapJobDetailHandler(ctx *gin.Context) {
  11. handler := newJobDetail(ctx)
  12. BaseRun(handler)
  13. }
  14. type JobDetailHandler struct {
  15. ctx *gin.Context
  16. req *http_model.JobDetailRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (s JobDetailHandler) getContext() *gin.Context {
  20. return s.ctx
  21. }
  22. func (s JobDetailHandler) getResponse() interface{} {
  23. return s.resp
  24. }
  25. func (s JobDetailHandler) getRequest() interface{} {
  26. return s.req
  27. }
  28. func (s JobDetailHandler) run() {
  29. //enterpriseID := middleware.GetSessionAuth(s.ctx).EnterpriseID
  30. res, err := db.GetJobDetail(s.ctx, s.req)
  31. if err != nil {
  32. logrus.Errorf("[GetJobDetail] call Show err:%+v\n", err)
  33. util.HandlerPackErrorResp(s.resp, consts.ErrorInternal, "")
  34. logrus.Info("GetJobDetail fail,req:%+v", s.req)
  35. return
  36. }
  37. s.resp.Message = "成功查询岗位"
  38. s.resp.Data = res
  39. }
  40. func (s JobDetailHandler) checkParam() error {
  41. return nil
  42. }
  43. func newJobDetail(ctx *gin.Context) *JobDetailHandler {
  44. return &JobDetailHandler{
  45. ctx: ctx,
  46. req: http_model.NewJobDetailRequest(),
  47. resp: http_model.NewJobDetailResponse(),
  48. }
  49. }