add:新增导出用户

This commit is contained in:
JaguarJack
2020-09-08 14:12:42 +08:00
parent 3a2689db18
commit bd7f62b9ed
3 changed files with 85 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
<?php
namespace catchAdmin\permissions\controller;
use catchAdmin\permissions\excel\UserExport;
use catcher\base\CatchRequest as Request;
use catchAdmin\permissions\model\Permissions;
use catchAdmin\permissions\model\Roles;
@@ -11,6 +12,7 @@ use catcher\base\CatchController;
use catcher\CatchAuth;
use catcher\CatchCacheKeys;
use catcher\CatchResponse;
use catcher\library\excel\Excel;
use catcher\Tree;
use catcher\Utils;
use think\facade\Cache;
@@ -227,4 +229,18 @@ class User extends CatchController
'hasRoles' => $roleIds,
]);
}
/**
* 导出
*
* @time 2020年09月08日
* @param Excel $excel
* @param UserExport $userExport
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @return \think\response\Json
*/
public function export(Excel $excel, UserExport $userExport)
{
return CatchResponse::success($excel->save($userExport, Utils::publicPath('export/users')));
}
}