优化部分代码,增加微信公众号模板
This commit is contained in:
@@ -153,7 +153,10 @@ class RoleService extends BaseService
|
||||
*/
|
||||
public function delete($id): mixed
|
||||
{
|
||||
if (in_array($id, [1, 2])) {
|
||||
// BaseController::delete 传入的是 ids 数组,直接 in_array($id,[1,2]) 会因「数组与标量比较恒 false」绕过保护,
|
||||
// 这里统一归一为数组后用 array_intersect 判断是否命中内置角色(1超管 / 2默认)
|
||||
$ids = is_array($id) ? $id : [$id];
|
||||
if (array_intersect(array_map('intval', $ids), [1, 2])) {
|
||||
$this->utils->errorThrow('管理员角色禁止删除');
|
||||
}
|
||||
return $this->del($id);
|
||||
|
||||
Reference in New Issue
Block a user