mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
Model类的save方法返回值 不再判断 自增ID
This commit is contained in:
@@ -323,11 +323,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$result = self::db()->insert($data);
|
||||
|
||||
// 获取自动增长主键
|
||||
$insertId = self::db()->getLastInsID();
|
||||
if (is_string($this->pk) && $insertId) {
|
||||
$data[$this->pk] = $insertId;
|
||||
if ($result) {
|
||||
$insertId = self::db()->getLastInsID();
|
||||
if (is_string($this->pk) && $insertId) {
|
||||
$data[$this->pk] = $insertId;
|
||||
}
|
||||
}
|
||||
$result = $insertId ?: $result;
|
||||
|
||||
// 数据对象赋值
|
||||
$this->data = $data;
|
||||
|
||||
Reference in New Issue
Block a user