改进自动时间戳写入 支持单独关闭某个字段

This commit is contained in:
thinkphp
2016-05-23 11:56:39 +08:00
parent 6172303c97
commit 0556e39164
2 changed files with 4 additions and 4 deletions

View File

@@ -322,7 +322,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$this->autoCompleteData($this->auto);
// 自动写入更新时间
if ($this->autoWriteTimestamp) {
if ($this->autoWriteTimestamp && $this->updateTime) {
$this->__set($this->updateTime, null);
}
@@ -368,7 +368,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
$this->autoCompleteData($this->insert);
// 自动写入创建时间
if ($this->autoWriteTimestamp) {
if ($this->autoWriteTimestamp && $this->createTime) {
$this->__set($this->createTime, null);
}

View File

@@ -166,7 +166,7 @@ class Merge extends Model
$this->autoCompleteData($this->auto);
// 自动写入更新时间
if ($this->autoWriteTimestamp) {
if ($this->autoWriteTimestamp && $this->updateTime) {
$this->__set($this->updateTime, null);
}
@@ -202,7 +202,7 @@ class Merge extends Model
$this->autoCompleteData($this->insert);
// 自动写入创建时间
if ($this->autoWriteTimestamp) {
if ($this->autoWriteTimestamp && $this->createTime) {
$this->__set($this->createTime, null);
}