去除 IS_CGI IS_MAC NOW_TIME 常量

This commit is contained in:
thinkphp
2016-06-02 12:21:36 +08:00
parent 8099a001e2
commit d65882e20c
7 changed files with 11 additions and 15 deletions

View File

@@ -1017,16 +1017,16 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
switch ($type) {
case 'timestamp':
$format = !empty($param) ? $param : $this->dateFormat;
$value = date($format, NOW_TIME);
$value = date($format, $_SERVER['REQUEST_TIME']);
break;
case 'datetime':
$value = NOW_TIME;
$value = $_SERVER['REQUEST_TIME'];
break;
}
} elseif (isset($this->fieldType[$name]) && preg_match('/(datetime|timestamp)/is', $this->fieldType[$name])) {
$value = date($this->dateFormat, NOW_TIME);
$value = date($this->dateFormat, $_SERVER['REQUEST_TIME']);
} else {
$value = NOW_TIME;
$value = $_SERVER['REQUEST_TIME'];
}
} else {
// 检测修改器

View File

@@ -207,7 +207,7 @@ class Response
$result = [
'code' => $code,
'msg' => $msg,
'time' => NOW_TIME,
'time' => $_SERVER['REQUEST_TIME'],
'data' => $data,
];
return $this->data($result);

View File

@@ -976,7 +976,7 @@ class Validate
if (!is_numeric($end)) {
$end = strtotime($end);
}
return NOW_TIME >= $start && NOW_TIME <= $end;
return $_SERVER['REQUEST_TIME'] >= $start && $_SERVER['REQUEST_TIME'] <= $end;
}
/**

View File

@@ -586,7 +586,7 @@ class Query
{
if (false !== ($value = Cache::get($guid))) {
// 存在缓存写入数据
if (NOW_TIME > Cache::get($guid . '_time') + $lazyTime) {
if ($_SERVER['REQUEST_TIME'] > Cache::get($guid . '_time') + $lazyTime) {
// 延时更新时间到了,删除缓存数据 并实际写入数据库
Cache::rm($guid);
Cache::rm($guid . '_time');
@@ -600,7 +600,7 @@ class Query
// 没有缓存数据
Cache::set($guid, $step, 0);
// 计时开始
Cache::set($guid . '_time', NOW_TIME, 0);
Cache::set($guid . '_time', $_SERVER['REQUEST_TIME'], 0);
return false;
}
}