修改权限管理

This commit is contained in:
wuyanwen
2019-12-26 09:03:09 +08:00
parent 4a3f043166
commit 1dcce85c3a
8 changed files with 46 additions and 124 deletions

View File

@@ -10,6 +10,7 @@ use catchAdmin\user\request\UpdateRequest;
use catcher\base\CatchController;
use catcher\CatchResponse;
use catcher\Tree;
use catcher\Utils;
class User extends CatchController
{
@@ -110,10 +111,14 @@ class User extends CatchController
*/
public function delete($id)
{
// 删除角色
$this->user->findBy($id)->detach();
$ids = Utils::stringToArrayBy($id);
$this->user->deleteBy($id);
foreach ($ids as $_id) {
// 删除角色
$this->user->findBy($_id)->detach();
$this->user->deleteBy($_id);
}
return CatchResponse::success();
}
@@ -126,10 +131,18 @@ class User extends CatchController
*/
public function switchStatus($id): \think\response\Json
{
$user = $this->user->findBy($id);
return CatchResponse::success($this->user->updateBy($id, [
$ids = Utils::stringToArrayBy($id);
foreach ($ids as $_id) {
$user = $this->user->findBy($_id);
$this->user->updateBy($_id, [
'status' => $user->status == Users::ENABLE ? Users::DISABLE : Users::ENABLE,
]));
]);
}
return CatchResponse::success([], '操作成功');
}
/**