mirror of https://gitee.com/karson/fastadmin.git
修复管理后台无法批量删除用户的问题
parent
2a5f3e97db
commit
fdfca674cc
|
|
@ -4,6 +4,7 @@ namespace app\admin\controller\user;
|
||||||
|
|
||||||
use app\common\controller\Backend;
|
use app\common\controller\Backend;
|
||||||
use app\common\library\Auth;
|
use app\common\library\Auth;
|
||||||
|
use think\Db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会员管理
|
* 会员管理
|
||||||
|
|
@ -93,13 +94,28 @@ class User extends Backend
|
||||||
if (!$this->request->isPost()) {
|
if (!$this->request->isPost()) {
|
||||||
$this->error(__("Invalid parameters"));
|
$this->error(__("Invalid parameters"));
|
||||||
}
|
}
|
||||||
$ids = $ids ? $ids : $this->request->post("ids");
|
$ids = $ids ?: $this->request->post("ids");
|
||||||
$row = $this->model->get($ids);
|
|
||||||
$this->modelValidate = true;
|
$this->modelValidate = true;
|
||||||
if (!$row) {
|
if (is_numeric($ids)) {
|
||||||
$this->error(__('No Results were found'));
|
$res = Auth::instance()->delete($ids);
|
||||||
|
if (!$res) {
|
||||||
|
$this->error(__('No Results were found'));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$ids = explode(',', $ids);
|
||||||
|
if (!is_array($ids) || count($ids) == 0) {
|
||||||
|
$this->error(__('Invalid parameters'));
|
||||||
|
}
|
||||||
|
Db::startTrans();
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
$res = Auth::instance()->delete($id);
|
||||||
|
if (!$res) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($this->auth->getError());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Db::commit();
|
||||||
}
|
}
|
||||||
Auth::instance()->delete($row['id']);
|
|
||||||
$this->success();
|
$this->success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue