package logic import ( "context" "fmt" "bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb" "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc" "bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types" "bp.jydev.jianyu360.cn/BaseService/userCenter/entity" "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/encrypt" "github.com/zeromicro/go-zero/core/logx" ) type GetUserInfoLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } func NewGetUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetUserInfoLogic { return &GetUserInfoLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } func (l *GetUserInfoLogic) GetUserInfo(req *types.UserReq) (resp *types.Resp, err error) { // todo: add your logic here and delete this line resp = &types.Resp{} userId := int64(req.UserId) if req.Uid != "" { //解密userid decode_userid := encrypt.SE.Decode4Hex(req.Uid) userId = common.Int64All(decode_userid) } res, err := entity.UserCenterRpc.GetUserInfo(l.ctx, &pb.UserReq{ AppId: req.AppId, UserId: userId, Types: req.Types, }) if err != nil || res == nil { resp.Error_msg = "" resp.Error_code = -1 l.Error("get user info error:", err) return } if res.ErrorMsg != "" { resp.Error_msg = res.ErrorMsg resp.Error_code = -1 l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg) } else { data := map[string]interface{}{ "isTourist": res.IsTourist, "nickname": res.Nickname, "headimg": res.Headimg, } if res.IsTourist < 2 && res.Data != nil { data = map[string]interface{}{ "start_time": res.Data.StartTime, "end_time": res.Data.EndTime, "area": res.Data.Area, "matchway": res.Data.Matchway, "items": res.Data.Items, "projectmatch": res.Data.Projectmatch, "infotype": res.Data.Infotype, "types": res.SubscribeType, //订阅设置类型 f:免费订阅 v:超级订阅 m:大会员订阅 e:商机管理订阅 "vip_status": res.VipStatus, "member_status": res.MemberStatus, "entniche_status": res.EntnicheStatus, "phone": res.Phone, "nickname": res.Nickname, "headimg": res.Headimg, "isTourist": res.IsTourist, } } resp.Data = data } return }