sub_account_detail.go 1.3 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 WrapSubAccountDetailHandler(ctx *gin.Context) {
  11. handler := newSubAccountDetail(ctx)
  12. BaseRun(handler)
  13. }
  14. type SubAccountDetailHandler struct {
  15. ctx *gin.Context
  16. req *http_model.SubAccountDetailRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (s SubAccountDetailHandler) getContext() *gin.Context {
  20. return s.ctx
  21. }
  22. func (s SubAccountDetailHandler) getResponse() interface{} {
  23. return s.resp
  24. }
  25. func (s SubAccountDetailHandler) getRequest() interface{} {
  26. return s.req
  27. }
  28. func (s SubAccountDetailHandler) run() {
  29. //enterpriseID := middleware.GetSessionAuth(s.ctx).EnterpriseID
  30. res, err := db.GetSubAccountDetail(s.ctx, s.req)
  31. if err != nil {
  32. logrus.Errorf("[GetSubAccountDetail] call Show err:%+v\n", err)
  33. util.HandlerPackErrorResp(s.resp, consts.ErrorInternal, "")
  34. logrus.Info("GetSubAccountDetail fail,req:%+v", s.req)
  35. return
  36. }
  37. s.resp.Data = res
  38. }
  39. func (s SubAccountDetailHandler) checkParam() error {
  40. return nil
  41. }
  42. func newSubAccountDetail(ctx *gin.Context) *SubAccountDetailHandler {
  43. return &SubAccountDetailHandler{
  44. ctx: ctx,
  45. req: http_model.NewSubAccountDetailRequest(),
  46. resp: http_model.NewSubAccountDetailResponse(),
  47. }
  48. }