From f67439bfe2db70d8321771ce4fcb7fdee873b6c2 Mon Sep 17 00:00:00 2001 From: li Date: Mon, 1 Jun 2026 23:11:33 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=A1=B6=E7=BA=A7?= =?UTF-8?q?=E4=BB=A3=E7=90=86(agent=5Fparent=5Fid=3D0)=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E4=BF=9D=E5=AD=98(=E6=80=BB=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E7=BB=99=E4=B8=80=E7=BA=A7=E4=BB=A3=E7=90=86=E6=94=B9?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=8A=A5'=E4=B8=8A=E7=BA=A7=E9=94=99?= =?UTF-8?q?=E8=AF=AF')?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit do_edit 原逻辑 parent_id<=0 直接 die(parent_error),且后续全程访问 agentParent 做封顶校验, 导致顶级代理(一级总代)永远无法编辑保存。改为:顶级代理构造不设限虚拟上级, 封顶校验自动放行,封底校验(不得低于下级最高费率)与写入逻辑保持不变。对非顶级代理零影响。 --- application/agent/controller/Agent.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/application/agent/controller/Agent.php b/application/agent/controller/Agent.php index 11ee619..6178550 100755 --- a/application/agent/controller/Agent.php +++ b/application/agent/controller/Agent.php @@ -565,12 +565,24 @@ class Agent Extends Common{ if(!$user || $user['agent'] == 0){ die(json_encode(['code'=>0,'msg'=>$lang['error_id']])); } + // 顶级代理(agent_parent_id=0)无真实上级:构造一个不设限的虚拟上级,使所有"不得高于上级"封顶校验自动放行; + // "不得低于下级"封底校验与写入逻辑保持不变(顶级代理仍受其下级最高费率约束)。 if($parent_id <= 0){ - die(json_encode(['code'=>0,'msg'=>$lang['parent_error']])); - } - $agentParent = Db::name('user')->where('id',$parent_id)->find(); - if(!$agentParent || $agentParent['agent'] == 0){ - die(json_encode(['code'=>0,'msg'=>$lang['parent_error']])); + $agentParent = [ + 'limit_low' => 0, 'limit_high' => 99999999999, + 'limit_low_tie' => 0, 'limit_high_tie' => 99999999999, + 'limit_low_pair' => 0, 'limit_high_pair' => 99999999999, + 'limit_low_nn' => 0, 'limit_high_nn' => 0, + 'agent_ximalv' => 100, 'agent_ximalv_dt' => 100, + 'agent_ximalv_nn' => 100, 'agent_ximalv_tc' => 100, + 'agent_cs' => 100, 'rebate_rate' => 100, + 'agent_parent_id' => 0, + ]; + }else{ + $agentParent = Db::name('user')->where('id',$parent_id)->find(); + if(!$agentParent || $agentParent['agent'] == 0){ + die(json_encode(['code'=>0,'msg'=>$lang['parent_error']])); + } } if(!$nickname){ die(json_encode(['code'=>0,'msg'=>$lang['empty_nickname']]));