diff --git a/extend/controller/BasicAdmin.php b/extend/controller/BasicAdmin.php index 8b9d8d454..99ae2835d 100644 --- a/extend/controller/BasicAdmin.php +++ b/extend/controller/BasicAdmin.php @@ -100,7 +100,7 @@ class BasicAdmin extends Controller foreach ($this->request->post() as $key => $value) { if (preg_match('/^_\d{1,}$/', $key) && preg_match('/^\d{1,}$/', $value)) { list($where, $update) = [['id' => trim($key, '_')], ['sort' => $value]]; - if (false === Db::name($db->getTable())->where($where)->update($update)) { + if (false === Db::table($db->getTable())->where($where)->update($update)) { $this->error('列表排序失败, 请稍候再试'); } } diff --git a/extend/service/DataService.php b/extend/service/DataService.php index 43e6c6622..8f974d918 100644 --- a/extend/service/DataService.php +++ b/extend/service/DataService.php @@ -77,10 +77,10 @@ class DataService { $db = is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery; $where[] = [$key, 'eq', isset($data[$key]) ? $data[$key] : '']; - if (Db::name($db->getTable())->where($where)->count() > 0) { - return Db::name($db->getTable())->strict(false)->where($where)->update($data) !== false; + if (Db::table($db->getTable())->where($where)->count() > 0) { + return Db::table($db->getTable())->strict(false)->where($where)->update($data) !== false; } - return Db::name($db->getTable())->strict(false)->insert($data) !== false; + return Db::table($db->getTable())->strict(false)->insert($data) !== false; } /** @@ -101,12 +101,12 @@ class DataService // 删除模式,如果存在 is_deleted 字段使用软删除 if ($field === 'delete') { if (method_exists($db, 'getTableFields') && in_array('is_deleted', $db->getTableFields())) { - return Db::name($table)->where($where)->update(['is_deleted' => '1']) !== false; + return Db::table($table)->where($where)->update(['is_deleted' => '1']) !== false; } - return Db::name($table)->where($where)->delete() !== false; + return Db::table($table)->where($where)->delete() !== false; } // 更新模式,更新指定字段内容 - return Db::name($table)->where($where)->update([$field => $value]) !== false; + return Db::table($table)->where($where)->update([$field => $value]) !== false; } }