setreadlogic.go 1.6 KB

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