@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | public function setRelation($name, $value, $data = []) |
| 105 | 105 | { |
| 106 | 106 | // 检测修改器 |
| 107 | - $method = 'set' . Loader::parseName($name, 1) . 'Attr'; |
|
| 107 | + $method = 'set'.Loader::parseName($name, 1).'Attr'; |
|
| 108 | 108 | |
| 109 | 109 | if (method_exists($this, $method)) { |
| 110 | 110 | $value = $this->$method($value, array_merge($this->data, $data)); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $count = $this->$relation()->relationCount($result, $closure, $aggregate, $field, $name); |
| 325 | 325 | |
| 326 | 326 | if (empty($name)) { |
| 327 | - $name = Loader::parseName($relation) . '_' . $aggregate; |
|
| 327 | + $name = Loader::parseName($relation).'_'.$aggregate; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | $result->setAttr($name, $count); |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | // 记录当前关联信息 |
| 424 | 424 | $model = $this->parseModel($model); |
| 425 | 425 | $name = Loader::parseName(basename(str_replace('\\', '/', $model))); |
| 426 | - $table = $table ?: Loader::parseName($this->name) . '_' . $name; |
|
| 427 | - $foreignKey = $foreignKey ?: $name . '_id'; |
|
| 426 | + $table = $table ?: Loader::parseName($this->name).'_'.$name; |
|
| 427 | + $foreignKey = $foreignKey ?: $name.'_id'; |
|
| 428 | 428 | $localKey = $localKey ?: $this->getForeignKey($this->name); |
| 429 | 429 | |
| 430 | 430 | return new BelongsToMany($this, $model, $table, $foreignKey, $localKey); |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | if (is_array($morph)) { |
| 452 | 452 | list($morphType, $foreignKey) = $morph; |
| 453 | 453 | } else { |
| 454 | - $morphType = $morph . '_type'; |
|
| 455 | - $foreignKey = $morph . '_id'; |
|
| 454 | + $morphType = $morph.'_type'; |
|
| 455 | + $foreignKey = $morph.'_id'; |
|
| 456 | 456 | } |
| 457 | 457 | |
| 458 | 458 | $type = $type ?: get_class($this); |
@@ -483,8 +483,8 @@ discard block |
||
| 483 | 483 | if (is_array($morph)) { |
| 484 | 484 | list($morphType, $foreignKey) = $morph; |
| 485 | 485 | } else { |
| 486 | - $morphType = $morph . '_type'; |
|
| 487 | - $foreignKey = $morph . '_id'; |
|
| 486 | + $morphType = $morph.'_type'; |
|
| 487 | + $foreignKey = $morph.'_id'; |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | return new MorphMany($this, $model, $foreignKey, $morphType, $type); |
@@ -510,8 +510,8 @@ discard block |
||
| 510 | 510 | if (is_array($morph)) { |
| 511 | 511 | list($morphType, $foreignKey) = $morph; |
| 512 | 512 | } else { |
| 513 | - $morphType = $morph . '_type'; |
|
| 514 | - $foreignKey = $morph . '_id'; |
|
| 513 | + $morphType = $morph.'_type'; |
|
| 514 | + $foreignKey = $morph.'_id'; |
|
| 515 | 515 | } |
| 516 | 516 | |
| 517 | 517 | return new MorphTo($this, $morphType, $foreignKey, $alias, $relation); |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $name = basename(str_replace('\\', '/', $name)); |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - return Loader::parseName($name) . '_id'; |
|
| 550 | + return Loader::parseName($name).'_id'; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $query->where($data); |
| 147 | 147 | $data = null; |
| 148 | 148 | } elseif ($data instanceof \Closure) { |
| 149 | - call_user_func_array($data, [ & $query]); |
|
| 149 | + call_user_func_array($data, [& $query]); |
|
| 150 | 150 | $data = null; |
| 151 | 151 | } elseif (is_null($data)) { |
| 152 | 152 | return false; |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if (false === strpos($field, '.')) { |
| 216 | - $field = '__TABLE__.' . $field; |
|
| 216 | + $field = '__TABLE__.'.$field; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (!$read && strpos($field, '.')) { |
@@ -231,7 +231,7 @@ |
||
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return $this->query |
| 234 | - ->whereExp($this->morphKey, '=' . $this->parent->getTable() . '.' . $this->parent->getPk()) |
|
| 234 | + ->whereExp($this->morphKey, '='.$this->parent->getTable().'.'.$this->parent->getPk()) |
|
| 235 | 235 | ->where($this->morphType, '=', $this->type) |
| 236 | 236 | ->fetchSql() |
| 237 | 237 | ->$aggregate($field); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // 关联查询 |
| 153 | 153 | $pk = $this->parent->getPk(); |
| 154 | 154 | |
| 155 | - $condition[] = ['pivot.' . $localKey, '=', $this->parent->$pk]; |
|
| 155 | + $condition[] = ['pivot.'.$localKey, '=', $this->parent->$pk]; |
|
| 156 | 156 | |
| 157 | 157 | return $this->belongsToManyQuery($foreignKey, $localKey, $condition); |
| 158 | 158 | } |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | */ |
| 282 | 282 | public function wherePivot($field, $op = null, $condition = null) |
| 283 | 283 | { |
| 284 | - $this->query->where('pivot.' . $field, $op, $condition); |
|
| 284 | + $this->query->where('pivot.'.$field, $op, $condition); |
|
| 285 | 285 | return $this; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | if (!empty($range)) { |
| 312 | 312 | // 查询关联数据 |
| 313 | 313 | $data = $this->eagerlyManyToMany([ |
| 314 | - ['pivot.' . $localKey, 'in', $range], |
|
| 314 | + ['pivot.'.$localKey, 'in', $range], |
|
| 315 | 315 | ], $relation, $subRelation, $closure); |
| 316 | 316 | |
| 317 | 317 | // 关联属性名 |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | $pk = $result->$pk; |
| 346 | 346 | // 查询管理数据 |
| 347 | 347 | $data = $this->eagerlyManyToMany([ |
| 348 | - ['pivot.' . $this->localKey, '=', $pk], |
|
| 348 | + ['pivot.'.$this->localKey, '=', $pk], |
|
| 349 | 349 | ], $relation, $subRelation, $closure); |
| 350 | 350 | |
| 351 | 351 | // 关联数据封装 |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ |
| 389 | - ['pivot.' . $this->localKey, '=', $pk], |
|
| 389 | + ['pivot.'.$this->localKey, '=', $pk], |
|
| 390 | 390 | ])->$aggregate($field); |
| 391 | 391 | } |
| 392 | 392 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | |
| 412 | 412 | return $this->belongsToManyQuery($this->foreignKey, $this->localKey, [ |
| 413 | 413 | [ |
| 414 | - 'pivot.' . $this->localKey, 'exp', $this->query->raw('=' . $this->parent->getTable() . '.' . $this->parent->getPk()), |
|
| 414 | + 'pivot.'.$this->localKey, 'exp', $this->query->raw('='.$this->parent->getTable().'.'.$this->parent->getPk()), |
|
| 415 | 415 | ], |
| 416 | 416 | ])->fetchSql()->$aggregate($field); |
| 417 | 417 | } |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | |
| 480 | 480 | if (empty($this->baseQuery)) { |
| 481 | 481 | $relationFk = $this->query->getPk(); |
| 482 | - $query->join([$table => 'pivot'], 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk) |
|
| 482 | + $query->join([$table => 'pivot'], 'pivot.'.$foreignKey.'='.$tableName.'.'.$relationFk) |
|
| 483 | 483 | ->where($condition); |
| 484 | 484 | } |
| 485 | 485 | |
@@ -701,8 +701,8 @@ discard block |
||
| 701 | 701 | $table = $this->pivot->getTable(); |
| 702 | 702 | |
| 703 | 703 | $this->query |
| 704 | - ->join([$table => 'pivot'], 'pivot.' . $this->foreignKey . '=' . $this->query->getTable() . '.' . $this->query->getPk()) |
|
| 705 | - ->where('pivot.' . $this->localKey, $this->parent->$pk); |
|
| 704 | + ->join([$table => 'pivot'], 'pivot.'.$this->foreignKey.'='.$this->query->getTable().'.'.$this->query->getPk()) |
|
| 705 | + ->where('pivot.'.$this->localKey, $this->parent->$pk); |
|
| 706 | 706 | $this->baseQuery = true; |
| 707 | 707 | } |
| 708 | 708 | } |
@@ -17,13 +17,13 @@ |
||
| 17 | 17 | { |
| 18 | 18 | |
| 19 | 19 | if ($e instanceof \ParseError) { |
| 20 | - $message = 'Parse error: ' . $e->getMessage(); |
|
| 20 | + $message = 'Parse error: '.$e->getMessage(); |
|
| 21 | 21 | $severity = E_PARSE; |
| 22 | 22 | } elseif ($e instanceof \TypeError) { |
| 23 | - $message = 'Type error: ' . $e->getMessage(); |
|
| 23 | + $message = 'Type error: '.$e->getMessage(); |
|
| 24 | 24 | $severity = E_RECOVERABLE_ERROR; |
| 25 | 25 | } else { |
| 26 | - $message = 'Fatal error: ' . $e->getMessage(); |
|
| 26 | + $message = 'Fatal error: '.$e->getMessage(); |
|
| 27 | 27 | $severity = E_ERROR; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if (Container::get('app')->config('log.record_trace')) { |
| 59 | - $log .= "\r\n" . $exception->getTraceAsString(); |
|
| 59 | + $log .= "\r\n".$exception->getTraceAsString(); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | Container::get('log')->record($log, 'error'); |
@@ -237,10 +237,10 @@ discard block |
||
| 237 | 237 | |
| 238 | 238 | if (strpos($message, ':')) { |
| 239 | 239 | $name = strstr($message, ':', true); |
| 240 | - $message = $lang->has($name) ? $lang->get($name) . strstr($message, ':') : $message; |
|
| 240 | + $message = $lang->has($name) ? $lang->get($name).strstr($message, ':') : $message; |
|
| 241 | 241 | } elseif (strpos($message, ',')) { |
| 242 | 242 | $name = strstr($message, ',', true); |
| 243 | - $message = $lang->has($name) ? $lang->get($name) . ':' . substr(strstr($message, ','), 1) : $message; |
|
| 243 | + $message = $lang->has($name) ? $lang->get($name).':'.substr(strstr($message, ','), 1) : $message; |
|
| 244 | 244 | } elseif ($lang->has($message)) { |
| 245 | 245 | $message = $lang->get($message); |
| 246 | 246 | } |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | $name = Loader::parseName(substr($method, 5)); |
| 170 | 170 | array_unshift($args, $name); |
| 171 | 171 | return call_user_func_array([$this, 'where'], $args); |
| 172 | - } elseif ($this->model && method_exists($this->model, 'scope' . $method)) { |
|
| 172 | + } elseif ($this->model && method_exists($this->model, 'scope'.$method)) { |
|
| 173 | 173 | // 动态调用命名范围 |
| 174 | - $method = 'scope' . $method; |
|
| 174 | + $method = 'scope'.$method; |
|
| 175 | 175 | array_unshift($args, $this); |
| 176 | 176 | |
| 177 | 177 | call_user_func_array([$this->model, $method], $args); |
| 178 | 178 | return $this; |
| 179 | 179 | } else { |
| 180 | - throw new Exception('method not exist:' . ($this->model ? get_class($this->model) : static::class) . '->' . $method); |
|
| 180 | + throw new Exception('method not exist:'.($this->model ? get_class($this->model) : static::class).'->'.$method); |
|
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $name = $name ?: $this->name; |
| 298 | 298 | |
| 299 | - return $this->prefix . Loader::parseName($name); |
|
| 299 | + return $this->prefix.Loader::parseName($name); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | /** |
@@ -568,16 +568,16 @@ discard block |
||
| 568 | 568 | $seq = (ord($value{0}) % $rule['num']) + 1; |
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | - return $this->getTable() . '_' . $seq; |
|
| 571 | + return $this->getTable().'_'.$seq; |
|
| 572 | 572 | } |
| 573 | 573 | // 当设置的分表字段不在查询条件或者数据中 |
| 574 | 574 | // 进行联合查询,必须设定 partition['num'] |
| 575 | 575 | $tableName = []; |
| 576 | 576 | for ($i = 0; $i < $rule['num']; $i++) { |
| 577 | - $tableName[] = 'SELECT * FROM ' . $this->getTable() . '_' . ($i + 1); |
|
| 577 | + $tableName[] = 'SELECT * FROM '.$this->getTable().'_'.($i + 1); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | - return ['( ' . implode(" UNION ", $tableName) . ' )' => $this->name]; |
|
| 580 | + return ['( '.implode(" UNION ", $tableName).' )' => $this->name]; |
|
| 581 | 581 | } |
| 582 | 582 | |
| 583 | 583 | /** |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | // 支持GROUP |
| 644 | 644 | $options = $this->getOptions(); |
| 645 | 645 | $subSql = $this->options($options) |
| 646 | - ->field('count(' . $field . ') AS think_count') |
|
| 646 | + ->field('count('.$field.') AS think_count') |
|
| 647 | 647 | ->bind($this->bind) |
| 648 | 648 | ->buildSql(); |
| 649 | 649 | |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | if ($lazyTime > 0) { |
| 748 | 748 | // 延迟写入 |
| 749 | - $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); |
|
| 749 | + $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition)); |
|
| 750 | 750 | $step = $this->lazyWrite('inc', $guid, $step, $lazyTime); |
| 751 | 751 | |
| 752 | 752 | if (false === $step) { |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | if ($lazyTime > 0) { |
| 781 | 781 | // 延迟写入 |
| 782 | - $guid = md5($this->getTable() . '_' . $field . '_' . serialize($condition)); |
|
| 782 | + $guid = md5($this->getTable().'_'.$field.'_'.serialize($condition)); |
|
| 783 | 783 | $step = $this->lazyWrite('dec', $guid, $step, $lazyTime); |
| 784 | 784 | |
| 785 | 785 | if (false === $step) { |
@@ -810,15 +810,15 @@ discard block |
||
| 810 | 810 | { |
| 811 | 811 | $cache = Container::get('cache'); |
| 812 | 812 | |
| 813 | - if (!$cache->has($guid . '_time')) { |
|
| 813 | + if (!$cache->has($guid.'_time')) { |
|
| 814 | 814 | // 计时开始 |
| 815 | - $cache->set($guid . '_time', time(), 0); |
|
| 815 | + $cache->set($guid.'_time', time(), 0); |
|
| 816 | 816 | $cache->$type($guid, $step); |
| 817 | - } elseif (time() > $cache->get($guid . '_time') + $lazyTime) { |
|
| 817 | + } elseif (time() > $cache->get($guid.'_time') + $lazyTime) { |
|
| 818 | 818 | // 删除缓存 |
| 819 | 819 | $value = $cache->$type($guid, $step); |
| 820 | 820 | $cache->rm($guid); |
| 821 | - $cache->rm($guid . '_time'); |
|
| 821 | + $cache->rm($guid.'_time'); |
|
| 822 | 822 | return 0 === $value ? false : $value; |
| 823 | 823 | } else { |
| 824 | 824 | // 更新缓存 |
@@ -1017,10 +1017,10 @@ discard block |
||
| 1017 | 1017 | $prefix = $prefix ?: $tableName; |
| 1018 | 1018 | foreach ($field as $key => &$val) { |
| 1019 | 1019 | if (is_numeric($key) && $alias) { |
| 1020 | - $field[$prefix . '.' . $val] = $alias . $val; |
|
| 1020 | + $field[$prefix.'.'.$val] = $alias.$val; |
|
| 1021 | 1021 | unset($field[$key]); |
| 1022 | 1022 | } elseif (is_numeric($key)) { |
| 1023 | - $val = $prefix . '.' . $val; |
|
| 1023 | + $val = $prefix.'.'.$val; |
|
| 1024 | 1024 | } |
| 1025 | 1025 | } |
| 1026 | 1026 | } |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | $table = $this->getJoinTable($join, $alias); |
| 1148 | 1148 | |
| 1149 | 1149 | if (true === $field) { |
| 1150 | - $fields = $alias . '.*'; |
|
| 1150 | + $fields = $alias.'.*'; |
|
| 1151 | 1151 | } else { |
| 1152 | 1152 | if (is_string($field)) { |
| 1153 | 1153 | $field = explode(',', $field); |
@@ -1155,17 +1155,17 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | foreach ($field as $key => $val) { |
| 1157 | 1157 | if (is_numeric($key)) { |
| 1158 | - $fields[] = $alias . '.' . $val; |
|
| 1158 | + $fields[] = $alias.'.'.$val; |
|
| 1159 | 1159 | |
| 1160 | - $this->options['map'][$val] = $alias . '.' . $val; |
|
| 1160 | + $this->options['map'][$val] = $alias.'.'.$val; |
|
| 1161 | 1161 | } else { |
| 1162 | 1162 | if (preg_match('/[,=\.\'\"\(\s]/', $key)) { |
| 1163 | 1163 | $name = $key; |
| 1164 | 1164 | } else { |
| 1165 | - $name = $alias . '.' . $key; |
|
| 1165 | + $name = $alias.'.'.$key; |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | - $fields[] = $name . ' AS ' . $val; |
|
| 1168 | + $fields[] = $name.' AS '.$val; |
|
| 1169 | 1169 | |
| 1170 | 1170 | $this->options['map'][$val] = $name; |
| 1171 | 1171 | } |
@@ -1478,9 +1478,9 @@ discard block |
||
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | if (is_numeric($key)) { |
| 1481 | - $sql = substr_replace($sql, ':' . $name, strpos($sql, '?'), 1); |
|
| 1481 | + $sql = substr_replace($sql, ':'.$name, strpos($sql, '?'), 1); |
|
| 1482 | 1482 | } else { |
| 1483 | - $sql = str_replace(':' . $key, ':' . $name, $sql); |
|
| 1483 | + $sql = str_replace(':'.$key, ':'.$name, $sql); |
|
| 1484 | 1484 | } |
| 1485 | 1485 | } |
| 1486 | 1486 | } |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | } |
| 1525 | 1525 | |
| 1526 | 1526 | if (is_string($field) && !empty($this->options['via']) && false === strpos($field, '.')) { |
| 1527 | - $field = $this->options['via'] . '.' . $field; |
|
| 1527 | + $field = $this->options['via'].'.'.$field; |
|
| 1528 | 1528 | } |
| 1529 | 1529 | |
| 1530 | 1530 | if ($field instanceof Expression) { |
@@ -1708,7 +1708,7 @@ discard block |
||
| 1708 | 1708 | list($offset, $length) = explode(',', $offset); |
| 1709 | 1709 | } |
| 1710 | 1710 | |
| 1711 | - $this->options['limit'] = intval($offset) . ($length ? ',' . intval($length) : ''); |
|
| 1711 | + $this->options['limit'] = intval($offset).($length ? ','.intval($length) : ''); |
|
| 1712 | 1712 | |
| 1713 | 1713 | return $this; |
| 1714 | 1714 | } |
@@ -1765,7 +1765,7 @@ discard block |
||
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | 1767 | /** @var Paginator $class */ |
| 1768 | - $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\' . ucwords($config['type']); |
|
| 1768 | + $class = false !== strpos($config['type'], '\\') ? $config['type'] : '\\think\\paginator\\driver\\'.ucwords($config['type']); |
|
| 1769 | 1769 | $page = isset($config['page']) ? (int) $config['page'] : call_user_func([ |
| 1770 | 1770 | $class, |
| 1771 | 1771 | 'getCurrentPage', |
@@ -1875,7 +1875,7 @@ discard block |
||
| 1875 | 1875 | |
| 1876 | 1876 | if (is_string($field)) { |
| 1877 | 1877 | if (!empty($this->options['via'])) { |
| 1878 | - $field = $this->options['via'] . '.' . $field; |
|
| 1878 | + $field = $this->options['via'].'.'.$field; |
|
| 1879 | 1879 | } |
| 1880 | 1880 | |
| 1881 | 1881 | if (strpos($field, ',')) { |
@@ -1886,9 +1886,9 @@ discard block |
||
| 1886 | 1886 | } elseif (!empty($this->options['via'])) { |
| 1887 | 1887 | foreach ($field as $key => $val) { |
| 1888 | 1888 | if (is_numeric($key)) { |
| 1889 | - $field[$key] = $this->options['via'] . '.' . $val; |
|
| 1889 | + $field[$key] = $this->options['via'].'.'.$val; |
|
| 1890 | 1890 | } else { |
| 1891 | - $field[$this->options['via'] . '.' . $key] = $val; |
|
| 1891 | + $field[$this->options['via'].'.'.$key] = $val; |
|
| 1892 | 1892 | unset($field[$key]); |
| 1893 | 1893 | } |
| 1894 | 1894 | } |
@@ -2300,7 +2300,7 @@ discard block |
||
| 2300 | 2300 | if ($this->model) { |
| 2301 | 2301 | // 检查模型类的查询范围方法 |
| 2302 | 2302 | foreach ($scope as $name) { |
| 2303 | - $method = 'scope' . trim($name); |
|
| 2303 | + $method = 'scope'.trim($name); |
|
| 2304 | 2304 | |
| 2305 | 2305 | if (method_exists($this->model, $method)) { |
| 2306 | 2306 | call_user_func_array([$this->model, $method], $args); |
@@ -2327,7 +2327,7 @@ discard block |
||
| 2327 | 2327 | } elseif ($this->model) { |
| 2328 | 2328 | // 检测搜索器 |
| 2329 | 2329 | $fieldName = is_numeric($key) ? $field : $key; |
| 2330 | - $method = 'search' . Loader::parseName($fieldName, 1) . 'Attr'; |
|
| 2330 | + $method = 'search'.Loader::parseName($fieldName, 1).'Attr'; |
|
| 2331 | 2331 | |
| 2332 | 2332 | if (method_exists($this->model, $method)) { |
| 2333 | 2333 | $this->model->$method($this, isset($data[$field]) ? $data[$field] : null, $data, $prefix); |
@@ -2392,7 +2392,7 @@ discard block |
||
| 2392 | 2392 | $op = is_array($range) ? 'between' : '>='; |
| 2393 | 2393 | } |
| 2394 | 2394 | |
| 2395 | - return $this->parseWhereExp($logic, $field, strtolower($op) . ' time', $range, [], true); |
|
| 2395 | + return $this->parseWhereExp($logic, $field, strtolower($op).' time', $range, [], true); |
|
| 2396 | 2396 | } |
| 2397 | 2397 | |
| 2398 | 2398 | /** |
@@ -2470,7 +2470,7 @@ discard block |
||
| 2470 | 2470 | if (is_array($value)) { |
| 2471 | 2471 | $this->bind = array_merge($this->bind, $value); |
| 2472 | 2472 | } else { |
| 2473 | - $name = $name ?: 'ThinkBind_' . (count($this->bind) + 1) . '_'; |
|
| 2473 | + $name = $name ?: 'ThinkBind_'.(count($this->bind) + 1).'_'; |
|
| 2474 | 2474 | |
| 2475 | 2475 | $this->bind[$name] = [$value, $type]; |
| 2476 | 2476 | return $name; |
@@ -2687,10 +2687,10 @@ discard block |
||
| 2687 | 2687 | $count = $this->model->$relation()->getRelationCountQuery($closure, $aggregate, $field, $aggregateField); |
| 2688 | 2688 | |
| 2689 | 2689 | if (empty($aggregateField)) { |
| 2690 | - $aggregateField = Loader::parseName($relation) . '_' . $aggregate; |
|
| 2690 | + $aggregateField = Loader::parseName($relation).'_'.$aggregate; |
|
| 2691 | 2691 | } |
| 2692 | 2692 | |
| 2693 | - $this->field(['(' . $count . ')' => $aggregateField]); |
|
| 2693 | + $this->field(['('.$count.')' => $aggregateField]); |
|
| 2694 | 2694 | } |
| 2695 | 2695 | } |
| 2696 | 2696 | |
@@ -3409,10 +3409,10 @@ discard block |
||
| 3409 | 3409 | { |
| 3410 | 3410 | if (!empty($this->model)) { |
| 3411 | 3411 | $class = get_class($this->model); |
| 3412 | - throw new ModelNotFoundException('model data Not Found:' . $class, $class, $options); |
|
| 3412 | + throw new ModelNotFoundException('model data Not Found:'.$class, $class, $options); |
|
| 3413 | 3413 | } |
| 3414 | 3414 | $table = is_array($options['table']) ? key($options['table']) : $options['table']; |
| 3415 | - throw new DataNotFoundException('table data not Found:' . $table, $table, $options); |
|
| 3415 | + throw new DataNotFoundException('table data not Found:'.$table, $table, $options); |
|
| 3416 | 3416 | } |
| 3417 | 3417 | |
| 3418 | 3418 | /** |
@@ -3548,7 +3548,7 @@ discard block |
||
| 3548 | 3548 | */ |
| 3549 | 3549 | public function buildSql($sub = true) |
| 3550 | 3550 | { |
| 3551 | - return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false); |
|
| 3551 | + return $sub ? '( '.$this->select(false).' )' : $this->select(false); |
|
| 3552 | 3552 | } |
| 3553 | 3553 | |
| 3554 | 3554 | /** |
@@ -3619,7 +3619,7 @@ discard block |
||
| 3619 | 3619 | } |
| 3620 | 3620 | |
| 3621 | 3621 | if (is_string($pk)) { |
| 3622 | - $key = isset($alias) ? $alias . '.' . $pk : $pk; |
|
| 3622 | + $key = isset($alias) ? $alias.'.'.$pk : $pk; |
|
| 3623 | 3623 | // 根据主键查询 |
| 3624 | 3624 | if (is_array($data)) { |
| 3625 | 3625 | $where[$pk] = isset($data[$pk]) ? [$key, '=', $data[$pk]] : [$key, 'in', $data]; |
@@ -3630,7 +3630,7 @@ discard block |
||
| 3630 | 3630 | // 根据复合主键查询 |
| 3631 | 3631 | foreach ($pk as $key) { |
| 3632 | 3632 | if (isset($data[$key])) { |
| 3633 | - $attr = isset($alias) ? $alias . '.' . $key : $key; |
|
| 3633 | + $attr = isset($alias) ? $alias.'.'.$key : $key; |
|
| 3634 | 3634 | $where[$key] = [$attr, '=', $data[$key]]; |
| 3635 | 3635 | } else { |
| 3636 | 3636 | throw new Exception('miss complex primary data'); |
@@ -3706,7 +3706,7 @@ discard block |
||
| 3706 | 3706 | $page = $page > 0 ? $page : 1; |
| 3707 | 3707 | $listRows = $listRows > 0 ? $listRows : (is_numeric($options['limit']) ? $options['limit'] : 20); |
| 3708 | 3708 | $offset = $listRows * ($page - 1); |
| 3709 | - $options['limit'] = $offset . ',' . $listRows; |
|
| 3709 | + $options['limit'] = $offset.','.$listRows; |
|
| 3710 | 3710 | } |
| 3711 | 3711 | |
| 3712 | 3712 | $this->options = $options; |
@@ -48,22 +48,22 @@ discard block |
||
| 48 | 48 | $array[] = $this->parseRand($query); |
| 49 | 49 | } else { |
| 50 | 50 | if (is_numeric($key)) { |
| 51 | - list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val . ' '); |
|
| 51 | + list($key, $sort) = explode(' ', strpos($val, ' ') ? $val : $val.' '); |
|
| 52 | 52 | } else { |
| 53 | 53 | $sort = $val; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | if (preg_match('/^[\w\.]+$/', $key)) { |
| 57 | 57 | $sort = strtoupper($sort); |
| 58 | - $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' ' . $sort : ''; |
|
| 59 | - $array[] = $this->parseKey($query, $key, true) . $sort; |
|
| 58 | + $sort = in_array($sort, ['ASC', 'DESC'], true) ? ' '.$sort : ''; |
|
| 59 | + $array[] = $this->parseKey($query, $key, true).$sort; |
|
| 60 | 60 | } else { |
| 61 | - throw new Exception('order express error:' . $key); |
|
| 61 | + throw new Exception('order express error:'.$key); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - return empty($array) ? '' : ' ORDER BY ' . implode(',', $array); |
|
| 66 | + return empty($array) ? '' : ' ORDER BY '.implode(',', $array); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -111,15 +111,15 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | if ($strict && !preg_match('/^[\w\.\*]+$/', $key)) { |
| 114 | - throw new Exception('not support data:' . $key); |
|
| 114 | + throw new Exception('not support data:'.$key); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | if ('*' != $key && !preg_match('/[,\'\"\*\(\)\[.\s]/', $key)) { |
| 118 | - $key = '[' . $key . ']'; |
|
| 118 | + $key = '['.$key.']'; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | if (isset($table)) { |
| 122 | - $key = '[' . $table . '].' . $key; |
|
| 122 | + $key = '['.$table.'].'.$key; |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | return $key; |
@@ -141,12 +141,12 @@ discard block |
||
| 141 | 141 | $limit = explode(',', $limit); |
| 142 | 142 | |
| 143 | 143 | if (count($limit) > 1) { |
| 144 | - $limitStr = '(T1.ROW_NUMBER BETWEEN ' . $limit[0] . ' + 1 AND ' . $limit[0] . ' + ' . $limit[1] . ')'; |
|
| 144 | + $limitStr = '(T1.ROW_NUMBER BETWEEN '.$limit[0].' + 1 AND '.$limit[0].' + '.$limit[1].')'; |
|
| 145 | 145 | } else { |
| 146 | - $limitStr = '(T1.ROW_NUMBER BETWEEN 1 AND ' . $limit[0] . ")"; |
|
| 146 | + $limitStr = '(T1.ROW_NUMBER BETWEEN 1 AND '.$limit[0].")"; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - return 'WHERE ' . $limitStr; |
|
| 149 | + return 'WHERE '.$limitStr; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public function selectInsert(Query $query, $fields, $table) |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | if (!empty($limit)) { |
| 35 | 35 | $limit = explode(',', $limit); |
| 36 | 36 | if (count($limit) > 1) { |
| 37 | - $limitStr .= ' LIMIT ' . $limit[1] . ' OFFSET ' . $limit[0] . ' '; |
|
| 37 | + $limitStr .= ' LIMIT '.$limit[1].' OFFSET '.$limit[0].' '; |
|
| 38 | 38 | } else { |
| 39 | - $limitStr .= ' LIMIT ' . $limit[0] . ' '; |
|
| 39 | + $limitStr .= ' LIMIT '.$limit[0].' '; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if (isset($table)) { |
| 91 | - $key = $table . '.' . $key; |
|
| 91 | + $key = $table.'.'.$key; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | return $key; |