123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- package logic
- import (
- "context"
- "jyBXSubscribe/rpc/util"
- "log"
- "jyBXSubscribe/rpc/internal/svc"
- "jyBXSubscribe/rpc/type/bxsubscribe"
- "github.com/zeromicro/go-zero/core/logx"
- IC "jyBXSubscribe/rpc/init"
- )
- type GetSubInfoLogic struct {
- ctx context.Context
- svcCtx *svc.ServiceContext
- logx.Logger
- }
- func NewGetSubInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubInfoLogic {
- return &GetSubInfoLogic{
- ctx: ctx,
- svcCtx: svcCtx,
- Logger: logx.WithContext(ctx),
- }
- }
- // 获取订阅推送信息
- func (l *GetSubInfoLogic) GetSubInfo(in *bxsubscribe.SubscribeInfosReq) (*bxsubscribe.SubscribeInfosResp, error) {
- log.Println("in:", in)
- //1、推送信息已读标识
- //超级订阅 i_apppushunread=0
- //大会员 i_member_apppushunread=0
- //商机管理 i_entniche_apppushunread=0
- if in.PageNum == 1 {
- go util.UpdateUserPushUnread(in.UserId, in.UserType)
- }
- spqp := &util.SubPushQueryParam{
- Mgo_bidding: IC.MgoBidding, //mongo
- Bidding: IC.C.MongoDB.Bidding.Collection, //招标信息 表
- Bidding_back: IC.C.MongoDB.Bidding.CollectionChange, //招标信息备份数据 表名
- 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,
- }
- if in.UserType == "mType" {
- spqp.PushMysql = IC.MemberPushMysql
- } else if in.UserType == "eType" {
- spqp.PushMysql = IC.EntnichePushMysql
- } else {
- spqp.PushMysql = IC.PushMysql
- }
- hasNextPage, total, list := util.NewSubscribePush(in.UserType).Datas(spqp)
- //查询是否收藏
- util.NewSubscribePush(in.UserType).MakeCollection(in.UserId, list)
- return &bxsubscribe.SubscribeInfosResp{
- Data: &bxsubscribe.SubscribeData{
- List: list,
- Count: total,
- HasNextPage: hasNextPage,
- },
- }, nil
- }
|