|
|
|
@ -5,6 +5,7 @@ namespace app\controller; |
|
|
|
|
|
|
|
use app\BaseController; |
|
|
|
use app\middleware\CheckAdmin; |
|
|
|
use think\exception\ValidateException; |
|
|
|
use think\facade\Cache; |
|
|
|
use think\facade\Db; |
|
|
|
use think\facade\Filesystem; |
|
|
|
@ -18,6 +19,32 @@ class AdminUser extends BaseController |
|
|
|
|
|
|
|
protected $relationType = [1 => '用户', 2 => '代理']; |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增管理 |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function addUser() |
|
|
|
{ |
|
|
|
$param = Request::param(); |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
validate(\app\validate\Passport::class)->scene('adminLogin')->check($param); |
|
|
|
|
|
|
|
$User = new AdminModel(); |
|
|
|
|
|
|
|
$result = $User::createAdmin($param['account_number'],$param['password']); |
|
|
|
|
|
|
|
if (!$result) throw new ValidateException('管理已存在'); |
|
|
|
|
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
} catch (ValidateException $validateException) { |
|
|
|
return $this->renderError($validateException->getMessage()); |
|
|
|
} catch (\Exception $e) { |
|
|
|
return $this->renderError('操作失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 管理员信息 |
|
|
|
* @return array |
|
|
|
|