setreadlogic.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. userType := in.UserType
  28. infoCount := int64(0)
  29. if in.UserType == model.MemberFlag {
  30. infoCount = IC.MainMysql.CountBySql("select count(id) from entniche_wait_empower where ent_id=? and end_time>NOW() and product_type like '%大会员%' ", in.EntId)
  31. } else if in.UserType == model.SubVipFlag {
  32. 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)
  33. }
  34. if infoCount > 0 {
  35. in.UserType = model.EntnicheFlag
  36. }
  37. model.NewSubscribePush(in.UserType).SetRead(in.NewUserId, in.Vsid, in.UserId, in.EntUserId, in.EntId, in.IsEnt, userType)
  38. return resp, nil
  39. }