升级Thinkphp到5127版本
This commit is contained in:
1 parent
22a8f915e3
commit
9b8bd06b33
24 files changed
+504
-185
No files matched your search
@@ -1246,22 +1246,14 @@ abstract class Connection
|
||||
* @access public
|
||||
* @param Query $query 查询对象
|
||||
* @param string $field 字段名
|
||||
* @param bool $default 默认值
|
||||
* @param mixed $default 默认值
|
||||
* @param bool $one 是否返回一个值
|
||||
* @return mixed
|
||||
*/
|
||||
public function value(Query $query, $field, $default = null)
|
||||
public function value(Query $query, $field, $default = null, $one = true)
|
||||
{
|
||||
$options = $query->getOptions();
|
||||
|
||||
if (empty($options['fetch_sql']) && !empty($options['cache'])) {
|
||||
$cache = $options['cache'];
|
||||
$result = $this->getCacheData($query, $cache, null, $key);
|
||||
|
||||
if (false !== $result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($options['field'])) {
|
||||
$query->removeOption('field');
|
||||
}
|
||||
@@ -1271,7 +1263,19 @@ abstract class Connection
|
||||
}
|
||||
|
||||
$query->setOption('field', $field);
|
||||
$query->setOption('limit', 1);
|
||||
|
||||
if (empty($options['fetch_sql']) && !empty($options['cache'])) {
|
||||
$cache = $options['cache'];
|
||||
$result = $this->getCacheData($query, $cache, null, $key);
|
||||
|
||||
if (false !== $result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if ($one) {
|
||||
$query->setOption('limit', 1);
|
||||
}
|
||||
|
||||
// 生成查询SQL
|
||||
$sql = $this->builder->select($query);
|
||||
@@ -1320,7 +1324,7 @@ abstract class Connection
|
||||
|
||||
$field = $aggregate . '(' . (!empty($distinct) ? 'DISTINCT ' : '') . $this->builder->parseKey($query, $field, true) . ') AS tp_' . strtolower($aggregate);
|
||||
|
||||
return $this->value($query, $field, 0);
|
||||
return $this->value($query, $field, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1335,16 +1339,6 @@ abstract class Connection
|
||||
{
|
||||
$options = $query->getOptions();
|
||||
|
||||
if (empty($options['fetch_sql']) && !empty($options['cache'])) {
|
||||
// 判断查询缓存
|
||||
$cache = $options['cache'];
|
||||
$result = $this->getCacheData($query, $cache, null, $guid);
|
||||
|
||||
if (false !== $result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($options['field'])) {
|
||||
$query->removeOption('field');
|
||||
}
|
||||
@@ -1362,6 +1356,16 @@ abstract class Connection
|
||||
|
||||
$query->setOption('field', $field);
|
||||
|
||||
if (empty($options['fetch_sql']) && !empty($options['cache'])) {
|
||||
// 判断查询缓存
|
||||
$cache = $options['cache'];
|
||||
$result = $this->getCacheData($query, $cache, null, $guid);
|
||||
|
||||
if (false !== $result) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
// 生成查询SQL
|
||||
$sql = $this->builder->select($query);
|
||||
|
||||
|
||||
Reference in new issue
Block a user