infolistlogic.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package logic
  2. import (
  3. "app.yhyue.com/moapp/jyInfo/rpc/manager/managerclient"
  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, &managerclient.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. })
  35. if err0 != nil {
  36. return &types.CommonRes{
  37. Err_code: -1,
  38. Err_msg: "错误",
  39. Data: nil,
  40. }, nil
  41. }
  42. return &types.CommonRes{
  43. Err_code: common.IntAll(infolist.ErrCode),
  44. Err_msg: infolist.ErrMsg,
  45. Data: infolist.Data,
  46. }, nil
  47. }