package logic import ( "app.yhyue.com/moapp/jybase/common" "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/type/bxsubscribe" "context" "github.com/gogf/gf/v2/util/gconv" "strings" "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/api/internal/types" "github.com/zeromicro/go-zero/core/logx" ) type ByPushHistoryLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewByPushHistoryLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ByPushHistoryLogic { return &ByPushHistoryLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *ByPushHistoryLogic) ByPushHistory(req *types.SubscribeReq) (resp *types.CommonResp, err error) { //关键词处理 //分类 matchitemsArr := []string{} matchitems := "" //关键词 matchkeysArr := []string{} matchkeys := "" for k, v := range req.Item { keyArr := gconv.Strings(v) if len(keyArr) == 0 { matchitemsArr = append(matchitemsArr, common.InterfaceToStr(k)) } else { for _, s := range keyArr { matchkeysArr = append(matchkeysArr, s) } } } if len(matchitemsArr) != 0 { matchitems = strings.Join(matchitemsArr, ",") } if len(matchkeysArr) != 0 { matchkeys = strings.Join(matchkeysArr, ",") matchkeys = strings.ReplaceAll(matchkeys, " ", ",") } if req.SelectTime == "" && req.PushTime != "" { //微信跳转过来的 按照推送时间查询导出 req.SelectTime = req.PushTime } res, err := l.svcCtx.Suscribe.ByPushHistory(l.ctx, &bxsubscribe.SubscribeInfosReq{ PageNum: req.PageNum, PageSize: req.PageSize, SelectTime: req.SelectTime, Area: req.Area, City: req.City, Industry: req.Industry, BuyerClass: req.BuyerClass, KeyWords: matchkeys, Subtype: req.Subtype, UserType: req.UserType, Price: req.Price, FileExists: req.FileExists, IsRead: req.IsRead, Source: req.Source, Staffs: req.Staffs, UserId: req.UserId, EntId: req.EntId, EntUserId: req.EntUserId, DeptId: req.DeptId, NewUserId: req.NewUserId, IsEnt: req.IsEnt, SelectIds: req.SelectIds, PositionType: req.PositionType, NotReturnCount: req.NotReturnCount, Item: matchitems, SelectKeys: req.SelectKeys, District: req.District, }) if err != nil { return &types.CommonResp{ Err_code: res.ErrorCode, Err_msg: res.ErrorMsg, Data: nil, }, nil } return &types.CommonResp{ Err_code: res.ErrorCode, Err_msg: res.ErrorMsg, Data: res.Data, }, nil return }