mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进Model类的save方法
This commit is contained in:
@@ -680,15 +680,13 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
$where = $this->updateWhere;
|
$where = $this->updateWhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($where)) {
|
$pk = $this->getPk();
|
||||||
$pk = $this->getPk();
|
if (is_string($pk) && isset($data[$pk])) {
|
||||||
if (is_string($pk) && isset($data[$pk])) {
|
if (!isset($where[$pk])) {
|
||||||
if (!isset($where[$pk])) {
|
unset($where);
|
||||||
unset($where);
|
$where[$pk] = $data[$pk];
|
||||||
$where[$pk] = $data[$pk];
|
|
||||||
}
|
|
||||||
unset($data[$pk]);
|
|
||||||
}
|
}
|
||||||
|
unset($data[$pk]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->db()->where($where)->update($data);
|
$result = $this->db()->where($where)->update($data);
|
||||||
|
|||||||
Reference in New Issue
Block a user