1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package logic
- import (
- "app.yhyue.com/moapp/jybase/common"
- "context"
- "github.com/gogf/gf/v2/util/gconv"
- "jyBXSubscribe/rpc/type/bxsubscribe"
- "strings"
- "jyBXSubscribe/api/internal/svc"
- "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, " ", ",")
- }
- 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,
- })
- 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
- }
|