mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-10 00:22:48 +08:00
Query类value和column增加对调用field链式操作方法的处理
This commit is contained in:
@@ -107,6 +107,9 @@ class Query
|
||||
$result = Cache::get($key);
|
||||
}
|
||||
if (!$result) {
|
||||
if (isset($this->options['field'])) {
|
||||
unset($this->options['field']);
|
||||
}
|
||||
$pdo = $this->field($field)->fetchPdo(true)->find();
|
||||
$result = $pdo->fetchColumn();
|
||||
if (isset($cache)) {
|
||||
@@ -137,6 +140,9 @@ class Query
|
||||
$result = Cache::get($guid);
|
||||
}
|
||||
if (!$result) {
|
||||
if (isset($this->options['field'])) {
|
||||
unset($this->options['field']);
|
||||
}
|
||||
if ($key && '*' != $field) {
|
||||
$field = $key . ',' . $field;
|
||||
}
|
||||
@@ -365,7 +371,7 @@ class Query
|
||||
}
|
||||
if (count($join)) {
|
||||
// 有设置第二个元素则把第二元素作为表前缀
|
||||
$table = (string)current($join) . $table;
|
||||
$table = (string) current($join) . $table;
|
||||
} elseif (false === strpos($table, '.')) {
|
||||
// 加上默认的表前缀
|
||||
$table = $prefix . $table;
|
||||
@@ -497,7 +503,7 @@ class Query
|
||||
protected function parseWhereExp($operator, $field, $op, $condition, $param = [])
|
||||
{
|
||||
if ($field instanceof \Closure) {
|
||||
call_user_func_array($field, [& $this]);
|
||||
call_user_func_array($field, [ & $this]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -640,16 +646,15 @@ class Query
|
||||
|
||||
$class = (!empty($config['namespace']) ? $config['namespace'] : '\\think\\paginator\\driver\\') . ucwords($config['type']);
|
||||
|
||||
$page = isset($config['page']) ? (int)$config['page'] : call_user_func([
|
||||
$page = isset($config['page']) ? (int) $config['page'] : call_user_func([
|
||||
$class,
|
||||
'getCurrentPage'
|
||||
'getCurrentPage',
|
||||
], $config['var_page']);
|
||||
|
||||
$page = $page < 1 ? 1 : $page;
|
||||
|
||||
$config['path'] = isset($config['path']) ? $config['path'] : call_user_func([$class, 'getCurrentPath']);
|
||||
|
||||
|
||||
/** @var Paginator $paginator */
|
||||
if (!$simple) {
|
||||
$options = $this->getOptions();
|
||||
@@ -1074,7 +1079,7 @@ class Query
|
||||
$this->join($joinTable . ' ' . $joinName, $name . '.' . $info['localKey'] . '=' . $joinName . '.' . $info['foreignKey'])->field(true, false, $joinTable, $joinName, $joinName . '__');
|
||||
if ($closure) {
|
||||
// 执行闭包查询
|
||||
call_user_func_array($closure, [& $this]);
|
||||
call_user_func_array($closure, [ & $this]);
|
||||
}
|
||||
$i++;
|
||||
} elseif ($closure) {
|
||||
@@ -1275,7 +1280,7 @@ class Query
|
||||
if ($data instanceof Query) {
|
||||
return $data->select();
|
||||
} elseif ($data instanceof \Closure) {
|
||||
call_user_func_array($data, [& $this]);
|
||||
call_user_func_array($data, [ & $this]);
|
||||
}
|
||||
// 分析查询表达式
|
||||
$options = $this->parseExpress();
|
||||
@@ -1358,7 +1363,7 @@ class Query
|
||||
if ($data instanceof Query) {
|
||||
return $data->find();
|
||||
} elseif ($data instanceof \Closure) {
|
||||
call_user_func_array($data, [& $this]);
|
||||
call_user_func_array($data, [ & $this]);
|
||||
}
|
||||
// 分析查询表达式
|
||||
$options = $this->parseExpress();
|
||||
|
||||
Reference in New Issue
Block a user