From 05e0543509725149c7a9d4ab67a8ffff9aa41e93 Mon Sep 17 00:00:00 2001 From: Anyon Date: Thu, 25 May 2017 11:21:16 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=E4=BF=AE=E6=94=B9Db?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=E8=8E=B7=E5=8F=96=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/service/DataService.php | 16 ++++++---------- extend/service/LogService.php | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/extend/service/DataService.php b/extend/service/DataService.php index 4b4acf0e6..ad207e578 100644 --- a/extend/service/DataService.php +++ b/extend/service/DataService.php @@ -60,16 +60,14 @@ class DataService { /** * 数据增量保存 - * @param \think\db\Query|string $db 数据查询对象 + * @param \think\db\Query|string $dbQuery 数据查询对象 * @param array $data 需要保存或更新的数据 * @param string $upkey 条件主键限制 * @param array $where 其它的where条件 * @return bool */ - public static function save($db, $data, $upkey = 'id', $where = []) { - if (is_string($db)) { - $db = Db::name($db); - } + public static function save($dbQuery, $data, $upkey = 'id', $where = []) { + $db = is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery; $fields = $db->getTableFields(['table' => $db->getTable()]); $_data = []; foreach ($data as $k => $v) { @@ -102,14 +100,12 @@ class DataService { /** * 更新数据表内容 - * @param \think\db\Query|string $db 数据查询对象 + * @param \think\db\Query|string $dbQuery 数据查询对象 * @param array $where 额外查询条件 * @return bool|null */ - public static function update(&$db, $where = []) { - if (is_string($db)) { - $db = Db::name($db); - } + public static function update(&$dbQuery, $where = []) { + $db = is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery; $ids = explode(',', input("post.id", '')); $field = input('post.field', ''); $value = input('post.value', ''); diff --git a/extend/service/LogService.php b/extend/service/LogService.php index f219466fa..a69e5cfe2 100644 --- a/extend/service/LogService.php +++ b/extend/service/LogService.php @@ -1,4 +1,5 @@ insert($data) !== false; } -} \ No newline at end of file +}