setreadlogic.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package logic
  2. import (
  3. "context"
  4. IC "jyBXSubscribe/rpc/init"
  5. "jyBXSubscribe/rpc/model"
  6. "jyBXSubscribe/rpc/internal/svc"
  7. "jyBXSubscribe/rpc/type/bxsubscribe"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type SetReadLogic struct {
  11. ctx context.Context
  12. svcCtx *svc.ServiceContext
  13. logx.Logger
  14. }
  15. func NewSetReadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetReadLogic {
  16. return &SetReadLogic{
  17. ctx: ctx,
  18. svcCtx: svcCtx,
  19. Logger: logx.WithContext(ctx),
  20. }
  21. }
  22. // 推送数据浏览状态修改
  23. func (l *SetReadLogic) SetRead(in *bxsubscribe.SetReadReq) (*bxsubscribe.StatusResp, error) {
  24. // todo: add your logic here and delete this line
  25. resp := &bxsubscribe.StatusResp{}
  26. //主体处理(fType:普通用户;vType:超级订阅用户;mType:大会员用户;eType:商机管理用户)
  27. if in.UserType == "vType" || in.UserType == "mType" {
  28. infoCount := IC.MainMysql.CountBySql("select count(id) from entniche_wait_empower where ent_id=? and end_time>NOW() and product_type like '%超级订阅%' or product_type like '大会员' ", in.EntId)
  29. if infoCount > 0 {
  30. in.UserType = "eType"
  31. }
  32. }
  33. model.NewSubscribePush(in.UserType).SetRead(in.NewUserId, in.GetVsid(), in.UserId, in.EntUserId, in.EntId, in.IsEnt)
  34. return resp, nil
  35. }