update_contact_info.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 WrapUpdateContactInfoHandler(ctx *gin.Context) {
  12. handler := newUpdateContactInfoHandler(ctx)
  13. baseRun(handler)
  14. }
  15. func newUpdateContactInfoHandler(ctx *gin.Context) *UpdateContactInfoHandler {
  16. return &UpdateContactInfoHandler{
  17. req: http_model.NewUpdateContactInfoRequest(),
  18. resp: http_model.NewUpdateContactInfoResponse(),
  19. ctx: ctx,
  20. }
  21. }
  22. type UpdateContactInfoHandler struct {
  23. req *http_model.UpdateContactInfoRequest
  24. resp *http_model.CommonResponse
  25. ctx *gin.Context
  26. }
  27. func (h *UpdateContactInfoHandler) getRequest() interface{} {
  28. return h.req
  29. }
  30. func (h *UpdateContactInfoHandler) getContext() *gin.Context {
  31. return h.ctx
  32. }
  33. func (h *UpdateContactInfoHandler) getResponse() interface{} {
  34. return h.resp
  35. }
  36. func (h *UpdateContactInfoHandler) run() {
  37. data, tag, err := service.LoginAuth.UpdateEnterpriseContactInfo(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. if tag == true && data == nil {
  47. h.resp.Message = "验证码校验错误"
  48. h.resp.Status = 34000
  49. return
  50. }
  51. h.resp.Data = data
  52. h.resp.Status = 20000
  53. h.resp.Message = "ok"
  54. }
  55. func (h *UpdateContactInfoHandler) checkParam() error {
  56. return nil
  57. }