|
@@ -127,6 +127,12 @@ class AgentApply extends Base
|
|
$this->error('邀请码无效或代理商状态异常');
|
|
$this->error('邀请码无效或代理商状态异常');
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 获取上级用户信息
|
|
|
|
+ $parentUser = UserModel::find($parentAgent->user_id);
|
|
|
|
+ if (!$parentUser) {
|
|
|
|
+ $this->error('上级用户不存在');
|
|
|
|
+ }
|
|
|
|
+
|
|
// 不能绑定自己
|
|
// 不能绑定自己
|
|
if ($parentAgent->user_id == $user->id) {
|
|
if ($parentAgent->user_id == $user->id) {
|
|
$this->error('不能绑定自己为上级');
|
|
$this->error('不能绑定自己为上级');
|
|
@@ -135,7 +141,7 @@ class AgentApply extends Base
|
|
// 检查是否已经有上级了
|
|
// 检查是否已经有上级了
|
|
if (!empty($user->parent_user_id)) {
|
|
if (!empty($user->parent_user_id)) {
|
|
$this->error('您已经有上级了,无法重复绑定');
|
|
$this->error('您已经有上级了,无法重复绑定');
|
|
- }
|
|
|
|
|
|
+ }
|
|
// 更新用户的上级关系
|
|
// 更新用户的上级关系
|
|
$user->parent_user_id = $parentAgent->user_id;
|
|
$user->parent_user_id = $parentAgent->user_id;
|
|
$user->save();
|
|
$user->save();
|
|
@@ -211,4 +217,5 @@ class AgentApply extends Base
|
|
return $channelToShareMap[$channelPlatform] ?? ShareEnum::PLATFORM_WECHAT_MINI_PROGRAM;
|
|
return $channelToShareMap[$channelPlatform] ?? ShareEnum::PLATFORM_WECHAT_MINI_PROGRAM;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|