From 48fdef27f01833cd747ef7b0ca050a88cbb2ebda Mon Sep 17 00:00:00 2001 From: deatil <2217957370@qq.com> Date: Wed, 8 Dec 2021 23:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Auth/Admin.php | 5 +++++ src/Auth/Check.php | 2 +- src/Auth/Parser.php | 6 ++++++ src/Auth/Permission.php | 2 ++ src/Auth/Rule.php | 3 +++ src/Command/Flash.php | 2 +- src/Command/Install.php | 2 +- src/Command/Publish.php | 2 +- src/Command/ResetPassword.php | 2 +- src/Controller/Base.php | 1 + src/Exception/Handler.php | 1 + src/Flash/Manager.php | 29 ++++------------------------- src/Flash/Menu.php | 6 ------ src/Http/BaseController.php | 2 ++ src/Http/JsonResponse.php | 1 + src/Http/Request.php | 5 ++--- src/Middleware/Auth.php | 1 + src/Middleware/ScreenLockCheck.php | 4 ---- src/Support/Event.php | 2 ++ src/Support/File.php | 10 ++++++++-- src/Support/Form.php | 3 +++ src/Support/Password.php | 3 --- src/Support/Sql.php | 3 +++ src/Support/Tree.php | 10 ++++++++++ src/Traits/Macroable.php | 2 +- 25 files changed, 60 insertions(+), 49 deletions(-) diff --git a/src/Auth/Admin.php b/src/Auth/Admin.php index 1d0aec3..eb10578 100644 --- a/src/Auth/Admin.php +++ b/src/Auth/Admin.php @@ -29,6 +29,7 @@ class Admin /** * 用户登录 + * * @param string $name 账户名 * @param string $password (md5值) 密码 * @return bool|mixed @@ -90,6 +91,7 @@ public function getInfo($id) /** * 检测密码 + * * @param type $identifier 用户名或者用户ID * @param type $password 密码 * @return boolean @@ -116,6 +118,7 @@ public function checkPassword($identifier, $password) /** * 检验用户是否已经登陆 + * * @return boolean */ public function check() @@ -182,6 +185,7 @@ public function isSuperAdmin($id = null) /** * 注销登录状态 + * * @return boolean */ public function logout() @@ -195,6 +199,7 @@ public function logout() /** * 管理员密码加密 + * * @param $password * @param $encrypt //传入加密串,在修改密码时做认证 * @return array/password diff --git a/src/Auth/Check.php b/src/Auth/Check.php index 2fe0f5e..a9ae7ec 100644 --- a/src/Auth/Check.php +++ b/src/Auth/Check.php @@ -151,7 +151,7 @@ protected function checkMatchUrl($name, $auth) } /** - * 格式化name + * 格式化 name * * @param string $name 要检测的名称 * @return string diff --git a/src/Auth/Parser.php b/src/Auth/Parser.php index 371d41c..0d79437 100644 --- a/src/Auth/Parser.php +++ b/src/Auth/Parser.php @@ -29,6 +29,7 @@ class Parser /** * 设置 + * * @param string $url 链接地址 * @return object */ @@ -40,6 +41,7 @@ public function withUrl($url) /** * 获取链接 + * * @return string */ public function getUrl() @@ -49,6 +51,7 @@ public function getUrl() /** * 获取地址 + * * @return string */ public function getPath() @@ -58,6 +61,7 @@ public function getPath() /** * 获取参数 + * * @return array */ public function getParam() @@ -67,6 +71,7 @@ public function getParam() /** * 解析 + * * @return Parser */ public function parse() @@ -87,6 +92,7 @@ public function parse() /** * 解析 + * * @return Parser */ public function parseUrl() diff --git a/src/Auth/Permission.php b/src/Auth/Permission.php index 2affbb8..add1e53 100644 --- a/src/Auth/Permission.php +++ b/src/Auth/Permission.php @@ -14,6 +14,7 @@ class Permission { /** * 检查权限 + * * @param string|array name 需要验证的规则列表,支持逗号分隔的权限规则或索引数组 * @param integer uid 认证用户的id * @param string relation 如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证 @@ -40,6 +41,7 @@ public function check( /** * 获得权限列表 + * * @param integer $uid 用户id */ public function getAuthList($uid, $type) diff --git a/src/Auth/Rule.php b/src/Auth/Rule.php index ff5f797..5ea34df 100644 --- a/src/Auth/Rule.php +++ b/src/Auth/Rule.php @@ -29,6 +29,7 @@ public function __construct($type = 1) /** * 获得权限列表 + * * @param integer $uid 用户id * @param integer $type 选择类型 */ @@ -92,6 +93,7 @@ public function getAuthList($uid) /** * 获得权限ID列表 + * * @param array $gids 分组id列表 * @return array */ @@ -107,6 +109,7 @@ public function getGroupRuleidList($gids = []) /** * 根据用户id获取用户组,返回值为数组 + * * @param integer uid 用户id * @return array 用户所属的用户组 * array( diff --git a/src/Command/Flash.php b/src/Command/Flash.php index 6f94067..64632a0 100644 --- a/src/Command/Flash.php +++ b/src/Command/Flash.php @@ -24,7 +24,7 @@ /** * 闪存 * - * php think laket-admin:flash [--package=package_name] [--action=install] + * > php think laket-admin:flash [--package=package_name] [--action=install] * * @create 2021-4-7 * @author deatil diff --git a/src/Command/Install.php b/src/Command/Install.php index 702acbd..c572724 100644 --- a/src/Command/Install.php +++ b/src/Command/Install.php @@ -20,7 +20,7 @@ /** * 系统安装 * - * php think laket-admin:install + * > php think laket-admin:install * * @create 2020-3-20 * @author deatil diff --git a/src/Command/Publish.php b/src/Command/Publish.php index cd9e701..55a96b4 100644 --- a/src/Command/Publish.php +++ b/src/Command/Publish.php @@ -17,7 +17,7 @@ /** * 推送 * - * php think laket-admin:publish --tag=tag-name + * > php think laket-admin:publish --tag=tag-name * * @create 2021-3-26 * @author deatil diff --git a/src/Command/ResetPassword.php b/src/Command/ResetPassword.php index 72f0065..9670208 100644 --- a/src/Command/ResetPassword.php +++ b/src/Command/ResetPassword.php @@ -18,7 +18,7 @@ /** * 重设密码 * - * php think laket-admin:reset-password + * > php think laket-admin:reset-password * * @create 2021-3-20 * @author deatil diff --git a/src/Controller/Base.php b/src/Controller/Base.php index 2b594ff..89423c3 100644 --- a/src/Controller/Base.php +++ b/src/Controller/Base.php @@ -21,6 +21,7 @@ abstract class Base extends BaseController /** * 控制器中间件 + * * @var array */ protected $middleware = []; diff --git a/src/Exception/Handler.php b/src/Exception/Handler.php index 7627ef5..371aa1e 100644 --- a/src/Exception/Handler.php +++ b/src/Exception/Handler.php @@ -23,6 +23,7 @@ class Handler extends Handle { /** * 不需要记录信息(日志)的异常类列表 + * * @var array */ protected $ignoreReport = [ diff --git a/src/Flash/Manager.php b/src/Flash/Manager.php index a467f32..f1a5016 100644 --- a/src/Flash/Manager.php +++ b/src/Flash/Manager.php @@ -32,7 +32,9 @@ class Manager public $flashs = []; /** - * @var string 本地闪存缓存id + * 本地闪存缓存id + * + * @var string */ public $flashsCacheId = 'laket-admin-local-flashs'; @@ -41,7 +43,6 @@ class Manager * * @param string $name 包名 * @param string $class 绑定服务类 - * * @return self */ public function extend($name, $class = null) @@ -59,7 +60,6 @@ public function extend($name, $class = null) * 获取添加的闪存 * * @param string $name - * * @return string */ public function getExtend($name = null) @@ -75,7 +75,6 @@ public function getExtend($name = null) * 移除添加的闪存 * * @param string $name - * * @return string|null */ public function forget($name) @@ -93,7 +92,6 @@ public function forget($name) * 检测非compoer闪存是否存在 * * @param string $name 闪存包名 - * * @return bool */ public function checkLocal($name) @@ -111,7 +109,6 @@ public function checkLocal($name) * 设置闪存路由 * * @param $callback - * * @return self */ public function routes($callback) @@ -127,7 +124,6 @@ public function routes($callback) * * @param $prefix * @param $paths - * * @return self */ public function namespaces($prefix, $paths = []) @@ -143,7 +139,6 @@ public function namespaces($prefix, $paths = []) * 登陆过滤 * * @param array $excepts - * * @return void */ public function authenticateExcepts(array $excepts = []) @@ -166,7 +161,6 @@ public function authenticateExcepts(array $excepts = []) * 权限过滤 * * @param array $excepts - * * @return void */ public function permissionExcepts(array $excepts = []) @@ -189,7 +183,6 @@ public function permissionExcepts(array $excepts = []) * 锁屏过滤 * * @param array $excepts - * * @return void */ public function screenlockExcepts(array $excepts = []) @@ -212,7 +205,6 @@ public function screenlockExcepts(array $excepts = []) * 执行sql * * @param string $sql sql字符或者文件 - * * @return boolen */ public function executeSql(string $sql) @@ -444,7 +436,6 @@ public function refresh() * 移除闪存信息缓存 * * @param string $name - * * @return self */ public function forgetFlashCache(string $name) @@ -463,7 +454,6 @@ public function forgetFlashCache(string $name) * 闪存存放文件夹 * * @param string $path - * * @return string */ public function getFlashDirectory() @@ -475,7 +465,6 @@ public function getFlashDirectory() * 闪存存放目录 * * @param string $path - * * @return string */ public function getFlashPath(string $path = '') @@ -488,7 +477,6 @@ public function getFlashPath(string $path = '') * 闪存绑定类 * * @param string|null $name - * * @return string */ public function getFlashClass(?string $name = null) @@ -506,7 +494,6 @@ public function getFlashClass(?string $name = null) * 实例化类 * * @param string|null $className - * * @return object */ public function getNewClass(?string $className = null) @@ -531,7 +518,6 @@ public function getNewClass(?string $className = null) * @param string|null $className * @param string|null $method * @param array $param - * * @return mixed */ public function getNewClassMethod(?string $className = null, ?string $method = null, array $param = []) @@ -557,7 +543,6 @@ public function getNewClassMethod(?string $className = null, ?string $method = n * 闪存的实例化类 * * @param string|null $name - * * @return mixed|object */ public function getFlashNewClass(?string $name = null) @@ -571,7 +556,6 @@ public function getFlashNewClass(?string $name = null) * 闪存标识 * * @param object|null $newClass - * * @return string */ public function getFlashIcon(?object $newClass = null) @@ -599,7 +583,6 @@ public function getFlashIcon(?object $newClass = null) * 闪存信息 * * @param string|null $name - * * @return array */ public function getFlash(?string $name = null) @@ -693,9 +676,8 @@ public function getFlashs() * 闪存标识图片 * * @param string|null $icon - * * @return string - */ + */ public function getIcon($icon = '') { if (! file_exists($icon) || ! is_file($icon)) { @@ -714,7 +696,6 @@ public function getIcon($icon = '') * 验证闪存信息 * * @param array $info - * * @return boolen */ public function validateInfo(array $info) @@ -744,7 +725,6 @@ public function validateInfo(array $info) * 获取满足条件的闪存文件夹 * * @param string|null $dirPath - * * @return array */ public function getDirectories(?string $dirPath = null) @@ -779,7 +759,6 @@ public function getDirectories(?string $dirPath = null) * 根据类名获取类所在文件夹 * * @param string|object|null $class - * * @return string|bool */ public function getPathFromClass($class = null) diff --git a/src/Flash/Menu.php b/src/Flash/Menu.php index c80ef34..46fd3cc 100644 --- a/src/Flash/Menu.php +++ b/src/Flash/Menu.php @@ -22,7 +22,6 @@ class Menu * * @return array $data * @return int|string $parentId - * * @return array */ public static function create($data = [], $parentId = 0) @@ -68,7 +67,6 @@ public static function create($data = [], $parentId = 0) * 删除 * * @param string $slug 规则slug - * * @return boolean */ public static function delete($slug) @@ -91,7 +89,6 @@ public static function delete($slug) * 启用 * * @param string $slug - * * @return boolean */ public static function enable($slug) @@ -117,7 +114,6 @@ public static function enable($slug) * 禁用 * * @param string $slug - * * @return boolean */ public static function disable($slug) @@ -143,7 +139,6 @@ public static function disable($slug) * 导出指定slug的规则 * * @param string $slug - * * @return array */ public static function export($slug) @@ -180,7 +175,6 @@ public static function export($slug) * 根据slug获取规则IDS * * @param string $slug - * * @return array */ public static function getAuthRuleIdsBySlug($slug) diff --git a/src/Http/BaseController.php b/src/Http/BaseController.php index 26bcab3..1895592 100644 --- a/src/Http/BaseController.php +++ b/src/Http/BaseController.php @@ -39,6 +39,7 @@ abstract class BaseController /** * 构造方法 + * * @access public * @param App $app 应用对象 */ @@ -57,6 +58,7 @@ protected function initialize() /** * 验证数据 + * * @access protected * @param array $data 数据 * @param string|array $validate 验证器名或者验证规则数组 diff --git a/src/Http/JsonResponse.php b/src/Http/JsonResponse.php index 5d5c02f..18f4e52 100644 --- a/src/Http/JsonResponse.php +++ b/src/Http/JsonResponse.php @@ -201,6 +201,7 @@ public function json( $header = $this->getHeaders(); $response = Response::create($result)->header($header); + throw new HttpResponseException($response); } diff --git a/src/Http/Request.php b/src/Http/Request.php index 8068227..79a6d5c 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -17,12 +17,11 @@ class Request /** * 匹配当前请求路径 * - * @param string $path - * @param null|string $current - * * eg: * get,post:admin.index.index * + * @param string $path + * @param null|string $current * @return bool */ public static function matchPath($path, ?string $current = null) diff --git a/src/Middleware/Auth.php b/src/Middleware/Auth.php index d31cd21..53a0314 100644 --- a/src/Middleware/Auth.php +++ b/src/Middleware/Auth.php @@ -48,6 +48,7 @@ public function handle($request, Closure $next) /** * 登陆检测 + * * @return boolean */ protected function checkLogin($request) diff --git a/src/Middleware/ScreenLockCheck.php b/src/Middleware/ScreenLockCheck.php index e579f3a..1b0b308 100644 --- a/src/Middleware/ScreenLockCheck.php +++ b/src/Middleware/ScreenLockCheck.php @@ -38,12 +38,8 @@ public function handle($request, Closure $next) return $next($request); } - /** * 检测锁屏 - * - * @create 2020-8-5 - * @author deatil */ protected function checkScreenLock() { diff --git a/src/Support/Event.php b/src/Support/Event.php index dbc6440..0954550 100644 --- a/src/Support/Event.php +++ b/src/Support/Event.php @@ -28,6 +28,7 @@ public function __construct(App $app) /** * 注册应用事件 + * * @access public * @param array $event 事件数据 * @return void @@ -51,6 +52,7 @@ public function load(array $event): ModuleEvent /** * 触发事件 + * * @access protected * @param array $event 事件数据 * @return string|array|etc diff --git a/src/Support/File.php b/src/Support/File.php index d9130c3..e6012cf 100644 --- a/src/Support/File.php +++ b/src/Support/File.php @@ -23,6 +23,7 @@ public static function byteFormat($bytes) /** * 读取文件内容 + * * @param $filename 文件名 * @return string 文件内容 */ @@ -42,6 +43,7 @@ public static function readFile($filename) /** * 写入文件 + * * @param $filename * @param $writetext * @param string $openmod @@ -90,6 +92,7 @@ public static function delAll($path, $delDir = false) /** * 删除 + * * @param $dirName * @return bool */ @@ -116,6 +119,7 @@ public static function delDir($dirName) /** * 复制 + * * @param $surDir * @param $toDir * @return bool @@ -149,6 +153,7 @@ public static function copyDir($surDir, $toDir) /** * 创建文件夹 + * * @param $dir * @return bool */ @@ -166,9 +171,9 @@ public static function mkDir($dir) /** * 遍历获取目录下的指定类型的文件 + * * @param $path 路径 - * @param array $files - * 文件类型数组 + * @param array $files 文件类型数组 */ public static function getFiles($path, &$files = array(), $preg = "/\.(gif|jpeg|jpg|png|bmp)$/i") { @@ -309,6 +314,7 @@ public static function writeable($dir = null) /** * 检测是否为空文件夹 + * * @param $dir 目录名 * @return boolean true 空, fasle 不为空 */ diff --git a/src/Support/Form.php b/src/Support/Form.php index e0d9e83..ecbb4fa 100644 --- a/src/Support/Form.php +++ b/src/Support/Form.php @@ -30,6 +30,7 @@ public static function token($name = '__token__', $type = 'md5') /** * 下拉选择框 + * * @param type $array 数据 * @param type $id 默认选择 * @param type $str 属性 @@ -63,6 +64,7 @@ public static function select($array = array(), $id = 0, $str = '', $default_opt /** * 复选框 + * * @param $array 选项 二维数组 * @param $id 默认选中值,多个用 '逗号'分割 * @param $str 属性 @@ -95,6 +97,7 @@ public static function checkbox($array = array(), $id = '', $str = '', $defaultv /** * 图片上传 + * * @param string $name 表单名称 * @param int $id 表单id * @param string $value 表单默认值 diff --git a/src/Support/Password.php b/src/Support/Password.php index 84067d5..acd17ae 100644 --- a/src/Support/Password.php +++ b/src/Support/Password.php @@ -20,7 +20,6 @@ class Password * 设置盐 * * @param $salt 加密盐 - * * @return $this */ public function setSalt($salt) @@ -34,7 +33,6 @@ public function setSalt($salt) * * @param $password * @param $encrypt //传入加密串,在修改密码时做认证 - * * @return array/password */ public function encrypt($password, $encrypt = '') @@ -49,7 +47,6 @@ public function encrypt($password, $encrypt = '') * 产生一个指定长度的随机字符串,并返回给用户 * * @param type $len 产生字符串的长度 - * * @return string 随机字符串 */ protected function randomString($len = 6) diff --git a/src/Support/Sql.php b/src/Support/Sql.php index aaa6c56..8e5a44b 100644 --- a/src/Support/Sql.php +++ b/src/Support/Sql.php @@ -14,6 +14,7 @@ class Sql { /** * 从sql文件获取纯sql语句 + * * @param string $sql_file sql文件路径 * @param bool $string 如果为真,则只返回一条sql语句,默认以数组形式返回 * @param array $replace 替换前缀,如:['my_' => 'me_'],表示将表前缀"my_"替换成"me_" @@ -37,6 +38,7 @@ public static function getSqlFromFile($sql_file = '', $string = false, $replace /** * 分割sql语句 + * * @param string $content sql内容 * @param bool $string 如果为真,则只返回一条sql语句,默认以数组形式返回 * @param array $replace 替换前缀,如:['my_' => 'me_'],表示将表前缀my_替换成me_ @@ -125,6 +127,7 @@ public static function parseSql($content = '', $string = false, $replace = []) /** * 读取文件内容 + * * @param $filename 文件名 * @return string 文件内容 */ diff --git a/src/Support/Tree.php b/src/Support/Tree.php index 0c85ba3..6ec5316 100644 --- a/src/Support/Tree.php +++ b/src/Support/Tree.php @@ -44,6 +44,7 @@ public static function create() /** * 构造函数,初始化类 + * * @param array 2维数组,例如: * array( * 1 => array('id'=>'1','parentid'=>0,'title'=>'一级栏目一'), @@ -63,6 +64,7 @@ public function withData($data = []) /** * 设置配置 + * * @param array $key 键值 * @param string $value 内容 * @return array @@ -78,6 +80,7 @@ public function withConfig($key, $value) /** * * 构建数组 + * * @param string $id 要查询的ID * @param string $itemprefix 前缀 * @return string @@ -125,6 +128,7 @@ public function buildArray($id, $itemprefix = '') /** * 所有父节点 + * * @param array $list 数据集 * @param string|int $parentid 节点的parentid * @param string $sort 排序 @@ -157,6 +161,7 @@ public function getListParents($list = [], $parentid = '', $sort = 'desc') /** * 所有父节点的ID列表 + * * @param array $list 数据集 * @param string|int $parentid 节点的parentid * @return array @@ -178,6 +183,7 @@ public function getListParentsId($list = [], $parentid = '') /** * 获取当前ID的所有子节点 + * * @param array $list 数据集 * @param string|int $id 当前id * @param string $sort 排序 @@ -209,6 +215,7 @@ public function getListChilds($list = [], $id = '', $sort = 'desc') /** * 获取当前ID的所有子节点id + * * @param array $list 数据集 * @param string|int $id 当前id * @return array @@ -230,6 +237,7 @@ public function getListChildsId($list = [], $id = '') /** * 得到子级第一级数组 + * * @param array $list 数据集 * @param string|int $id 当前id * @return array @@ -254,6 +262,7 @@ public function getListChild($list = [], $id) /** * 获取ID自己的数据 + * * @param array $list 数据集 * @param string|int $id 当前id * @return array @@ -277,6 +286,7 @@ public function getListSelf($list = [], $id) /** * 将buildArray的结果返回为二维数组 + * * @param array $data 数据 * @return array */ diff --git a/src/Traits/Macroable.php b/src/Traits/Macroable.php index bbe042a..6bdac18 100644 --- a/src/Traits/Macroable.php +++ b/src/Traits/Macroable.php @@ -10,7 +10,7 @@ use BadMethodCallException; /** - * 类扩展,来源于laravel框架 + * 类扩展 * * @create 2021-4-8 * @author deatil