get_contact_info.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 WrapGetContactInfoHandler(ctx *gin.Context) {
  12. handler := newGetContactInfoHandler(ctx)
  13. baseRun(handler)
  14. }
  15. func newGetContactInfoHandler(ctx *gin.Context) *GetContactInfoHandler {
  16. return &GetContactInfoHandler{
  17. req: http_model.NewGetContactInfoRequest(),
  18. resp: http_model.NewGetContactInfoResponse(),
  19. ctx: ctx,
  20. }
  21. }
  22. type GetContactInfoHandler struct {
  23. req *http_model.GetContactInfoRequest
  24. resp *http_model.CommonResponse
  25. ctx *gin.Context
  26. }
  27. func (h *GetContactInfoHandler) getRequest() interface{} {
  28. return h.req
  29. }
  30. func (h *GetContactInfoHandler) getContext() *gin.Context {
  31. return h.ctx
  32. }
  33. func (h *GetContactInfoHandler) getResponse() interface{} {
  34. return h.resp
  35. }
  36. func (h *GetContactInfoHandler) run() {
  37. data, err := service.Enterprise.GetEnterpriseContactInfo(h.ctx, h.req)
  38. if err != nil {
  39. logrus.Errorf("[FindSubAccountByEnterpriseId] call SetSession err:%+v\n", err)
  40. util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
  41. log.Info("FindSubAccountByEnterpriseId fail,req:%+v", h.req)
  42. h.resp.Message = err.Error()
  43. h.resp.Status = 40000
  44. return
  45. }
  46. h.resp.Data = data
  47. h.resp.Status = 20000
  48. h.resp.Message = "ok"
  49. }
  50. func (h *GetContactInfoHandler) checkParam() error {
  51. return nil
  52. }