@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\db; |
14 | 14 | |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | $name = App::parseName(substr($method, 5)); |
127 | 127 | array_unshift($args, $name); |
128 | 128 | return call_user_func_array([$this, 'where'], $args); |
129 | - } elseif ($this->model && method_exists($this->model, 'scope' . $method)) { |
|
129 | + } elseif ($this->model && method_exists($this->model, 'scope'.$method)) { |
|
130 | 130 | // 动态调用命名范围 |
131 | - $method = 'scope' . $method; |
|
131 | + $method = 'scope'.$method; |
|
132 | 132 | array_unshift($args, $this); |
133 | 133 | |
134 | 134 | call_user_func_array([$this->model, $method], $args); |
135 | 135 | return $this; |
136 | 136 | } else { |
137 | - throw new Exception('method not exist:' . static::class . '->' . $method); |
|
137 | + throw new Exception('method not exist:'.static::class.'->'.$method); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $name = $name ?: $this->name; |
210 | 210 | |
211 | - return $this->prefix . App::parseName($name); |
|
211 | + return $this->prefix.App::parseName($name); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -433,10 +433,10 @@ discard block |
||
433 | 433 | $prefix = $prefix ?: $tableName; |
434 | 434 | foreach ($field as $key => &$val) { |
435 | 435 | if (is_numeric($key) && $alias) { |
436 | - $field[$prefix . '.' . $val] = $alias . $val; |
|
436 | + $field[$prefix.'.'.$val] = $alias.$val; |
|
437 | 437 | unset($field[$key]); |
438 | 438 | } elseif (is_numeric($key)) { |
439 | - $val = $prefix . '.' . $val; |
|
439 | + $val = $prefix.'.'.$val; |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | // 延迟写入 |
491 | 491 | $condition = $this->options['where'] ?? []; |
492 | 492 | |
493 | - $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); |
|
493 | + $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition)); |
|
494 | 494 | $step = $this->connection->lazyWrite($op, $guid, $step, $lazyTime); |
495 | 495 | |
496 | 496 | if (false === $step) { |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | */ |
559 | 559 | public function limit(int $offset, int $length = null) |
560 | 560 | { |
561 | - $this->options['limit'] = $offset . ($length ? ',' . $length : ''); |
|
561 | + $this->options['limit'] = $offset.($length ? ','.$length : ''); |
|
562 | 562 | |
563 | 563 | return $this; |
564 | 564 | } |
@@ -694,7 +694,7 @@ discard block |
||
694 | 694 | } |
695 | 695 | } |
696 | 696 | |
697 | - $results = $this->when($lastId, function ($query) use ($key, $sort, $lastId) { |
|
697 | + $results = $this->when($lastId, function($query) use ($key, $sort, $lastId) { |
|
698 | 698 | $query->where($key, 'asc' == $sort ? '>' : '<', $lastId); |
699 | 699 | }) |
700 | 700 | ->limit($listRows) |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | if (is_string($field)) { |
814 | 814 | if (!empty($this->options['via'])) { |
815 | - $field = $this->options['via'] . '.' . $field; |
|
815 | + $field = $this->options['via'].'.'.$field; |
|
816 | 816 | } |
817 | 817 | if (strpos($field, ',')) { |
818 | 818 | $field = array_map('trim', explode(',', $field)); |
@@ -822,9 +822,9 @@ discard block |
||
822 | 822 | } elseif (!empty($this->options['via'])) { |
823 | 823 | foreach ($field as $key => $val) { |
824 | 824 | if (is_numeric($key)) { |
825 | - $field[$key] = $this->options['via'] . '.' . $val; |
|
825 | + $field[$key] = $this->options['via'].'.'.$val; |
|
826 | 826 | } else { |
827 | - $field[$this->options['via'] . '.' . $key] = $val; |
|
827 | + $field[$this->options['via'].'.'.$key] = $val; |
|
828 | 828 | unset($field[$key]); |
829 | 829 | } |
830 | 830 | } |
@@ -1498,7 +1498,7 @@ discard block |
||
1498 | 1498 | */ |
1499 | 1499 | public function buildSql(bool $sub = true): string |
1500 | 1500 | { |
1501 | - return $sub ? '( ' . $this->fetchSql()->select() . ' )' : $this->fetchSql()->select(); |
|
1501 | + return $sub ? '( '.$this->fetchSql()->select().' )' : $this->fetchSql()->select(); |
|
1502 | 1502 | } |
1503 | 1503 | |
1504 | 1504 | /** |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | $page = $page > 0 ? $page : 1; |
1555 | 1555 | $listRows = $listRows ?: (is_numeric($options['limit']) ? $options['limit'] : 20); |
1556 | 1556 | $offset = $listRows * ($page - 1); |
1557 | - $options['limit'] = $offset . ',' . $listRows; |
|
1557 | + $options['limit'] = $offset.','.$listRows; |
|
1558 | 1558 | } |
1559 | 1559 | |
1560 | 1560 | $this->options = $options; |
@@ -1618,7 +1618,7 @@ discard block |
||
1618 | 1618 | $alias = $this->options['alias'][$table]; |
1619 | 1619 | } |
1620 | 1620 | |
1621 | - $key = isset($alias) ? $alias . '.' . $pk : $pk; |
|
1621 | + $key = isset($alias) ? $alias.'.'.$pk : $pk; |
|
1622 | 1622 | // 根据主键查询 |
1623 | 1623 | if (is_array($data)) { |
1624 | 1624 | $this->where($key, 'in', $data); |