@@ -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 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | if (is_string($field)) { |
744 | 744 | if (!empty($this->options['via'])) { |
745 | - $field = $this->options['via'] . '.' . $field; |
|
745 | + $field = $this->options['via'].'.'.$field; |
|
746 | 746 | } |
747 | 747 | if (strpos($field, ',')) { |
748 | 748 | $field = array_map('trim', explode(',', $field)); |
@@ -752,9 +752,9 @@ discard block |
||
752 | 752 | } elseif (!empty($this->options['via'])) { |
753 | 753 | foreach ($field as $key => $val) { |
754 | 754 | if (is_numeric($key)) { |
755 | - $field[$key] = $this->options['via'] . '.' . $val; |
|
755 | + $field[$key] = $this->options['via'].'.'.$val; |
|
756 | 756 | } else { |
757 | - $field[$this->options['via'] . '.' . $key] = $val; |
|
757 | + $field[$this->options['via'].'.'.$key] = $val; |
|
758 | 758 | unset($field[$key]); |
759 | 759 | } |
760 | 760 | } |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | */ |
1429 | 1429 | public function buildSql(bool $sub = true): string |
1430 | 1430 | { |
1431 | - return $sub ? '( ' . $this->fetchSql()->select() . ' )' : $this->fetchSql()->select(); |
|
1431 | + return $sub ? '( '.$this->fetchSql()->select().' )' : $this->fetchSql()->select(); |
|
1432 | 1432 | } |
1433 | 1433 | |
1434 | 1434 | /** |
@@ -1484,7 +1484,7 @@ discard block |
||
1484 | 1484 | $page = $page > 0 ? $page : 1; |
1485 | 1485 | $listRows = $listRows ?: (is_numeric($options['limit']) ? $options['limit'] : 20); |
1486 | 1486 | $offset = $listRows * ($page - 1); |
1487 | - $options['limit'] = $offset . ',' . $listRows; |
|
1487 | + $options['limit'] = $offset.','.$listRows; |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | $this->options = $options; |
@@ -1548,7 +1548,7 @@ discard block |
||
1548 | 1548 | $alias = $this->options['alias'][$table]; |
1549 | 1549 | } |
1550 | 1550 | |
1551 | - $key = isset($alias) ? $alias . '.' . $pk : $pk; |
|
1551 | + $key = isset($alias) ? $alias.'.'.$pk : $pk; |
|
1552 | 1552 | // 根据主键查询 |
1553 | 1553 | if (is_array($data)) { |
1554 | 1554 | $this->where($key, 'in', $data); |