fix:更新已知bug,优化代码

This commit is contained in:
Ying
2022-11-28 19:11:12 +08:00
parent f6aee95cfc
commit 9445b206a2
1378 changed files with 53759 additions and 20789 deletions

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
// +----------------------------------------------------------------------
namespace app\common\library;
use app\common\model\system\UserLog;
use system\Random;
use support\Response;
use think\facade\Cache;
@@ -25,30 +26,30 @@ class Auth
* token令牌
* @var string
*/
public $token = null;
public string $token;
/**
* 用户数据
* @var object|array
*/
public $userInfo = null;
public mixed $userData;
/**
* 保活时间
* @var string
* @var int
*/
protected $keepTime = 604800;
protected int $keepTime = 604800;
/**
* 错误信息
* @var string
*/
protected $_error = '';
protected string $_error = '';
/**
* @var object 对象实例
*/
protected static $instance = null;
protected static $instance;
/**
* 类构造函数
@@ -78,7 +79,7 @@ class Auth
/**
* 用户注册
* @param array $post
* @return false|mixed
* @return bool
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws \think\db\exception\DbException
*/
@@ -127,9 +128,9 @@ class Auth
$post['pwd'] = encryptPwd($post['pwd'], $post['salt']);
}
$this->userInfo = UserModel::create($post);
$this->userData = UserModel::create($post);
return $this->responseToken($this->userInfo);
return $this->responseToken($this->userData);
} catch (\Throwable $th) {
$this->setError($th->getMessage());
@@ -154,31 +155,36 @@ class Auth
} else {
$where[] = ['mobile', '=', htmlspecialchars(trim($nickname))];
}
$this->userInfo = UserModel::where($where)->find();
$this->userData = UserModel::where($where)->find();
if (!empty($this->userInfo)) {
if (!empty($this->userData)) {
$uPwd = encryptPwd($pwd, $this->userData['salt']);
if ($this->userData['pwd'] !== $uPwd) {
$uPwd = encryptPwd($pwd, $this->userInfo['salt']);
if ($this->userInfo['pwd'] !== $uPwd) {
$this->setError('用户名或密码错误');
UserLog::write($this->getError(), $this->userData->nickname, $this->userData->id);
return false;
}
if (!$this->userInfo['status']) {
if (!$this->userData['status']) {
$this->setError('用户异常或未审核,请联系管理员');
UserLog::write($this->getError(), $this->userData->nickname, $this->userData->id);
return false;
}
// 更新登录数据
$userUpdate = [
'id' => $this->userInfo['id'],
'id' => $this->userData['id'],
'login_time' => time(),
'login_ip' => request()->getRealIp(),
'login_count' => $this->userInfo['login_count'] + 1,
'login_count' => $this->userData['login_count'] + 1,
];
if (UserModel::update($userUpdate)) {
return $this->responseToken($this->userInfo);
Event::emit('userLoginSuccess', $this->userData);
UserLog::write('登录成功', $this->userData->nickname, $this->userData->id, 1);
return $this->responseToken($this->userData);
}
}
@@ -199,12 +205,11 @@ class Auth
if (!$token) {
return false;
}
$uid = $this->checkToken($token);
if (!empty($uid)) {
$this->token = $token;
$this->userInfo = UserModel::find($uid);
$this->userData = UserModel::with('group')->find($uid);
return true;
}
@@ -224,20 +229,20 @@ class Auth
/**
*
* 返回前端令牌
* @param mixed $userInfo
* @param mixed $userData
* @param bool $token
* @return mixed
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function responseToken($userInfo, bool $token = false)
public function responseToken($userData, bool $token = false)
{
$this->token = $token ? $this->getToken() : $this->buildToken($userInfo['id']);
$this->token = $token ? $this->getToken() : $this->buildToken($userData['id']);
$response = response();
$response->cookie('uid', $userInfo['id'],$this->keepTime, '/');
$response->cookie('uid', $userData['id'],$this->keepTime, '/');
$response->cookie('token', $this->token,$this->keepTime, '/');
$response->cookie('nickname', $userInfo['nickname'],$this->keepTime, '/');
Cache::set($this->token, $userInfo['id'], $this->keepTime);
Event::emit("userLoginSuccess", $userInfo);
$response->cookie('nickname', $userData['nickname'],$this->keepTime, '/');
Cache::set($this->token, $userData['id'], $this->keepTime);
Event::emit("userLoginSuccess", $userData);
return $response;
}
@@ -266,13 +271,13 @@ class Auth
* 校验token
* @access protected
* @param $token
* @return mixed
* @return void
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function checkToken($token)
{
$userId = Cache::get($token);
return $userId ?? false;
$user_id = Cache::get($token);
return $user_id ?? false;
}
/**
@@ -287,8 +292,9 @@ class Auth
/**
* 设置错误
* @param string $error 信息信息
* @return void
*/
protected function setError(string $error)
protected function setError(string $error): void
{
$this->_error = $error;
}

View File

@@ -13,7 +13,6 @@ class DataBase {
/**
* 导入目录下Install.sql文件
* @param string $sqlPath
* @return void
*/
public static function importSql(string $sqlPath)
{
@@ -28,8 +27,7 @@ class DataBase {
}
try {
Db::getPdo()->exec($line);
} catch (\Throwable $th) {
}
} catch (\Throwable $th) {}
}
}
}

View File

@@ -14,8 +14,15 @@ declare(strict_types=1);
namespace app\common\library;
use app\common\model\system\UserValidate;
use PHPMailer\PHPMailer\Exception;
use PHPMailer\PHPMailer\PHPMailer;
use Psr\SimpleCache\InvalidArgumentException;
use system\Random;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\db\Query;
use think\Model;
/**
* 邮件发送类
@@ -32,28 +39,28 @@ class Email
/**
* @PHPMailer 对象实例
*/
protected $mail = [];
protected mixed $mail;
/**
* 验证码对象
* @var UserValidate
* @var mixed
*/
private $userVModel;
private mixed $userVModel;
/**
* 验证码过期时间
* @var string
* @var int
*/
private $expireTime = 5; //验证码过期时间(分钟)
private int $expireTime = 5; //验证码过期时间(分钟)
/**
* 错误信息
* @var string
*/
protected $_error = '';
protected string $_error = '';
//默认配置
protected $config = [
protected array $config = [
'smtp_debug' => false, // 是否调试
'smtp_host' => 'smtp.163.com', // 服务器地址
'smtp_port' => 587, // 服务器端口
@@ -65,6 +72,11 @@ class Email
/**
* 类构造函数
* class constructor.
* @throws Exception
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function __construct()
{
@@ -105,6 +117,11 @@ class Email
* @access public
* @param array $options 参数
* @return EMAIL
* @throws DataNotFoundException
* @throws DbException
* @throws Exception
* @throws InvalidArgumentException
* @throws ModelNotFoundException
*/
public static function instance($options = [])
{
@@ -158,10 +175,10 @@ class Email
/**
* 设置收件人
* @param mixed $email 收件人,多个收件人以,进行分隔
* @param string $name 收件人名称
* @param $email
* @param string $name
* @return $this
* @throws \PHPMailer\PHPMailer\Exception
* @throws Exception
*/
public function to($email, string $name = ''): Email
{
@@ -191,7 +208,7 @@ class Email
/**
* 构建Email地址
* @param mixed $emails Email数据
* @param $emails
* @return array
*/
protected function buildAddress($emails): array
@@ -209,10 +226,10 @@ class Email
/**
* 获取最后一条
* @param string $email
* @return UserValidate|array|mixed|\think\Model|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function getLast(string $email)
{
@@ -297,7 +314,7 @@ class Email
* 设置错误
* @param string $error 信息信息
*/
protected function setError(string $error)
protected function setError(string $error): void
{
$this->_error = $error;
}
@@ -321,13 +338,10 @@ class Email
}
/**
* 测试发送
* @return boolean
* @throws \PHPMailer\PHPMailer\Exception
* 测试发送邮件
*/
public function testEmail($config)
{
if (empty($config) || !is_array($config)) {
return '缺少必要的信息';
}

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
// +----------------------------------------------------------------------
namespace app\common\library;
use support\Log;
use system\Random;
/**
@@ -27,7 +28,7 @@ class Ftp
protected static $instance = null;
//默认配置
protected $config = [
protected array $config = [
'upload_ftp_host' => '127.0.0.1', // 服务器地址
'upload_ftp_port' => 21, // 服务器端口
'upload_ftp_user' => 'username', // FTP用户名
@@ -52,7 +53,6 @@ class Ftp
* @param array $options 参数
* @return Ftp
*/
public static function instance($options = [])
{
if (is_null(self::$instance)) {
@@ -120,7 +120,6 @@ class Ftp
*/
public function ftpTest(array $config): bool
{
$connect = @ftp_connect($config['host'], (int)$config['port']) or die('Could not connect');
if (@ftp_login($connect, $config['user'], $config['pass'])) {
@@ -145,11 +144,11 @@ class Ftp
}
} catch (\Throwable $th) {
return $th->getMessage();
Log::info('upload ftp ' . $th->getMessage());
return false;
}
}
return false;
}
}

View File

@@ -15,12 +15,10 @@ class Images
* @access public
* @param string $filename 文件路径
* @param array $config 配置数组
* @return mixed
* @throws \Exception
*/
public function waterMark(string $filename, array $config)
{
try {
// 获取文件信息
@@ -48,7 +46,6 @@ class Images
}
$ImageWaterInfo = getimagesize($config['upload_water_img']);
// 对比图片大小
if ($ImageWaterInfo[0] >= $ImageInfo[0] ||
$ImageWaterInfo[1] >= $ImageInfo[1]) {
@@ -74,6 +71,7 @@ class Images
* @param bool $avatar
* @param bool $newfile
* @return Image|void
* @throws \Exception
*/
public function thumb($filepath, $filename, $config, bool $avatar = false, bool $newfile = true)
{
@@ -95,10 +93,8 @@ class Images
// 保留原来的图片 新文件名建议源文件名+_thumb.jpg 格式
$resource = $filepath . '/thumb_' . $filename;
}
$resThumb = $Image->thumb($config['upload_thumb_w'], $config['upload_thumb_h'], 6)->save($resource, NULL, 90);
}
return $resThumb;
}
} catch (\Exception $e) {

View File

@@ -1,164 +0,0 @@
<?php
declare(strict_types=1);
// +----------------------------------------------------------------------
// | swiftAdmin 极速开发框架 [基于WebMan开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2020-2030 http://www.swiftadmin.net
// +----------------------------------------------------------------------
// | swiftAdmin.net High Speed Development Framework
// +----------------------------------------------------------------------
// | Author: meystack <coolsec@foxmail.com> Apache 2.0 License
// +----------------------------------------------------------------------
namespace app\common\library;
/**
* Jwt简易验证类
* Class Jwt
* @package app\common\library
* @author meystack <
*/
class Jwt
{
/**
* @var object 对象实例
*/
protected static $instance = null;
// 头部信息
private static $header = array(
'alg' => 'HS256', //生成signature的算法
'typ' => 'JWT' //类型
);
private static $key = '123456';
/**
* 类构造函数
* class constructor.
*/
public function __construct()
{
}
/**
* 初始化
* @access public
* @param array $options 参数
* @return Jwt
*/
public static function instance($options = [])
{
if (is_null(self::$instance)) {
self::$instance = new static($options);
}
// 返回实例
return self::$instance;
}
/**
* 获取jwt token
* @param $payload
* [
* 'iss'=>'jwt_admin', // 该JWT的签发者
* 'iat'=>time(), // 签发时间
* 'exp'=>time()+7200, // 过期时间
* 'nbf'=>time()+60, // 该时间之前不接收处理该Token
* 'sub'=>'www.admin.com', // 面向的用户
* 'jti'=>md5(uniqid('JWT').time()) // 该Token唯一标识
* ]
* @return bool|string
*/
public static function getToken($payload)
{
if (is_array($payload)) {
$base64header = self::base64UrlEncode(json_encode(self::$header, JSON_UNESCAPED_UNICODE));
$base64payload = self::base64UrlEncode(json_encode($payload, JSON_UNESCAPED_UNICODE));
return $base64header . '.' . $base64payload . '.' . self::signature($base64header . '.' . $base64payload, self::$key, self::$header['alg']);
} else {
return false;
}
}
/**
* 验证token是否有效,默认验证exp,nbf,iat时间
* @param string $Token 需要验证的token
* @return bool|string
*/
public static function verifyToken(string $Token)
{
$tokens = explode('.', $Token);
if (count($tokens) != 3)
return false;
list($base64header, $base64payload, $sign) = $tokens;
// 获取jwt算法
$base64DecodeHeader = json_decode(self::base64UrlDecode($base64header), JSON_OBJECT_AS_ARRAY);
if (empty($base64DecodeHeader['alg']))
return false;
// 签名验证
if (self::signature($base64header . '.' . $base64payload, self::$key, $base64DecodeHeader['alg']) !== $sign)
return false;
$payload = json_decode(self::base64UrlDecode($base64payload), JSON_OBJECT_AS_ARRAY);
// 签发时间大于当前服务器时间验证失败
if (isset($payload['iat']) && $payload['iat'] > time())
return false;
// 过期时间小宇当前服务器时间验证失败
if (isset($payload['exp']) && $payload['exp'] < time())
return false;
// 该nbf时间之前不接收处理该Token
if (isset($payload['nbf']) && $payload['nbf'] > time())
return false;
return $payload;
}
/**
* base64UrlEncode https://jwt.io/ 中base64UrlEncode编码实现
* @param string $input 需要编码的字符串
* @return string
*/
private static function base64UrlEncode(string $input): string
{
return str_replace('=', '', strtr(base64_encode($input), '+/', '-_'));
}
/**
* base64UrlEncode https://jwt.io/ 中base64UrlEncode解码实现
* @param string $input 需要解码的字符串
* @return bool|string
*/
private static function base64UrlDecode(string $input)
{
$remainder = strlen($input) % 4;
if ($remainder) {
$addLen = 4 - $remainder;
$input .= str_repeat('=', $addLen);
}
return base64_decode(strtr($input, '-_', '+/'));
}
/**
* HMACSHA256签名 https://jwt.io/ 中HMACSHA256签名实现
* @param string $input 为base64UrlEncode(header).".".base64UrlEncode(payload)
* @param string $key
* @param string $alg 算法方式
* @return string
*/
private static function signature(string $input, string $key, string $alg = 'HS256'): string
{
$alg_config = array(
'HS256' => 'sha256'
);
return self::base64UrlEncode(hash_hmac($alg_config[$alg], $input, $key, true));
}
}

View File

@@ -77,7 +77,7 @@ class ParseData
* @access public
* @param string $content
* @return string
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public static function setContentAttr(string $content): string
{
@@ -93,7 +93,7 @@ class ParseData
* @access public
* @param string $content
* @return string
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public static function getContentAttr(string $content): string
{
@@ -124,7 +124,7 @@ class ParseData
* @param $data
* @param bool $ready
* @return string
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public static function setImageAttr(string $image, $data, bool $ready = false): string
{
@@ -143,7 +143,8 @@ class ParseData
* 获取图片链接
* @access public
* @param string $image
* @return string
* @return string
* @throws InvalidArgumentException
*/
public static function getImageAttr(string $image): string
{
@@ -178,36 +179,6 @@ class ParseData
return $image;
}
/**
* 获取IP转换
* @access public
* @param $ip
* @return mixed
*/
public static function getIPAttr($ip)
{
if (!empty($ip)) {
$ip = long2ip($ip);
}
return $ip;
}
/**
* 设置IP转换
* @access public
* @param $ip
* @return mixed
*/
public static function setIPAttr($ip)
{
if (!empty($ip)) {
$ip = ip2long($ip);
}
return $ip;
}
/**
* 设置独立模板
* @access public

View File

@@ -0,0 +1,74 @@
<?php
declare (strict_types=1);
namespace app\common\library;
use Endroid\QrCode\Color\Color;
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh;
use Endroid\QrCode\Label\Alignment\LabelAlignmentCenter;
use Endroid\QrCode\Label\Font\NotoSans;
use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\Result\ResultInterface;
/**
* 生成二维码
* Class Qrcode
* @package app\common\library
* @author meystack
*/
class Qrcode
{
/**
* @param array $params
* @return ResultInterface
*/
public static function build(array $params = []): ResultInterface
{
$params['data'] = $params['data'] ?? 'Hello world!';
$params['size'] = $params['size'] ?? 280;
$params['margin'] = $params['margin'] ?? 0;
$params['format'] = $params['format'] ?? 'png';
$params['foreground'] = $params['foreground'] ?? "#000000";
$params['background'] = $params['background'] ?? "#ffffff";
$params['label'] = $params['label'] ?? '';
$params['logo'] = $params['logo'] ?? '';
$params['logosize'] = $params['logosize'] ?? 50;
// 二维码颜色
list($r, $g, $b) = sscanf($params['foreground'], "#%02x%02x%02x");
$foregroundColor = new Color($r, $g, $b);
// 背景色调
list($r, $g, $b) = sscanf($params['background'], "#%02x%02x%02x");
$backgroundColor = new Color($r, $g, $b);
// 创建对象
$qrcode = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data($params['data'])
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(new ErrorCorrectionLevelHigh())
->size((int)$params['size'])
->margin((int)$params['margin'])
->roundBlockSizeMode(new RoundBlockSizeModeMargin())
->foregroundColor($foregroundColor)
->backgroundColor($backgroundColor);
// 设置LOGO
if (!empty($params['logo'])) {
$qrcode = $qrcode->logoPath($params['logo'])
->logoResizeToWidth($params['logosize'])
->logoResizeToHeight($params['logosize']);
}
// 返回实例对象
return $qrcode->labelText($params['label'])
->labelFont(new NotoSans(20))
->labelAlignment(new LabelAlignmentCenter())
->build();
}
}

View File

@@ -11,7 +11,6 @@ declare (strict_types=1);
// +----------------------------------------------------------------------
namespace app\common\library;
/**
* RESULT代码文件
*/
@@ -107,6 +106,12 @@ class ResultCode
'msg' => '当前用户已被禁用',
];
const PLEASELOGININ = [
'code' => -111,
'status' => 'PLEASELOGININ',
'msg' => '请登录后操作',
];
const ACCESS_TOKEN_TIMEOUT = [
'code' => -300,
'status' => 'ACCESS_TOKEN_TIMEOUT',

View File

@@ -12,6 +12,10 @@ declare (strict_types=1);
namespace app\common\library;
use app\common\model\system\UserValidate;
use Psr\SimpleCache\InvalidArgumentException;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Event\Event;
/**
@@ -20,28 +24,42 @@ use Webman\Event\Event;
*/
class Sms
{
/**
* 默认配置
* @var array
*/
protected array $config = [];
/**
* 错误信息
* @var string
*/
protected string $_error = '';
/**
* 验证码对象
* @var mixed
*/
protected string $smsType = 'alisms';
/**
* 验证码过期时间
* @var int
*/
private int $expireTime = 5; //验证码过期时间(分钟)
/**
* @var object 对象实例
*/
protected static $instance = null;
// 默认配置
protected $config = [];
// 错误信息
protected $_error = '';
protected $smsType = 'alisms';
/**
* 验证码过期时间
* @var string
*/
private $expireTime = 5; //验证码过期时间(分钟)
/**
* 类构造函数
* class constructor.
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function __construct()
{
@@ -56,8 +74,11 @@ class Sms
* @access public
* @param array $options 参数
* @return self
* @throws DataNotFoundException
* @throws DbException
* @throws InvalidArgumentException
* @throws ModelNotFoundException
*/
public static function instance($options = [])
{
if (is_null(self::$instance)) {
@@ -164,7 +185,7 @@ class Sms
* 设置错误
* @param string $error 信息信息
*/
protected function setError(string $error)
protected function setError(string $error): void
{
$this->_error = $error;
}

View File

@@ -11,10 +11,14 @@ declare (strict_types=1);
// +----------------------------------------------------------------------
namespace app\common\library;
use Psr\SimpleCache\InvalidArgumentException;
use system\Http;
use app\common\model\system\Attachment;
use app\common\validate\system\UploadFile;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use Webman\Event\Event;
/**
@@ -32,46 +36,50 @@ class Upload
/**
* 文件类型
*/
protected $fileClass;
protected mixed $fileClass;
/**
* 文件名称
*/
protected $filename;
protected mixed $filename;
/**
* 文件保存路径
*/
protected $filepath;
protected mixed $filepath;
/**
* 文件全路径名称
*/
protected $resource;
protected mixed $resource;
/**
* 附件信息
*/
protected $fileInfo = [];
protected mixed $fileInfo = [];
/**
* 图形对象实例
*/
protected $Images;
protected mixed $Images;
/**
* 错误信息
*/
protected $_error = '';
protected string $_error = '';
/**
* 配置文件
*/
protected $config = [];
protected mixed $config = [];
/**
* 类构造函数
* class constructor.
* @throws InvalidArgumentException
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function __construct()
{
@@ -86,6 +94,10 @@ class Upload
* @access public
* @param array $options 参数
* @return self
* @throws DataNotFoundException
* @throws DbException
* @throws InvalidArgumentException
* @throws ModelNotFoundException
*/
public static function instance(array $options = [])
{
@@ -100,7 +112,7 @@ class Upload
/**
* 文件上传
* @return array|false
* @throws \Exception
* @throws \Exception|InvalidArgumentException
*/
public function upload()
{
@@ -159,6 +171,7 @@ class Upload
* @param object $file
* @param array $params
* @return array|false
* @throws InvalidArgumentException
*/
public function multiPartUpload(object $file, array $params = [])
{
@@ -199,6 +212,7 @@ class Upload
* 分片合并
* @param array $params
* @return array|false
* @throws InvalidArgumentException
*/
public function multiMarge(array $params = [])
{
@@ -284,6 +298,7 @@ class Upload
* 文件下载函数
* @param string|null $url
* @return array|false
* @throws InvalidArgumentException
*/
public function download(string $url = null)
{
@@ -323,7 +338,7 @@ class Upload
/**
* 删除本地文件
* @return void
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function uploadAfterDelete()
{
@@ -367,7 +382,7 @@ class Upload
/**
* 获取文件扩展名
* @param object $file
* @return false|mixed|string
* @return false|string
*/
public function getFileExt(object $file)
{
@@ -416,7 +431,7 @@ class Upload
* @param string|null $dir
* @return void
*/
public function getFileSavePath(object $file, string $dir = null)
public function getFileSavePath(object $file, string $dir = null): void
{
$this->filename = uniqid() . '.' . strtolower($file->getUploadExtension());
$this->filepath = DS . $this->config['upload_path'] . DS . ($dir ?? $this->fileClass) . DS . date($this->config['upload_style']);
@@ -428,7 +443,7 @@ class Upload
* @param string $filePath
* @param array $extend
* @return array
* @throws \Psr\SimpleCache\InvalidArgumentException
* @throws InvalidArgumentException
*/
public function success(string $msg, string $filePath, array $extend = []): array
{
@@ -464,7 +479,7 @@ class Upload
* 设置错误
* @param string $error 信息信息
*/
protected function setError(string $error)
protected function setError(string $error): void
{
$this->_error = $error;
}