|
|
|
@ -9,6 +9,7 @@ use app\model\AdminUpScoresRecords; |
|
|
|
use app\model\AgentRechargeRecords; |
|
|
|
use app\model\AgentUser; |
|
|
|
use app\validate\Admin; |
|
|
|
use app\validate\Agent; |
|
|
|
use think\exception\ValidateException; |
|
|
|
use think\facade\Db; |
|
|
|
use think\facade\Request; |
|
|
|
@ -144,4 +145,48 @@ class AdminAgentTeam extends BaseController |
|
|
|
return $this->renderError($exception->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 编辑代理信息 |
|
|
|
*/ |
|
|
|
public function editUser() |
|
|
|
{ |
|
|
|
$param = Request::param(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
validate(Agent::class)->scene('edit')->check($param); |
|
|
|
|
|
|
|
$UserModel = new AgentUser(); |
|
|
|
$result = $UserModel->retrieve($param); |
|
|
|
|
|
|
|
if (!$result['status']) throw new ValidateException($result['msg']); |
|
|
|
|
|
|
|
return $this->renderSuccess($result['msg']); |
|
|
|
} catch (ValidateException $validateException) { |
|
|
|
return $this->renderError($validateException->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 删除代理 |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function deleteUser() |
|
|
|
{ |
|
|
|
$param = Request::param(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
validate(Agent::class)->scene('del')->check($param); |
|
|
|
|
|
|
|
$result = AgentUser::destroy($param['aid']); |
|
|
|
|
|
|
|
if (!$result) throw new ValidateException('删除失败'); |
|
|
|
|
|
|
|
return $this->renderSuccess('已删除'); |
|
|
|
} catch (ValidateException $validateException) { |
|
|
|
return $this->renderError($validateException->getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|