talent_list.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package handler
  2. import (
  3. "fmt"
  4. "github.com/gin-gonic/gin"
  5. "youngee_b_api/model/http_model"
  6. "youngee_b_api/service"
  7. )
  8. func WrapTalentListHandler(ctx *gin.Context) {
  9. handler := newTalentListHandler(ctx)
  10. baseRun(handler)
  11. }
  12. func newTalentListHandler(ctx *gin.Context) *TalentListHandler {
  13. return &TalentListHandler{
  14. req: http_model.NewTalentListRequest(),
  15. resp: http_model.NewTalentListResponse(),
  16. ctx: ctx,
  17. }
  18. }
  19. type TalentListHandler struct {
  20. req *http_model.TalentListRequest
  21. resp *http_model.CommonResponse
  22. ctx *gin.Context
  23. }
  24. func (h *TalentListHandler) getRequest() interface{} {
  25. return h.req
  26. }
  27. func (h *TalentListHandler) getContext() *gin.Context {
  28. return h.ctx
  29. }
  30. func (h *TalentListHandler) getResponse() interface{} {
  31. return h.resp
  32. }
  33. func (h *TalentListHandler) run() {
  34. talentListData, err := service.STCooperate.GetTalentListInfo(h.ctx, h.req)
  35. if err != nil {
  36. h.resp.Message = "查询失败"
  37. h.resp.Data = err
  38. fmt.Println(err)
  39. }
  40. h.resp.Message = "成功查询达人合作信息"
  41. h.resp.Data = talentListData
  42. }
  43. func (h *TalentListHandler) checkParam() error {
  44. return nil
  45. }