mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改Db兼容获取方式
This commit is contained in:
parent
bcc96f37a3
commit
05e0543509
@ -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', '');
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
// +----------------------------------------------------------------------
|
||||
// | Think.Admin
|
||||
// +----------------------------------------------------------------------
|
||||
@ -33,7 +34,6 @@ class LogService {
|
||||
return Db::name('SystemLog');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 写入操作日志
|
||||
* @param string $action
|
||||
@ -47,4 +47,4 @@ class LogService {
|
||||
return self::db()->insert($data) !== false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user