查询支持一个字段多次查询条件

This commit is contained in:
thinkphp
2016-11-28 22:44:59 +08:00
parent bd6700acde
commit 7a79071d1a

View File

@@ -931,11 +931,16 @@ class Query
$where[$field] = ['eq', $op];
} else {
$where[$field] = [$op, $condition];
// 记录一个字段多次查询条件
$this->options['multi'][$field][] = $where[$field];
}
if (!empty($where)) {
if (!isset($this->options['where'][$logic])) {
$this->options['where'][$logic] = [];
}
if (isset($this->options['multi'][$field]) && count($this->options['multi'][$field]) > 1) {
$where[$field] = $this->options['multi'][$field];
}
$this->options['where'][$logic] = array_merge($this->options['where'][$logic], $where);
}
}