mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
改进Builder类的时间日期查询
This commit is contained in:
@@ -369,15 +369,13 @@ abstract class Builder
|
|||||||
// 获取时间字段类型
|
// 获取时间字段类型
|
||||||
$type = $this->query->getTableInfo('', 'type');
|
$type = $this->query->getTableInfo('', 'type');
|
||||||
if(isset($type[$key])){
|
if(isset($type[$key])){
|
||||||
|
$value = strtotime($value) ?: $value;
|
||||||
if(preg_match('/(datetime|timestamp)/is', $type[$key])){
|
if(preg_match('/(datetime|timestamp)/is', $type[$key])){
|
||||||
// 日期及时间戳类型
|
// 日期及时间戳类型
|
||||||
$value = date('Y-m-d H:i:s', strtotime($value));
|
$value = date('Y-m-d H:i:s', $value);
|
||||||
}elseif(preg_match('/(date)/is', $type[$key])){
|
}elseif(preg_match('/(date)/is', $type[$key])){
|
||||||
// 日期及时间戳类型
|
// 日期及时间戳类型
|
||||||
$value = date('Y-m-d', strtotime($value));
|
$value = date('Y-m-d', $value);
|
||||||
}else{
|
|
||||||
// 整型
|
|
||||||
$value = strtotime($value);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return is_int($value)? $value : $this->connection->quote($value);
|
return is_int($value)? $value : $this->connection->quote($value);
|
||||||
|
|||||||
Reference in New Issue
Block a user