f
This commit is contained in:
@@ -37,8 +37,8 @@ func (l *CreateWhitelistOrderLogic) CreateWhitelistOrder(req *types.CreateWhitel
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取用户信息失败, %v", err)
|
||||
}
|
||||
|
||||
// 1. 获取代理信息并验证是否为钻石代理
|
||||
agent, err := l.svcCtx.AgentModel.FindOneByUserId(l.ctx, userID)
|
||||
// 1. 获取代理信息并验证(任意等级代理均可操作白名单)
|
||||
_, err = l.svcCtx.AgentModel.FindOneByUserId(l.ctx, userID)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("您不是代理"), "")
|
||||
@@ -46,11 +46,6 @@ func (l *CreateWhitelistOrderLogic) CreateWhitelistOrder(req *types.CreateWhitel
|
||||
return nil, errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询代理信息失败, %v", err)
|
||||
}
|
||||
|
||||
// 只有钻石代理可以操作
|
||||
if agent.Level != 3 {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("只有钻石代理可以操作白名单"), "")
|
||||
}
|
||||
|
||||
// 2. 验证参数
|
||||
if req.IdCard == "" {
|
||||
return nil, errors.Wrapf(xerr.NewErrMsg("身份证号不能为空"), "")
|
||||
|
||||
@@ -38,8 +38,8 @@ func (l *OfflineFeatureLogic) OfflineFeature(req *types.OfflineFeatureReq) (resp
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// 2. 获取用户ID并验证代理权限
|
||||
userID, err := l.verifyDiamondAgent()
|
||||
// 2. 获取用户ID并验证代理权限(任意等级代理均可下架)
|
||||
userID, err := l.verifyAgent()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -90,14 +90,14 @@ func (l *OfflineFeatureLogic) validateRequest(req *types.OfflineFeatureReq) erro
|
||||
return nil
|
||||
}
|
||||
|
||||
// verifyDiamondAgent 验证是否为钻石代理并返回用户ID
|
||||
func (l *OfflineFeatureLogic) verifyDiamondAgent() (string, error) {
|
||||
// verifyAgent 验证是否为代理并返回用户ID(任意等级代理均可下架)
|
||||
func (l *OfflineFeatureLogic) verifyAgent() (string, error) {
|
||||
userID, err := ctxdata.GetUidFromCtx(l.ctx)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.SERVER_COMMON_ERROR), "获取用户信息失败, %v", err)
|
||||
}
|
||||
|
||||
agent, err := l.svcCtx.AgentModel.FindOneByUserId(l.ctx, userID)
|
||||
_, err = l.svcCtx.AgentModel.FindOneByUserId(l.ctx, userID)
|
||||
if err != nil {
|
||||
if errors.Is(err, model.ErrNotFound) {
|
||||
return "", errors.Wrapf(xerr.NewErrMsg("您不是代理"), "")
|
||||
@@ -105,10 +105,6 @@ func (l *OfflineFeatureLogic) verifyDiamondAgent() (string, error) {
|
||||
return "", errors.Wrapf(xerr.NewErrCode(xerr.DB_ERROR), "查询代理信息失败, %v", err)
|
||||
}
|
||||
|
||||
if agent.Level != 3 {
|
||||
return "", errors.Wrapf(xerr.NewErrMsg("只有钻石代理可以操作白名单下架"), "")
|
||||
}
|
||||
|
||||
return userID, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user