增加时间戳自动写入的判断

This commit is contained in:
thinkphp
2016-12-23 11:37:34 +08:00
parent 44402ae1a3
commit c33cc2991b
2 changed files with 4 additions and 4 deletions

View File

@@ -726,7 +726,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$this->autoCompleteData($this->auto);
// 自动写入更新时间
if ($this->autoWriteTimestamp && $this->updateTime) {
if ($this->autoWriteTimestamp && $this->updateTime && !isset($this->data[$this->updateTime])) {
$this->setAttr($this->updateTime, null);
}
@@ -783,7 +783,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$this->autoCompleteData($this->insert);
// 自动写入创建时间
if ($this->autoWriteTimestamp && $this->createTime) {
if ($this->autoWriteTimestamp && $this->createTime && !isset($this->data[$this->createTime])) {
$this->setAttr($this->createTime, null);
}

View File

@@ -169,7 +169,7 @@ class Merge extends Model
$this->autoCompleteData($this->auto);
// 自动写入更新时间
if ($this->autoWriteTimestamp && $this->updateTime) {
if ($this->autoWriteTimestamp && $this->updateTime && !isset($this->data[$this->updateTime])) {
$this->setAttr($this->updateTime, null);
}
@@ -221,7 +221,7 @@ class Merge extends Model
$this->autoCompleteData($this->insert);
// 自动写入创建时间
if ($this->autoWriteTimestamp && $this->createTime) {
if ($this->autoWriteTimestamp && $this->createTime && !isset($this->data[$this->createTime])) {
$this->setAttr($this->createTime, null);
}