模型saveall方法支持配合isUpdate方法

This commit is contained in:
thinkphp
2017-11-19 13:54:43 +08:00
parent 941279bc0b
commit ba5428e335

View File

@@ -1297,7 +1297,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$auto = true;
}
foreach ($dataSet as $key => $data) {
if (!empty($auto) && isset($data[$pk])) {
if ($this->isUpdate || (!empty($auto) && isset($data[$pk]))) {
$result[$key] = self::update($data, [], $this->field);
} else {
$result[$key] = self::create($data, $this->field);