This commit is contained in:
thinkphp
2017-12-27 21:25:21 +08:00
parent 97f82a1a9d
commit 61235ed60a

View File

@@ -1124,10 +1124,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
// 获取自动增长主键
if ($result && $insertId = $this->getQuery()->getLastInsID($sequence)) {
$pks = (array) $pk;
foreach ($pks as $pk) {
if (!isset($this->data[$pk]) || '' == $this->data[$pk]) {
$this->data[$pk] = $insertId;
foreach ((array) $pk as $key) {
if (!isset($this->data[$key]) || '' == $this->data[$key]) {
$this->data[$key] = $insertId;
}
}
}