getclueinfolistlogic.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package logic
  2. import (
  3. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
  4. "bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
  5. "bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
  6. "context"
  7. "github.com/gogf/gf/v2/util/gconv"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type GetClueInfoListLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. // 线索验重 列表
  16. func NewGetClueInfoListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetClueInfoListLogic {
  17. return &GetClueInfoListLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GetClueInfoListLogic) GetClueInfoList(req *types.ClueInfoReq) (resp *types.BiResp, err error) {
  24. if req.SearchTxt == "" {
  25. return &types.BiResp{
  26. Error_code: 0,
  27. Error_msg: "搜索字段不能为空",
  28. Data: nil,
  29. }, nil
  30. }
  31. res, err := l.svcCtx.BiServiceRpc.GetClueInfoList(l.ctx, &biservice.ClueInfoReq{
  32. SearchTxt: req.SearchTxt,
  33. SearchType: req.SearchType,
  34. PageSize: req.PageSize,
  35. PageNum: req.PageNum,
  36. })
  37. if err != nil || res.Data == nil {
  38. return &types.BiResp{
  39. Error_code: -1,
  40. Error_msg: "严重错误!",
  41. }, err
  42. }
  43. data := gconv.Map(gconv.UnsafeBytesToStr(res.Data))
  44. return &types.BiResp{Data: data}, err
  45. }