1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- package logic
- import (
- "context"
- "github.com/zeromicro/go-zero/core/logx"
- IC "jyBXSubscribe/rpc/init"
- "jyBXSubscribe/rpc/internal/svc"
- "jyBXSubscribe/rpc/model"
- "jyBXSubscribe/rpc/type/bxsubscribe"
- )
- type GetSubListLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetSubListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubListLogic {
- return &GetSubListLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- // 获取订阅推送列表
- func (l *GetSubListLogic) GetSubList(in *bxsubscribe.SubscribeInfosReq) (*bxsubscribe.SubscribeInfosResp, error) {
- //1、推送信息已读标识
- //超级订阅 i_apppushunread=0
- //大会员 i_member_apppushunread=0
- //商机管理 i_entniche_apppushunread=0
- if in.PageNum == 1 {
- go model.UpdateUserPushUnread(in.UserId, in.UserType)
- }
- spqp := &model.SubPushQueryParam{
- Mgo_bidding: IC.MgoBidding, //mongo
- Bidding: IC.DB.Mongo.Bidding.Collection, //招标信息 表
- Bidding_back: IC.DB.Mongo.Bidding.CollectionBack, //招标信息备份数据 表名
- UserId: in.UserId, //用户id
- PageNum: int(in.PageNum), //当前页码
- PageSize: int(in.PageSize), //每页多少条数据
- SelectTime: in.SelectTime, //时间跨度
- Area: in.Area, //省份
- City: in.City, //城市
- Buyerclass: in.BuyerClass, //采购单位类型
- Subtype: in.Subtype, //信息类型
- Subscopeclass: in.Industry, //行业
- Key: in.KeyWords, //关键词
- Price: in.Price, //价格区间
- FileExists: in.FileExists, //是否有附件
- EntId: in.EntId, //商机管理企业id
- EntUserId: in.EntUserId, //商机管理用户id
- DeptId: in.DeptId, //商机管理部门id
- NewUserId: in.NewUserId,
- BaseServiceMysql: IC.BaseServiceMysql,
- }
- /* if in.UserType == "mType" {
- spqp.BaseServiceMysql = IC.MemberPushMysql
- } else if in.UserType == "eType" {
- spqp.BaseServiceMysql = IC.EntnichePushMysql
- } else {
- spqp.BaseServiceMysql = IC.PushMysql
- }*/
- //hasNextPage, total, list := false, int64(0), []*bxsubscribe.SubscribeInfo{}
- hasNextPage, total, list := model.NewSubscribePush(in.UserType).Datas(spqp)
- /*
- *无推送记录生成推送记录
- *免费用户默认推送50条
- *大会员、新版商机管理、超级订阅用户 默认推送1000条记录
- */
- if in.PageNum == 1 && spqp.IsEmpty() && len(list) == 0 {
- hasNextPage, total, list = model.NewSubscribePush(in.UserType).DefaultDatas(spqp)
- }
- //查询是否收藏
- model.NewSubscribePush(in.UserType).MakeCollection(in.UserId, list)
- return &bxsubscribe.SubscribeInfosResp{
- Data: &bxsubscribe.SubscribeData{
- List: list,
- Count: total,
- HasNextPage: hasNextPage,
- },
- }, nil
- }
|