1.提交缺失的东西

This commit is contained in:
2025-05-15 15:36:23 +08:00
parent 20e3079bc3
commit 38cd2632f3
3 changed files with 20 additions and 17 deletions

View File

@ -48,26 +48,29 @@ trait TimeFieldQuery
return $this;
}
/**
* 查询日期或者时间.
*
* @param string $field 日期字段名
* @param string $op 比较运算符或者表达式
* @param mixed $range 比较范围
* @param string $logic AND OR
*
* @return $this
*/
public function whereTime(string $field, string $op, $range = null, string $logic = 'AND')
public function whereTime($field, $op, $range = null, $logic = 'AND')
{
if (is_null($range)) {
$range = $this->timeRule[$op] ?? $op;
if (is_array($op)) {
$range = $op;
} else {
if (isset($this->timeExp[strtolower($op)])) {
$op = $this->timeExp[strtolower($op)];
}
if (isset($this->timeRule[strtolower($op)])) {
$range = $this->timeRule[strtolower($op)];
} else {
$range = $op;
}
}
$op = is_array($range) ? 'between' : '>=';
}
return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true);
}
/**
* 查询某个时间间隔数据.
*