修复8.2的兼容性

This commit is contained in:
yumo 2023-11-13 19:59:55 +08:00
parent 7cb03187a9
commit 469e711f28
10 changed files with 66 additions and 62 deletions

View File

@ -4,6 +4,7 @@
namespace app\common\model; namespace app\common\model;
use think\db\BaseQuery;
use think\db\exception\DataNotFoundException; use think\db\exception\DataNotFoundException;
use think\db\exception\DbException; use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException; use think\db\exception\ModelNotFoundException;
@ -120,9 +121,9 @@ trait ModelTrait
* @param null $eachFn 处理结果函数 * @param null $eachFn 处理结果函数
* @param array $params 分页参数 * @param array $params 分页参数
* @param int $limit 分页数 * @param int $limit 分页数
* @return ModelTrait * @return array
*/ */
public static function page($model = null, $eachFn = null, $params = [], $limit = 20): ModelTrait public static function page($model = null, $eachFn = null, $params = [], $limit = 20): array
{ {
if (is_numeric($eachFn) && is_numeric($model)) { if (is_numeric($eachFn) && is_numeric($model)) {
return parent::page($model, $eachFn); return parent::page($model, $eachFn);

View File

@ -20,11 +20,12 @@ class UrlLog extends BaseModel
if ($url_data) { if ($url_data) {
$this->where($urlWhere)->inc('pv')->update(); $this->where($urlWhere)->inc('pv')->update();
} else { } else {
$dataUrl['url'] = $url; $model = new self();
$dataUrl['pv'] = 1; $model->url = $url;
$dataUrl['title'] = $title; $model->pv = 1;
$dataUrl['date'] = $date_data; $model->title = $title;
$this->insertGetId($dataUrl); $model->date = $date_data;
$model->save();
} }
} }

View File

@ -30,12 +30,10 @@ class Base extends BaseController
protected function initialize() protected function initialize()
{ {
parent::initialize(); parent::initialize();
$this->userInfo = Session::get(Data::SESSION_KEY_USER_INFO);
$this->userId = Session::get(Data::SESSION_KEY_USER_ID); $this->userId = Session::get(Data::SESSION_KEY_USER_ID);
if (!empty($this->userId)){
if ($this->userId){
//模板兼容性标签 //模板兼容性标签
$this->assign('user_info', $this->userInfo); $this->assign('user_info', Session::get(Data::SESSION_KEY_USER_INFO));
$this->assign('user_id', $this->userId); $this->assign('user_id', $this->userId);
} }
//判断是否关闭站点。 //判断是否关闭站点。

View File

@ -124,7 +124,7 @@
<div class="post-item-meta"> <div class="post-item-meta">
<div class="post-item-meta-item"> <div class="post-item-meta-item">
<span class="post-item-meta-author"> <span class="post-item-meta-author">
<!-- <img src="{$field['avatar']}" width="24" height="24" alt="头像" class="avatar avatar-24 wp-user-avatar wp-user-avatar-24 photo avatar-default post-item-avatar">--> <!-- <img src="" width="24" height="24" alt="头像" class="avatar avatar-24 wp-user-avatar wp-user-avatar-24 photo avatar-default post-item-avatar">-->
{$field['author']} {$field['author']}
</span> </span>
<span class="post-item-time">{$field['create_time']}</span> <span class="post-item-time">{$field['create_time']}</span>

View File

@ -44,7 +44,7 @@
<div class="menu-mobile"> <div class="menu-mobile">
<ul class="menu-mobile-header-list"> <ul class="menu-mobile-header-list">
{ape:nav type="all"} {ape:nav type="all"}
<li id="menu-item-{$field.id}" class="menu-item {notempty name="field['child']"}menu-item-has-children{/notempty} {:is_active_nav($cid,$field['id'])?'current-menu-item current_page_item':''} menu-item-{$field['id']}"> <li id="menu-item-{$field.id}" class="menu-item {notempty name="field['child']"}menu-item-has-children {:is_active_nav($cid,$field['pid'])?'current-menu-item current_page_item':''} {else} {:is_active_nav($cid,$field['id'])?'current-menu-item current_page_item':''} {/notempty} menu-item-{$field['id']}">
{notempty name="field['child']"} {notempty name="field['child']"}
<a href="#" aria-current="page">{$field['title']}</a> <a href="#" aria-current="page">{$field['title']}</a>
{else /} {else /}

View File

@ -1365,17 +1365,17 @@
}, },
{ {
"name": "symfony/http-foundation", "name": "symfony/http-foundation",
"version": "v5.4.28", "version": "v5.4.30",
"version_normalized": "5.4.28.0", "version_normalized": "5.4.30.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/http-foundation.git",
"reference": "365992c83a836dfe635f1e903ccca43ee03d3dd2" "reference": "671769f79de0532da1478c60968b42506e185d2e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/365992c83a836dfe635f1e903ccca43ee03d3dd2", "url": "https://api.github.com/repos/symfony/http-foundation/zipball/671769f79de0532da1478c60968b42506e185d2e",
"reference": "365992c83a836dfe635f1e903ccca43ee03d3dd2", "reference": "671769f79de0532da1478c60968b42506e185d2e",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -1402,7 +1402,7 @@
"suggest": { "suggest": {
"symfony/mime": "To use the file extension guesser" "symfony/mime": "To use the file extension guesser"
}, },
"time": "2023-08-21T07:23:18+00:00", "time": "2023-10-28T23:35:12+00:00",
"type": "library", "type": "library",
"installation-source": "dist", "installation-source": "dist",
"autoload": { "autoload": {
@ -1430,7 +1430,7 @@
"description": "Defines an object-oriented layer for the HTTP specification", "description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/http-foundation/tree/v5.4.28" "source": "https://github.com/symfony/http-foundation/tree/v5.4.30"
}, },
"funding": [ "funding": [
{ {

View File

@ -3,7 +3,7 @@
'name' => 'topthink/think', 'name' => 'topthink/think',
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => 'a284ab8feb3db76d633b4d2320202e59e209a9a0', 'reference' => '7cb03187a94546bb6ec2c895b331743c8c72fce9',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
@ -194,9 +194,9 @@
), ),
), ),
'symfony/http-foundation' => array( 'symfony/http-foundation' => array(
'pretty_version' => 'v5.4.28', 'pretty_version' => 'v5.4.30',
'version' => '5.4.28.0', 'version' => '5.4.30.0',
'reference' => '365992c83a836dfe635f1e903ccca43ee03d3dd2', 'reference' => '671769f79de0532da1478c60968b42506e185d2e',
'type' => 'library', 'type' => 'library',
'install_path' => __DIR__ . '/../symfony/http-foundation', 'install_path' => __DIR__ . '/../symfony/http-foundation',
'aliases' => array(), 'aliases' => array(),
@ -295,7 +295,7 @@
'topthink/think' => array( 'topthink/think' => array(
'pretty_version' => 'dev-master', 'pretty_version' => 'dev-master',
'version' => 'dev-master', 'version' => 'dev-master',
'reference' => 'a284ab8feb3db76d633b4d2320202e59e209a9a0', 'reference' => '7cb03187a94546bb6ec2c895b331743c8c72fce9',
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2023-10-18 19:05:37 // This file is automatically generated at:2023-11-03 23:08:15
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\captcha\\CaptchaService', 0 => 'think\\captcha\\CaptchaService',

View File

@ -33,17 +33,21 @@ class HeaderUtils
* *
* Example: * Example:
* *
* HeaderUtils::split("da, en-gb;q=0.8", ",;") * HeaderUtils::split('da, en-gb;q=0.8', ',;')
* // => ['da'], ['en-gb', 'q=0.8']] * // => ['da'], ['en-gb', 'q=0.8']]
* *
* @param string $separators List of characters to split on, ordered by * @param string $separators List of characters to split on, ordered by
* precedence, e.g. ",", ";=", or ",;=" * precedence, e.g. ',', ';=', or ',;='
* *
* @return array Nested array with as many levels as there are characters in * @return array Nested array with as many levels as there are characters in
* $separators * $separators
*/ */
public static function split(string $header, string $separators): array public static function split(string $header, string $separators): array
{ {
if ('' === $separators) {
throw new \InvalidArgumentException('At least one separator must be specified.');
}
$quotedSeparators = preg_quote($separators, '/'); $quotedSeparators = preg_quote($separators, '/');
preg_match_all(' preg_match_all('
@ -77,8 +81,8 @@ class HeaderUtils
* *
* Example: * Example:
* *
* HeaderUtils::combine([["foo", "abc"], ["bar"]]) * HeaderUtils::combine([['foo', 'abc'], ['bar']])
* // => ["foo" => "abc", "bar" => true] * // => ['foo' => 'abc', 'bar' => true]
*/ */
public static function combine(array $parts): array public static function combine(array $parts): array
{ {
@ -95,13 +99,13 @@ class HeaderUtils
/** /**
* Joins an associative array into a string for use in an HTTP header. * Joins an associative array into a string for use in an HTTP header.
* *
* The key and value of each entry are joined with "=", and all entries * The key and value of each entry are joined with '=', and all entries
* are joined with the specified separator and an additional space (for * are joined with the specified separator and an additional space (for
* readability). Values are quoted if necessary. * readability). Values are quoted if necessary.
* *
* Example: * Example:
* *
* HeaderUtils::toString(["foo" => "abc", "bar" => true, "baz" => "a b c"], ",") * HeaderUtils::toString(['foo' => 'abc', 'bar' => true, 'baz' => 'a b c'], ',')
* // => 'foo=abc, bar, baz="a b c"' * // => 'foo=abc, bar, baz="a b c"'
*/ */
public static function toString(array $assoc, string $separator): string public static function toString(array $assoc, string $separator): string
@ -252,40 +256,37 @@ class HeaderUtils
private static function groupParts(array $matches, string $separators, bool $first = true): array private static function groupParts(array $matches, string $separators, bool $first = true): array
{ {
$separator = $separators[0]; $separator = $separators[0];
$partSeparators = substr($separators, 1); $separators = substr($separators, 1);
$i = 0; $i = 0;
if ('' === $separators && !$first) {
$parts = [''];
foreach ($matches as $match) {
if (!$i && isset($match['separator'])) {
$i = 1;
$parts[1] = '';
} else {
$parts[$i] .= self::unquote($match[0]);
}
}
return $parts;
}
$parts = [];
$partMatches = []; $partMatches = [];
$previousMatchWasSeparator = false;
foreach ($matches as $match) { foreach ($matches as $match) {
if (!$first && $previousMatchWasSeparator && isset($match['separator']) && $match['separator'] === $separator) { if (($match['separator'] ?? null) === $separator) {
$previousMatchWasSeparator = true;
$partMatches[$i][] = $match;
} elseif (isset($match['separator']) && $match['separator'] === $separator) {
$previousMatchWasSeparator = true;
++$i; ++$i;
} else { } else {
$previousMatchWasSeparator = false;
$partMatches[$i][] = $match; $partMatches[$i][] = $match;
} }
} }
$parts = []; foreach ($partMatches as $matches) {
if ($partSeparators) { $parts[] = '' === $separators ? self::unquote($matches[0][0]) : self::groupParts($matches, $separators, false);
foreach ($partMatches as $matches) {
$parts[] = self::groupParts($matches, $partSeparators, false);
}
} else {
foreach ($partMatches as $matches) {
$parts[] = self::unquote($matches[0][0]);
}
if (!$first && 2 < \count($parts)) {
$parts = [
$parts[0],
implode($separator, \array_slice($parts, 1)),
];
}
} }
return $parts; return $parts;

View File

@ -94,27 +94,30 @@ class CustomComponent implements CustomComponentInterface, \JsonSerializable, \A
return $this->appendRule + $this->getRule(); return $this->appendRule + $this->getRule();
} }
public function jsonSerialize() /**
* @return void
*/
public function jsonSerialize(): mixed
{ {
return $this->build(); return $this->build();
} }
public function offsetExists($offset) public function offsetExists($offset):bool
{ {
return isset($this->props[$offset]); return isset($this->props[$offset]);
} }
public function offsetGet($offset) public function offsetGet($offset): mixed
{ {
return $this->props[$offset]; return $this->props[$offset];
} }
public function offsetSet($offset, $value) public function offsetSet($offset, $value) : void
{ {
$this->props[$offset] = $value; $this->props[$offset] = $value;
} }
public function offsetUnset($offset) public function offsetUnset($offset): void
{ {
unset($this->props[$offset]); unset($this->props[$offset]);
} }