mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-09-05 15:49:45 +08:00
[更新]兼容Tp升级where规则
This commit is contained in:
parent
2cb3128316
commit
d3aa5d13fd
@ -76,11 +76,11 @@ class DataService
|
|||||||
public static function save($dbQuery, $data, $key = 'id', $where = [])
|
public static function save($dbQuery, $data, $key = 'id', $where = [])
|
||||||
{
|
{
|
||||||
$db = is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery;
|
$db = is_string($dbQuery) ? Db::name($dbQuery) : $dbQuery;
|
||||||
$where[] = [$key, 'eq', isset($data[$key]) ? $data[$key] : ''];
|
list($table, $map) = [$db->getTable(), [$key => isset($data[$key]) ? $data[$key] : '']];
|
||||||
if (Db::table($db->getTable())->where($where)->count() > 0) {
|
if (Db::table($table)->where($where)->where($map)->count() > 0) {
|
||||||
return Db::table($db->getTable())->strict(false)->where($where)->update($data) !== false;
|
return Db::table($table)->strict(false)->where($where)->where($map)->update($data) !== false;
|
||||||
}
|
}
|
||||||
return Db::table($db->getTable())->strict(false)->insert($data) !== false;
|
return Db::table($table)->strict(false)->insert($data) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user