mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
Merge branch 'master' of https://github.com/top-think/framework
This commit is contained in:
@@ -1070,12 +1070,17 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($pk) && isset($data[$pk])) {
|
$array = [];
|
||||||
if (!isset($where[$pk])) {
|
|
||||||
unset($where);
|
foreach ((array) $pk as $key) {
|
||||||
$where[$pk] = $data[$pk];
|
if (isset($data[$key])) {
|
||||||
|
$array[$key] = $data[$key];
|
||||||
|
unset($data[$key]);
|
||||||
}
|
}
|
||||||
unset($data[$pk]);
|
}
|
||||||
|
|
||||||
|
if (!empty($array)) {
|
||||||
|
$where = $array;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检测字段
|
// 检测字段
|
||||||
@@ -1123,10 +1128,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取自动增长主键
|
// 获取自动增长主键
|
||||||
if ($result && is_string($pk) && (!isset($this->data[$pk]) || '' == $this->data[$pk])) {
|
if ($result && $insertId = $this->getQuery()->getLastInsID($sequence)) {
|
||||||
$insertId = $this->getQuery()->getLastInsID($sequence);
|
foreach ((array) $pk as $key) {
|
||||||
if ($insertId) {
|
if (!isset($this->data[$key]) || '' == $this->data[$key]) {
|
||||||
$this->data[$pk] = $insertId;
|
$this->data[$key] = $insertId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user