mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
Merge branch 'master' of https://git.topthink.com/topteam/framework
This commit is contained in:
@@ -94,6 +94,8 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
protected $type = [];
|
||||
// 是否为更新数据
|
||||
protected $isUpdate = false;
|
||||
// 是否使用Replace
|
||||
protected $replace = false;
|
||||
// 是否强制更新所有数据
|
||||
protected $force = false;
|
||||
// 更新条件
|
||||
@@ -1013,6 +1015,18 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据是否使用Replace
|
||||
* @access public
|
||||
* @param bool $replace
|
||||
* @return $this
|
||||
*/
|
||||
public function replace($replace = true)
|
||||
{
|
||||
$this->replace = $replace;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存当前数据对象
|
||||
* @access public
|
||||
@@ -1162,9 +1176,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
// 检测字段
|
||||
$allowFields = $this->checkAllowField(array_merge($this->auto, $this->insert));
|
||||
if (!empty($allowFields)) {
|
||||
$result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data, false, false, $sequence);
|
||||
$result = $this->getQuery()->strict(false)->field($allowFields)->insert($this->data, $this->replace, false, $sequence);
|
||||
} else {
|
||||
$result = $this->getQuery()->insert($this->data, false, false, $sequence);
|
||||
$result = $this->getQuery()->insert($this->data, $this->replace, false, $sequence);
|
||||
}
|
||||
|
||||
// 获取自动增长主键
|
||||
|
||||
Reference in New Issue
Block a user