fix:修复BUG/升级1.1.6版本

This commit is contained in:
Ying
2023-04-25 20:11:49 +08:00
parent 445e5f9662
commit 6a6866bbaf
2357 changed files with 456920 additions and 140567 deletions

View File

@@ -20,9 +20,8 @@ class ExceptionHandle extends ExceptionHandler
];
/**
*
* 异常日志记录
* @param Throwable $exception
* @return void|mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
@@ -30,8 +29,8 @@ class ExceptionHandle extends ExceptionHandler
public function report(Throwable $exception)
{
try {
if (saenv('system_exception')
&& !empty($exception->getMessage())) {
if (saenv('system_exception') && !empty($exception->getMessage())) {
$data = [
'module' => request()->app,
'controller' => request()->controller,
@@ -65,9 +64,12 @@ class ExceptionHandle extends ExceptionHandler
*/
public function render(Request $request, Throwable $exception): Response
{
if (!file_exists(root_path(). '.env')) {
if ($exception instanceof \RuntimeException) {
return \response($exception->getMessage());
}
if (!file_exists(root_path() . '.env')) {
return parent::render($request, $exception);
}
return getenv('APP_DEBUG') ? parent::render($request, $exception) : view(config('app.exception_tpl'), ['trace' => $exception]);
return get_env('APP_DEBUG') ? parent::render($request, $exception) : view(config('app.exception_tpl'), ['trace' => $exception]);
}
}

View File

@@ -35,7 +35,7 @@ class Auth
/**
* 用户ID
*/
public int $user_id = 0;
public mixed $user_id = 0;
/**
* 用户数据
@@ -103,7 +103,7 @@ class Auth
// 禁止批量注册
$where[] = ['create_ip', '=', request()->getRealIp()];
$where[] = ['create_time', '>', linux_extime(1)];
$where[] = ['create_time', '>', linux_time(1)];
$totalMax = UserModel::where($where)->count();
if ($totalMax >= saenv('user_register_second')) {

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\library;
@@ -22,7 +22,7 @@ class DataBase {
$sql = file_get_contents($sqlPath);
$sqlRecords = str_ireplace("\r", "\n", $sql);
$sqlRecords = explode(";\n", $sqlRecords);
$sqlRecords = str_replace("__PREFIX__", getenv('DATABASE_PREFIX'), $sqlRecords);
$sqlRecords = str_replace("__PREFIX__", get_env('DATABASE_PREFIX'), $sqlRecords);
foreach ($sqlRecords as $line) {
if (empty($line)) {
continue;
@@ -49,7 +49,7 @@ class DataBase {
preg_match_all($regex, file_get_contents($sqlFile), $matches);
if (isset($matches[2])) {
foreach ($matches[2] as $match) {
$tables[] = str_replace('__PREFIX__', getenv('DATABASE_PREFIX'), $match);
$tables[] = str_replace('__PREFIX__', get_env('DATABASE_PREFIX'), $match);
}
}
}

View File

@@ -5,7 +5,7 @@
* @author chenxin<chenxin619315@gmail.com>
* @date 2015-10-29
*/
declare (strict_types = 1);
namespace app\common\library;
use Exception;
defined('INDEX_BLOCK_LENGTH') or define('INDEX_BLOCK_LENGTH', 12);

View File

@@ -12,8 +12,6 @@ declare(strict_types=1);
// +----------------------------------------------------------------------
namespace app\common\library;
use Psr\SimpleCache\InvalidArgumentException;
/**
* 全局模型数据处理类
* 1、自动设置字段属性
@@ -21,7 +19,6 @@ use Psr\SimpleCache\InvalidArgumentException;
*/
class ParseData
{
/**
* 获取标题拼音
* @access public
@@ -55,7 +52,6 @@ class ParseData
return $letter;
}
/**
* 自动获取描述
* @access public
@@ -77,7 +73,7 @@ class ParseData
* @access public
* @param string $content
* @return string
* @throws InvalidArgumentException
*/
public static function setContentAttr(string $content): string
{
@@ -91,11 +87,11 @@ class ParseData
/**
* 获取内容数据
* @access public
* @param string $content
* @param $content
* @return string
* @throws InvalidArgumentException
*/
public static function getContentAttr(string $content): string
public static function getContentAttr($content): string
{
if (!empty($content)) {
@@ -114,7 +110,7 @@ class ParseData
}
}
return $content;
return $content ?? '';
}
/**
@@ -124,7 +120,7 @@ class ParseData
* @param $data
* @param bool $ready
* @return string
* @throws InvalidArgumentException
*/
public static function setImageAttr(string $image, $data, bool $ready = false): string
{
@@ -144,7 +140,7 @@ class ParseData
* @access public
* @param string $image
* @return string
* @throws InvalidArgumentException
*/
public static function getImageAttr(string $image): string
{
@@ -165,7 +161,6 @@ class ParseData
* @param string $image 图片地址
* @param bool $bool 链接OR替换
* @return string
* @throws InvalidArgumentException
*/
protected static function changeImages(string $image, bool $bool = true): string
{
@@ -193,4 +188,4 @@ class ParseData
return $skin;
}
}
}

View File

@@ -278,7 +278,7 @@ class Upload
try {
$this->getFileSavePath($file);
// 分片上传使用ID作为文件名
$this->resource = $this->filepath . DS . sha1($params['chunkId']) . '.' . $fileExt;
$this->resource = public_path(). $this->filepath . DS . sha1($params['chunkId']) . '.' . $fileExt;
$file->move($this->resource);
} catch (\Exception $e) {
Event::emit('uploadExceptionDelete', [

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;
use Psr\SimpleCache\InvalidArgumentException;
@@ -80,20 +80,18 @@ class User extends Model
*/
public function getAvatarAttr(string $value, array $data): string
{
if ($value && strpos($value,'://')) {
return $value;
}
if (empty($value)) {
$value = '/static/images/user_default.jpg';
}
$prefix = cdn_Prefix();
if (!empty($prefix) && $value) {
if (!str_contains($value,'data:image')) {
if (!str_contains($value,'data:image')
&& !str_contains($value,'http')) {
return $prefix.$value;
}
} else if (empty($value)) {
$value = '/static/images/user_default.jpg';
}
return $value;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -40,5 +40,4 @@ class UserNotice extends Model
// 钩子消息推送
Event::emit('sendUserNotice', $data);
}
}

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\model\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;

View File

@@ -1,5 +1,5 @@
<?php
declare (strict_types = 1);
namespace app\common\validate\system;
@@ -16,7 +16,7 @@ class UploadFile extends Validate
public $rule = [
'images'=>[
'fileSize' => 419430400,
'fileExt' => 'jpg,jpeg,png,bmp,gif,svg',
'fileExt' => 'jpg,jpeg,png,bmp,gif,svg,webp',
'fileMime' => 'image/jpeg,image/png,image/gif,image/svg+xml'],
'video'=>[
'fileSize' => 419430400,