platform_acc_info.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 WrapPlatformAccInfoHandler(ctx *gin.Context) {
  11. handler := newPlatformAccInfo(ctx)
  12. BaseRun(handler)
  13. }
  14. func newPlatformAccInfo(ctx *gin.Context) *PlatformAccInfo {
  15. return &PlatformAccInfo{
  16. req: http_model.NewPlatformAccInfoRequest(),
  17. resp: http_model.NewPlatformAccInfoResponse(),
  18. ctx: ctx,
  19. }
  20. }
  21. type PlatformAccInfo struct {
  22. req *http_model.PlatformAccInfoRequest
  23. resp *http_model.CommonResponse
  24. ctx *gin.Context
  25. }
  26. func (p PlatformAccInfo) getContext() *gin.Context {
  27. return p.ctx
  28. }
  29. func (p PlatformAccInfo) getResponse() interface{} {
  30. return p.resp
  31. }
  32. func (p PlatformAccInfo) getRequest() interface{} {
  33. return p.req
  34. }
  35. func (p PlatformAccInfo) run() {
  36. data, err := db.PlatformAccInfo(p.ctx, p.req.TalentId)
  37. if err != nil {
  38. // 数据库查询失败,返回5001
  39. logrus.Errorf("[PlatformAccInfoHandler] call PlatformAccInfo err:%+v\n", err)
  40. util.HandlerPackErrorResp(p.resp, consts.ErrorInternal, "")
  41. logrus.Info("PlatformAccInfoHandler fail,req:%+v", p.req)
  42. return
  43. }
  44. p.resp.Data = data
  45. }
  46. func (p PlatformAccInfo) checkParam() error {
  47. return nil
  48. }