Skip to content
This repository was archived by the owner on Jan 4, 2020. It is now read-only.

Commit 352a4e6

Browse files
committed
改进model类的updateFields属性处理
1 parent 9b5b4e0 commit 352a4e6

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

ThinkPHP/Library/Think/Model.class.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,15 @@ public function create($data = '', $type = '')
11011101
$fields = $this->insertFields;
11021102
} elseif (self::MODEL_UPDATE == $type && isset($this->updateFields)) {
11031103
$fields = $this->updateFields;
1104+
$pk = $this->getPk();
1105+
if (is_string($pk)) {
1106+
array_push($fields, $pk);
1107+
}
1108+
if (is_array($pk)) {
1109+
foreach ($pk as $pkTemp) {
1110+
array_push($fields, $pkTemp);
1111+
}
1112+
}
11041113
}
11051114
if (isset($fields)) {
11061115
if (is_string($fields)) {

0 commit comments

Comments
 (0)