|
|
@@ -334,6 +334,47 @@ func InviteUrl(c *gin.Context) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// ParentInfo |
|
|
|
// @Summary 导师信息 |
|
|
|
// @Tags 会员中心 |
|
|
|
// @Description 导师信息 |
|
|
|
// @Accept json |
|
|
|
// @Produce json |
|
|
|
// @Success 200 {object} md.ParentInfo "登录成功返回" |
|
|
|
// @Failure 400 {object} md.Response "具体错误" |
|
|
|
// @Router /api/v1/memberCenter/parentInfo [get] |
|
|
|
func ParentInfo(c *gin.Context) { |
|
|
|
ownUser := svc.GetUser(c) |
|
|
|
if ownUser.ParentUid == 0 { |
|
|
|
e.OutSuc(c, md.ParentInfo{}, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
NewUserDb := implement.NewUserDb(db.Db) |
|
|
|
user, _ := NewUserDb.GetUser(ownUser.ParentUid) |
|
|
|
// 1. 获取会员等级名称 |
|
|
|
userLevelDb := implement.NewUserLevelDb(db.Db) |
|
|
|
level, err := userLevelDb.UserLevelByID(user.Level) |
|
|
|
if err != nil { |
|
|
|
e.OutErr(c, e.ERR_DB_ORM, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
code := user.SystemInviteCode |
|
|
|
if user.CustomInviteCode != "" { |
|
|
|
code = user.CustomInviteCode |
|
|
|
} |
|
|
|
res := md.ParentInfo{ |
|
|
|
Nickname: user.Nickname, |
|
|
|
LevelName: level.LevelName, |
|
|
|
InviteCode: code, |
|
|
|
HeadImg: svc.GetOssUrl(user.Avatar), |
|
|
|
Id: utils.Int64ToStr(user.Id), |
|
|
|
Phone: user.Phone, |
|
|
|
WechatAccount: user.WechatAccount, |
|
|
|
} |
|
|
|
e.OutSuc(c, res, nil) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// Delete |
|
|
|
// @Summary 注销账号操作 |
|
|
|
// @Tags 账号与安全 |
|
|
|