fix: 修复顶级代理(agent_parent_id=0)无法编辑保存(总账号给一级代理改参数报'上级错误')
do_edit 原逻辑 parent_id<=0 直接 die(parent_error),且后续全程访问 agentParent 做封顶校验, 导致顶级代理(一级总代)永远无法编辑保存。改为:顶级代理构造不设限虚拟上级, 封顶校验自动放行,封底校验(不得低于下级最高费率)与写入逻辑保持不变。对非顶级代理零影响。
This commit is contained in:
@@ -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']]));
|
||||
|
||||
Reference in New Issue
Block a user