getuserinfologic.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package logic
  2. import (
  3. "context"
  4. "fmt"
  5. "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
  6. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
  7. "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
  8. "bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
  9. "github.com/zeromicro/go-zero/core/logx"
  10. )
  11. type GetUserInfoLogic struct {
  12. logx.Logger
  13. ctx context.Context
  14. svcCtx *svc.ServiceContext
  15. }
  16. func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic {
  17. return &GetUserInfoLogic{
  18. Logger: logx.WithContext(ctx),
  19. ctx: ctx,
  20. svcCtx: svcCtx,
  21. }
  22. }
  23. func (l *GetUserInfoLogic) GetUserInfo(req *types.UserReq) (resp *types.Resp, err error) {
  24. // todo: add your logic here and delete this line
  25. resp = &types.Resp{}
  26. res, err := entity.UserCenterRpc.GetUserInfo(l.ctx, &pb.UserReq{
  27. AppId: req.AppId,
  28. UserId: req.UserId,
  29. Types: req.Types,
  30. })
  31. if res.ErrorMsg != "" {
  32. resp.Error_msg = res.ErrorMsg
  33. resp.Error_code = -1
  34. l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg)
  35. }
  36. data := map[string]interface{}{
  37. "start_time": res.Data.StartTime,
  38. "end_time": res.Data.EndTime,
  39. "area": res.Data.Area,
  40. "matchway": res.Data.Matchway,
  41. "items": res.Data.Items,
  42. "projectmatch": res.Data.Projectmatch,
  43. "infotype": res.Data.Infotype,
  44. "types": res.SubscribeType, //订阅设置类型 f:免费订阅 v:超级订阅 m:大会员订阅 e:商机管理订阅
  45. "vip_status": res.VipStatus,
  46. "member_status": res.MemberStatus,
  47. "entniche_status": res.EntnicheStatus,
  48. "phone": res.Phone,
  49. }
  50. resp.Data = data
  51. return
  52. }