|
|
|
@ -58,7 +58,7 @@ class AdminAgentTeam extends BaseController |
|
|
|
} |
|
|
|
|
|
|
|
# 查询用户列表 |
|
|
|
$field = 'id,aid,phone,avatar,balance,withdrawal_balance,status,rate'; |
|
|
|
$field = 'id,aid,phone,avatar,balance,withdrawal_balance,status'; |
|
|
|
$userRes = $UserModel->field($field)->where($where)->order('id desc')->paginate($limit); |
|
|
|
|
|
|
|
$list = $userRes->items(); |
|
|
|
@ -73,7 +73,6 @@ class AdminAgentTeam extends BaseController |
|
|
|
$rebate_ratio = $AgentInfo->where('aid',$item['id'])->value('rebate_ratio'); |
|
|
|
$item['rebate_ratio'] = $rebate_ratio ? round($rebate_ratio * 100,2) : '0'; |
|
|
|
$item['grade'] = empty($item['aid']) ? '1级' : 'id:' . $item['aid']; |
|
|
|
$item['rate'] = round($item['rate'] * 100,2); |
|
|
|
unset($item['aid']); |
|
|
|
} |
|
|
|
|
|
|
|
@ -176,15 +175,11 @@ class AdminAgentTeam extends BaseController |
|
|
|
'aid|代理id' => 'require|number', |
|
|
|
'password|密码' => 'min:6|max:20', |
|
|
|
'rebate_ratio|返点占比' => 'float|between:0.01,100', |
|
|
|
'rate|中奖比率' => 'float|between:0.01,100', |
|
|
|
])->check($param); |
|
|
|
$password = $param['password'] ?? ''; |
|
|
|
$param['rebate_ratio'] = $param['rebate_ratio'] ?? ''; |
|
|
|
$rebate_ratio = (string) $param['rebate_ratio']; |
|
|
|
$param['rate'] = $param['rate'] ?? ''; |
|
|
|
$rate = (string) $param['rate']; |
|
|
|
if (empty($password) && strlen($rebate_ratio) <= 0 && strlen($rate) <= 0) { |
|
|
|
throw new ValidateException('请填写至少一项修改'); |
|
|
|
$rebate_ratio = (string) $param['rebate_ratio'] ?? ''; |
|
|
|
if (empty($password) && strlen($rebate_ratio) <= 0) { |
|
|
|
throw new ValidateException('请填写修改的密码或返点占比'); |
|
|
|
} |
|
|
|
|
|
|
|
# 开启事务 |
|
|
|
@ -210,10 +205,6 @@ class AdminAgentTeam extends BaseController |
|
|
|
if ($validateAgentRebateRatio !== true) throw new ValidateException($validateAgentRebateRatio); |
|
|
|
AgentInfo::updateRebateRatio($param['aid'],$rebate_ratio); |
|
|
|
} |
|
|
|
# 保存占比 |
|
|
|
if (!empty($rate)) { |
|
|
|
User::saveRate($param['aid'],$rate); |
|
|
|
} |
|
|
|
|
|
|
|
$connection->commit(); |
|
|
|
return $this->renderSuccess('成功'); |
|
|
|
|