升级thinkphp到5.1.39
This commit is contained in:
1 parent
c8839fa4f8
commit
a58d04e7e2
37 files changed
+546
-192
No files matched your search
@@ -95,14 +95,14 @@ class Query
|
||||
* @var array
|
||||
*/
|
||||
protected $timeRule = [
|
||||
'today' => ['today', 'tomorrow'],
|
||||
'yesterday' => ['yesterday', 'today'],
|
||||
'week' => ['this week 00:00:00', 'next week 00:00:00'],
|
||||
'last week' => ['last week 00:00:00', 'this week 00:00:00'],
|
||||
'month' => ['first Day of this month 00:00:00', 'first Day of next month 00:00:00'],
|
||||
'last month' => ['first Day of last month 00:00:00', 'first Day of this month 00:00:00'],
|
||||
'year' => ['this year 1/1', 'next year 1/1'],
|
||||
'last year' => ['last year 1/1', 'this year 1/1'],
|
||||
'today' => ['today', 'tomorrow -1second'],
|
||||
'yesterday' => ['yesterday', 'today -1second'],
|
||||
'week' => ['this week 00:00:00', 'next week 00:00:00 -1second'],
|
||||
'last week' => ['last week 00:00:00', 'this week 00:00:00 -1second'],
|
||||
'month' => ['first Day of this month 00:00:00', 'first Day of next month 00:00:00 -1second'],
|
||||
'last month' => ['first Day of last month 00:00:00', 'first Day of this month 00:00:00 -1second'],
|
||||
'year' => ['this year 1/1', 'next year 1/1 -1second'],
|
||||
'last year' => ['last year 1/1', 'this year 1/1 -1second'],
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -133,7 +133,27 @@ class Query
|
||||
*/
|
||||
public function newQuery()
|
||||
{
|
||||
return new static($this->connection);
|
||||
$query = new static($this->connection);
|
||||
|
||||
if ($this->model) {
|
||||
$query->model($this->model);
|
||||
}
|
||||
|
||||
if (isset($this->options['table'])) {
|
||||
$query->table($this->options['table']);
|
||||
} else {
|
||||
$query->name($this->name);
|
||||
}
|
||||
|
||||
if (isset($this->options['json'])) {
|
||||
$query->json($this->options['json'], $this->options['json_assoc']);
|
||||
}
|
||||
|
||||
if (isset($this->options['field_type'])) {
|
||||
$query->setJsonFieldType($this->options['field_type']);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -562,12 +582,12 @@ class Query
|
||||
default:
|
||||
if (function_exists($type)) {
|
||||
// 支持指定函数哈希
|
||||
$seq = (ord(substr($type($value), 0, 1)) % $rule['num']) + 1;
|
||||
} else {
|
||||
// 按照字段的首字母的值分表
|
||||
$seq = (ord($value{0}) % $rule['num']) + 1;
|
||||
$value = $type($value);
|
||||
}
|
||||
|
||||
$seq = (ord(substr($value, 0, 1)) % $rule['num']) + 1;
|
||||
}
|
||||
|
||||
return $this->getTable() . '_' . $seq;
|
||||
}
|
||||
// 当设置的分表字段不在查询条件或者数据中
|
||||
@@ -2470,7 +2490,7 @@ class Query
|
||||
if (is_array($value)) {
|
||||
$this->bind = array_merge($this->bind, $value);
|
||||
} else {
|
||||
$name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_';
|
||||
$name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_' . mt_rand() . '_';
|
||||
|
||||
$this->bind[$name] = [$value, $type];
|
||||
return $name;
|
||||
|
||||
Reference in new issue
Block a user