refactor(admin): remove unused 'where' option in system module

- Remove unnecessary 'where' option from various models in system module
- Simplify query methods by removing redundant 'where' calls
- Affected models: Config, Node, SystemAdmin, SystemMenu, SystemNode
This commit is contained in:
wolfcode
2025-03-26 11:20:06 +08:00
parent 652b17d6a6
commit 187d4343b3
6 changed files with 12 additions and 15 deletions

View File

@@ -41,12 +41,12 @@ class Config extends AdminController
if ($group == 'upload') {
$upload_types = config('admin.upload_types');
// 兼容旧版本
$this->model->removeOption('where')->where('name', 'upload_allow_type')->update(['value' => implode(',', array_keys($upload_types))]);
$this->model->removeOption()->where('name', 'upload_allow_type')->update(['value' => implode(',', array_keys($upload_types))]);
}
foreach ($post as $key => $val) {
if (in_array($key, $notAddFields)) continue;
if ($this->model->removeOption('where')->where('name', $key)->count()) {
$this->model->removeOption('where')->where('name', $key)->update(['value' => $val,]);
if ($this->model->removeOption()->where('name', $key)->count()) {
$this->model->removeOption()->where('name', $key)->update(['value' => $val,]);
}else {
$this->model->create(
[
@@ -59,7 +59,7 @@ class Config extends AdminController
TriggerService::updateMenu();
TriggerService::updateSysConfig();
}catch (\Exception $e) {
$this->error('保存失败' .$e->getMessage());
$this->error('保存失败' . $e->getMessage());
}
$this->success('保存成功');
}