useridentitylogic.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package logic
  2. import (
  3. "context"
  4. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
  5. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
  6. "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
  7. . "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/usercenter"
  8. "github.com/zeromicro/go-zero/core/logx"
  9. )
  10. type UserIdentityLogic struct {
  11. logx.Logger
  12. ctx context.Context
  13. svcCtx *svc.ServiceContext
  14. }
  15. func NewUserIdentityLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserIdentityLogic {
  16. return &UserIdentityLogic{
  17. Logger: logx.WithContext(ctx),
  18. ctx: ctx,
  19. svcCtx: svcCtx,
  20. }
  21. }
  22. func (l *UserIdentityLogic) UserIdentity(req *types.UserIdentityReq) (resp *types.Resp, err error) {
  23. res, err := entity.UserCenterRpc.UserIdentity(l.ctx, &UserIdentityReq{
  24. AppId: req.AppId,
  25. EntId: req.EntId,
  26. BaseUserId: req.NewUserId,
  27. })
  28. status := 0
  29. if res != nil && res.ErrorMsg == "" {
  30. status = 1
  31. }
  32. return &types.Resp{
  33. Error_code: res.ErrorCode,
  34. Error_msg: res.ErrorMsg,
  35. Data: map[string]interface{}{
  36. "personId": res.PersonId,
  37. "userName": res.UserName,
  38. "userAccountId": res.UserAccountId,
  39. "entAccountId": res.EntAccountId,
  40. "entUserAccountId": res.EntUserAccountId,
  41. "userPositionId": res.UserPositionId,
  42. "entUserPositionId": res.EntUserPositionId,
  43. "status": status,
  44. },
  45. }, err
  46. }