getsubinfologic.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package logic
  2. import (
  3. "context"
  4. "jyBXSubscribe/rpc/util"
  5. "log"
  6. "jyBXSubscribe/rpc/internal/svc"
  7. "jyBXSubscribe/rpc/type/bxsubscribe"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. IC "jyBXSubscribe/rpc/init"
  10. )
  11. type GetSubInfoLogic struct {
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. logx.Logger
  15. }
  16. func NewGetSubInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSubInfoLogic {
  17. return &GetSubInfoLogic{
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. Logger: logx.WithContext(ctx),
  21. }
  22. }
  23. // 获取订阅推送信息
  24. func (l *GetSubInfoLogic) GetSubInfo(in *bxsubscribe.SubscribeInfosReq) (*bxsubscribe.SubscribeInfosResp, error) {
  25. log.Println("in:", in)
  26. //1、推送信息已读标识
  27. //超级订阅 i_apppushunread=0
  28. //大会员 i_member_apppushunread=0
  29. //商机管理 i_entniche_apppushunread=0
  30. spqp := &util.SubPushQueryParam{
  31. Mgo_bidding: IC.MgoBidding, //mongo
  32. Bidding: IC.C.MongoDB.Bidding.Collection, //招标信息 表
  33. Bidding_back: IC.C.MongoDB.Bidding.CollectionChange, //招标信息备份数据 表名
  34. UserId: in.UserId, //用户id
  35. PageNum: int(in.PageNum), //当前页码
  36. PageSize: int(in.PageSize), //每页多少条数据
  37. SelectTime: in.SelectTime, //时间跨度
  38. Area: in.Area, //省份
  39. City: in.City, //城市
  40. Buyerclass: in.BuyerClass, //采购单位类型
  41. Subtype: in.Subtype, //信息类型
  42. Subscopeclass: in.Industry, //行业
  43. Key: in.KeyWords,
  44. }
  45. if in.UserType == "mType" {
  46. spqp.PushMysql = IC.MemberPushMysql
  47. } else if in.UserType == "eType" {
  48. spqp.PushMysql = IC.EntnichePushMysql
  49. } else {
  50. spqp.PushMysql = IC.PushMysql
  51. }
  52. hasNextPage, total, list := util.NewSubscribePush(in.UserType).Datas(spqp)
  53. return &bxsubscribe.SubscribeInfosResp{
  54. Data: &bxsubscribe.SubscribeData{
  55. List: list,
  56. Count: total,
  57. HasNextPage: hasNextPage,
  58. },
  59. }, nil
  60. }