infolistlogic.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyInfo/rpc/manager/managerinfo"
  4. "context"
  5. "app.yhyue.com/moapp/jybase/common"
  6. "app.yhyue.com/moapp/jyInfo/api/internal/svc"
  7. "app.yhyue.com/moapp/jyInfo/api/internal/types"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type InfoListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewInfoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *InfoListLogic {
  16. return &InfoListLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *InfoListLogic) InfoList(req *types.InfoListReq) (resp *types.CommonRes, err error) {
  23. infolist, err0 := l.svcCtx.Manager.InfoList(l.ctx, &managerinfo.InfoListReq{
  24. Phone: req.Phone,
  25. MsgType: common.Int64All(req.MsgType),
  26. PhoneType: common.Int64All(req.PhoneType),
  27. ReviewStatus: common.Int64All(req.ReviewStatus),
  28. ApplyStartTime: req.ApplyStartTime,
  29. ApplyEndTime: req.ApplyEndTime,
  30. PageSize: req.PageSize,
  31. PageIndex: req.PageIndex,
  32. IsDel: common.Int64All(req.IsDel),
  33. Published: common.Int64All(req.Published),
  34. JyPublishingMedia: req.JyPublishingMedia,
  35. RecommendedService: req.RecommendedService,
  36. })
  37. if err0 != nil {
  38. return &types.CommonRes{
  39. Err_code: -1,
  40. Err_msg: "错误",
  41. Data: nil,
  42. }, nil
  43. }
  44. return &types.CommonRes{
  45. Err_code: common.IntAll(infolist.ErrCode),
  46. Err_msg: infolist.ErrMsg,
  47. Data: infolist.Data,
  48. }, nil
  49. }