|
@@ -146,11 +146,7 @@ class AgentApply extends Base
|
|
|
// 防止循环绑定:检查目标上级是否已经是当前用户的下级
|
|
|
if ($this->isUserInDownline($user->id, $parentAgent->user_id)) {
|
|
|
$this->error('不能绑定下级用户为上级');
|
|
|
- }
|
|
|
- // 更新用户的上级关系
|
|
|
- $user->parent_user_id = $parentAgent->user_id;
|
|
|
- $user->bind_time = time();
|
|
|
- $user->save();
|
|
|
+ }
|
|
|
|
|
|
// 从请求头获取platform参数(与生成二维码接口保持一致)
|
|
|
$requestPlatform = $this->request->header('platform', '');
|
|
@@ -178,7 +174,8 @@ class AgentApply extends Base
|
|
|
$fromPlatformId // from: 从请求头获取
|
|
|
);
|
|
|
|
|
|
- // 添加分享记录
|
|
|
+ // 添加分享记录,触发 user_share_after 钩子
|
|
|
+ // 钩子会自动处理:1.绑定上级关系 2.添加推广日志 3.触发团队统计更新
|
|
|
$shareParams = [
|
|
|
'spm' => $spmParams,
|
|
|
'shareId' => $parentAgent->user_id,
|