setuserlogic.go 971 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package logic
  2. import (
  3. "context"
  4. "jyBXSubscribe/rpc/model/service"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. "jyBXSubscribe/rpc/internal/svc"
  7. "jyBXSubscribe/rpc/type/bxsubscribe"
  8. )
  9. type SetUserLogic struct {
  10. ctx context.Context
  11. svcCtx *svc.ServiceContext
  12. logx.Logger
  13. }
  14. func NewSetUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SetUserLogic {
  15. return &SetUserLogic{
  16. ctx: ctx,
  17. svcCtx: svcCtx,
  18. Logger: logx.WithContext(ctx),
  19. }
  20. }
  21. // 用户邮箱保存
  22. func (l *SetUserLogic) SetUser(in *bxsubscribe.SetUserInfoReq) (*bxsubscribe.StatusResp, error) {
  23. // todo: add your logic here and delete this line
  24. subService := &service.PushSetService{
  25. UserId: in.UserId,
  26. PositionType: in.PositionType,
  27. EntUserId: in.EntUserId,
  28. EntId: in.EntId,
  29. }
  30. fool := subService.SetUser(in.Mail)
  31. if fool {
  32. return &bxsubscribe.StatusResp{
  33. Status: 1,
  34. }, nil
  35. } else {
  36. return &bxsubscribe.StatusResp{
  37. Status: 0,
  38. }, nil
  39. }
  40. }