setuserlogic.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package logic
  2. import (
  3. "context"
  4. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/model/service"
  5. "github.com/zeromicro/go-zero/core/logx"
  6. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/jyBXSubscribe/rpc/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/jyMicroservices/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, msg := subService.SetUser(in.Mail)
  31. if fool {
  32. return &bxsubscribe.StatusResp{
  33. ErrorCode: 0,
  34. }, nil
  35. } else {
  36. return &bxsubscribe.StatusResp{
  37. ErrorCode: -1,
  38. ErrorMsg: msg,
  39. }, nil
  40. }
  41. }