Browse Source

fix:agent

super-yimizi 8 hours ago
parent
commit
d5fd9d2d82

+ 4 - 0
application/admin/view/commission/agent/detail.html

@@ -112,6 +112,10 @@
                                     {/if}
                                 </td>
                             </tr>
+                            <tr>
+                                <td>邀请码</td>
+                                <td>{$row.invite_code|default='-'}</td>
+                            </tr>
                         </table>
                     </div>
                 </div>

+ 3 - 6
application/api/controller/commission/AgentApply.php

@@ -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,