改进命令行模式下自动完成的时间写入问题

This commit is contained in:
thinkphp
2017-04-21 21:46:02 +08:00
parent 77dbb1315b
commit 37b74f674e

View File

@@ -380,12 +380,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
case 'datetime': case 'datetime':
case 'date': case 'date':
$format = !empty($param) ? $param : $this->dateFormat; $format = !empty($param) ? $param : $this->dateFormat;
$value = $this->formatDateTime($_SERVER['REQUEST_TIME'], $format); $value = $this->formatDateTime(time(), $format);
break; break;
case 'timestamp': case 'timestamp':
case 'integer': case 'integer':
default: default:
$value = $_SERVER['REQUEST_TIME']; $value = time();
break; break;
} }
} elseif (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [ } elseif (is_string($this->autoWriteTimestamp) && in_array(strtolower($this->autoWriteTimestamp), [
@@ -394,9 +394,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
'timestamp', 'timestamp',
]) ])
) { ) {
$value = $this->formatDateTime($_SERVER['REQUEST_TIME'], $this->dateFormat); $value = $this->formatDateTime(time(), $this->dateFormat);
} else { } else {
$value = $this->formatDateTime($_SERVER['REQUEST_TIME'], $this->dateFormat, true); $value = $this->formatDateTime(time(), $this->dateFormat, true);
} }
return $value; return $value;
} }