Skip to content

Commit

Permalink
改进
Browse files Browse the repository at this point in the history
  • Loading branch information
yunwuxin committed Aug 25, 2023
1 parent d119171 commit d0cf445
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Model.php
Expand Up @@ -690,12 +690,12 @@ protected function insertData(string $sequence = null): bool

// 时间戳自动写入
if ($this->autoWriteTimestamp) {
if ($this->createTime && !isset($data[$this->createTime])) {
$data[$this->createTime] = $this->autoWriteTimestamp();
if ($this->createTime && !array_key_exists($this->createTime, $data)) {
$data[$this->createTime] = $this->autoWriteTimestamp();
$this->data[$this->createTime] = $data[$this->createTime];
}

if ($this->updateTime && !isset($data[$this->updateTime])) {
if ($this->updateTime && !array_key_exists($this->updateTime, $data)) {
$data[$this->updateTime] = $this->autoWriteTimestamp();
$this->data[$this->updateTime] = $data[$this->updateTime];
}
Expand Down

0 comments on commit d0cf445

Please sign in to comment.