初始化本地仓库

This commit is contained in:
2026-08-31 11:33:59 +08:00
commit 663f74b633
2390 changed files with 402918 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class AccessDeniedHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 403;
/**
* @var string
*/
public string $errorMessage = '当前操作没有权限执行,请检查您的账户权限';
}
@@ -0,0 +1,36 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
/**
* 自定义异常类
*
* @author Mr.April
* @since 1.0
*/
class AdminException extends BaseException
{
/**
* @var int
*/
public int $statusCode = -1;
/**
* @var int
*/
public int $errorCode = -1;
}
@@ -0,0 +1,29 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class BadRequestHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 400;
/**
* @var string
*/
public string $errorMessage = '请求参数错误,请检查后重试';
}
@@ -0,0 +1,84 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
class BaseException extends \Exception
{
/**
* HTTP Response Status Code.
*
* @var int
*/
public int $statusCode = 400;
/**
* HTTP Response Header.
*
* @var array
*/
public array $header = [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => 'true',
'Access-Control-Allow-Headers' => 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With,Origin',
'Access-Control-Allow-Methods' => 'GET,POST,PUT,DELETE,OPTIONS',
];
/**
* Business Error code.
*
* @var int
*/
public int $errorCode = 0;
/**
* Business Error message.
*
* @var string
*/
public string $errorMessage = 'The requested resource is not available or not exists';
/**
* Business data.
*
* @var array
*/
public mixed $data = [];
/**
* Detail Log Error message.
*
* @var string
*/
public string $error = '';
/**
* BaseException constructor.
*
* @param string $errorMessage
* @param array $params
* @param string $error
*/
public function __construct(string $errorMessage = '', array $params = [], string $error = '')
{
$errorMessage = __($errorMessage ?: $this->errorMessage);// 翻译错误信息
$this->errorMessage = $errorMessage;
$this->error = $error;
if (!empty($params)) {
$this->statusCode = $params['statusCode'] ?? $this->statusCode;
$this->header = array_merge($this->header, $params['header'] ?? []);
$this->errorCode = $params['errorCode'] ?? $this->errorCode;
$this->data = $params['data'] ?? $this->data;
}
parent::__construct($errorMessage, $this->errorCode);
}
}
@@ -0,0 +1,10 @@
<?php
namespace core\exception\handler;
class CaptchaException extends \RuntimeException
{
}
@@ -0,0 +1,31 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
/**
* 公共异常类
*
* @author Mr.April
* @since 1.0
*/
class CommonException extends BaseException
{
/**
* @var int
*/
public int $statusCode = -1;
}
@@ -0,0 +1,28 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class ForbiddenHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 403;
/**
* @var string
*/
public string $errorMessage = '对不起,您没有该接口访问权限,请联系管理员';
}
@@ -0,0 +1,28 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class NotFoundHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 404;
/**
* @var string
*/
public string $errorMessage = '请求的资源不存在或已被删除';
}
@@ -0,0 +1,31 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
/**
* 插件异常类
*
* @author Mr.April
* @since 1.0
*/
class PluginException extends BaseException
{
/**
* @var int
*/
public int $statusCode = -1;
}
@@ -0,0 +1,28 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class ServerErrorHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 500;
/**
* @var string
*/
public string $errorMessage = '服务器内部错误,请稍后再试';
}
@@ -0,0 +1,29 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class TooManyRequestsHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 429;
/**
* @var string
*/
public string $errorMessage = '请求过于频繁,请稍后再试';
}
@@ -0,0 +1,28 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: https://madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
class UnauthorizedHttpException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 401;
/**
* @var string
*/
public string $errorMessage = '未经授权的访问,请先登录';
}
@@ -0,0 +1,31 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
/**
* 上传异常类
*
* @author Mr.April
* @since 1.0
*/
class UploadException extends BaseException
{
/**
* @var int
*/
public int $statusCode = -1;
}
@@ -0,0 +1,36 @@
<?php
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.tech
*/
namespace core\exception\handler;
use core\exception\handler\BaseException;
/**
* 验证异常类
*
* @author Mr.April
* @since 1.0
*/
class ValidationException extends BaseException
{
/**
* @var int
*/
public int $statusCode = 400;
public int $errorCode=422;
}