assesslistlogic.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/rpc/pb"
  6. "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/api/internal/svc"
  7. "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/api/internal/types"
  8. . "bp.jydev.jianyu360.cn/ApplicationCenter/threeMarket/public/service"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type AssessListLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewAssessListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *AssessListLogic {
  17. return &AssessListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *AssessListLogic) AssessList(req *types.AssessListReq) (resp *types.Reply, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Reply{}
  26. threeMarketResp, err := ThreemarketRpc.AssessList(l.ctx, &pb.AssessListReq{
  27. Appid: req.AppId,
  28. GoodsCode: req.Goods_code,
  29. Impression: req.Impression,
  30. PageSize: req.Page_size,
  31. PageNum: req.Page_num,
  32. })
  33. if threeMarketResp.ErrorMsg != "" {
  34. resp.Error_msg = threeMarketResp.ErrorMsg
  35. resp.Error_code = -1
  36. l.Error(fmt.Sprintf("%+v", req), resp.Error_msg)
  37. }
  38. resp.Data = map[string]interface{}{
  39. "count": threeMarketResp.Count,
  40. "access": threeMarketResp.Assess,
  41. "list": threeMarketResp.Data,
  42. }
  43. return
  44. }