Loading README.md +3 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ composer require meibuyu/micro @dev > 权限名会拼接env文件中的APP_NAME属性,请注意唯一性 > 所有权限必须存在于用户服务的权限表中,若不存在,请联系管理员添加权限 ##### 1、@AutoPerm 在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形命名空间_蛇形控制名_蛇形方法名` 在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形控制名_蛇形方法名` ``` /** * @AutoPerm() Loading @@ -34,7 +34,7 @@ composer require meibuyu/micro @dev class UserInfoController {} ``` 参数: > 1. prefix, 前缀(字符串),默认为蛇形命名空间_蛇形控制名(user_info) > 1. prefix, 前缀(字符串),默认为蛇形控制名(user_info) > 2. exclude, 要排除的方法名(字符串数组),默认为空 ``` /** Loading @@ -44,7 +44,7 @@ class UserInfoController {} ``` ##### 2、@Perm 在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形命名空间_蛇形控制名_蛇形方法名` 在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形控制名_蛇形方法名` ``` /** * @Perm() Loading src/Aspect/PermAnnotationAspect.php +3 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,9 @@ class PermAnnotationAspect extends AbstractAspect protected function genPrefix(string $className): string { $handledNamespace = Str::replaceFirst('Controller', '', Str::after($className, '\\Controller\\')); $handledNamespace = str_replace('\\', '_', $handledNamespace); $prefix = Str::snake($handledNamespace); $namespaceLength = strrpos($handledNamespace, '\\'); $prefix = $namespaceLength ? substr($handledNamespace, $namespaceLength + 1) : $handledNamespace; $prefix = Str::snake($prefix); $prefix = str_replace('__', '_', $prefix); return $prefix; } Loading src/Command/MakeModelCommand.php +3 −3 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\t/**\n\t* 属于" . $v['relation_model_name'] . "的关联\n\t*/"; $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->belongsTo(' . $v['relation_model_name'] . "::class,'" . $v['local_table_key'] . "','{$v['relation_table_key']}' );"; $relation .= "\n\t\t" . 'return $this->belongsTo(' . $v['relation_model_name'] . "::class);"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . " $" . $v['function'] . "\n"; } Loading @@ -390,7 +390,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->belongsToMany(' . $v['relation_model_name'] . "::class,'" . $v['relation_table'] . "','{$v['constraint_table_key']}','{$v['local_table_key']}');"; . $v['relation_table'] . "');"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . "[] $" . $v['function'] . "\n"; } Loading @@ -402,7 +402,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\t**/"; $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->hasMany(' . $v['relation_model_name'] . "::class,'" . $v['relation_table_key'] . "','" . $v['local_table_key'] . "' );"; $relation .= "\n\t\t" . 'return $this->hasMany(' . $v['relation_model_name'] . "::class);"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . "[] $" . $v['function'] . "\n"; } Loading src/Manager/UploadManager.php +2 −2 Original line number Diff line number Diff line Loading @@ -172,8 +172,8 @@ class UploadManager */ public static function parsePath($options, $documentRoot) { if (isset($options['temp']) && $options['temp'] && !isset($options['path'])) { // 如果是临时文件,且没有指定保存路径,修改保存路径为临时路径 if (isset($options['temp']) && $options['temp']) { // 如果是临时文件,修改保存路径为临时路径 $options['path'] = 'temp'; } $path = $documentRoot . self::$pathPrefix . $options['path'] . '/' . date('Y-m-d'); Loading src/Service/Interfaces/BaseInfoServiceInterface.php +0 −1 Original line number Diff line number Diff line Loading @@ -137,5 +137,4 @@ interface BaseInfoServiceInterface */ public function sites(array $relations = [], array $columns = ['id', "name"]): array; } Loading
README.md +3 −3 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ composer require meibuyu/micro @dev > 权限名会拼接env文件中的APP_NAME属性,请注意唯一性 > 所有权限必须存在于用户服务的权限表中,若不存在,请联系管理员添加权限 ##### 1、@AutoPerm 在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形命名空间_蛇形控制名_蛇形方法名` 在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形控制名_蛇形方法名` ``` /** * @AutoPerm() Loading @@ -34,7 +34,7 @@ composer require meibuyu/micro @dev class UserInfoController {} ``` 参数: > 1. prefix, 前缀(字符串),默认为蛇形命名空间_蛇形控制名(user_info) > 1. prefix, 前缀(字符串),默认为蛇形控制名(user_info) > 2. exclude, 要排除的方法名(字符串数组),默认为空 ``` /** Loading @@ -44,7 +44,7 @@ class UserInfoController {} ``` ##### 2、@Perm 在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形命名空间_蛇形控制名_蛇形方法名` 在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形控制名_蛇形方法名` ``` /** * @Perm() Loading
src/Aspect/PermAnnotationAspect.php +3 −2 Original line number Diff line number Diff line Loading @@ -91,8 +91,9 @@ class PermAnnotationAspect extends AbstractAspect protected function genPrefix(string $className): string { $handledNamespace = Str::replaceFirst('Controller', '', Str::after($className, '\\Controller\\')); $handledNamespace = str_replace('\\', '_', $handledNamespace); $prefix = Str::snake($handledNamespace); $namespaceLength = strrpos($handledNamespace, '\\'); $prefix = $namespaceLength ? substr($handledNamespace, $namespaceLength + 1) : $handledNamespace; $prefix = Str::snake($prefix); $prefix = str_replace('__', '_', $prefix); return $prefix; } Loading
src/Command/MakeModelCommand.php +3 −3 Original line number Diff line number Diff line Loading @@ -377,7 +377,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\t/**\n\t* 属于" . $v['relation_model_name'] . "的关联\n\t*/"; $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->belongsTo(' . $v['relation_model_name'] . "::class,'" . $v['local_table_key'] . "','{$v['relation_table_key']}' );"; $relation .= "\n\t\t" . 'return $this->belongsTo(' . $v['relation_model_name'] . "::class);"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . " $" . $v['function'] . "\n"; } Loading @@ -390,7 +390,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->belongsToMany(' . $v['relation_model_name'] . "::class,'" . $v['relation_table'] . "','{$v['constraint_table_key']}','{$v['local_table_key']}');"; . $v['relation_table'] . "');"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . "[] $" . $v['function'] . "\n"; } Loading @@ -402,7 +402,7 @@ class MakeModelCommand extends HyperfCommand $relation .= "\n\t**/"; $relation .= "\n\tpublic function " . $v['function'] . "()"; $relation .= "\n\t{"; $relation .= "\n\t\t" . 'return $this->hasMany(' . $v['relation_model_name'] . "::class,'" . $v['relation_table_key'] . "','" . $v['local_table_key'] . "' );"; $relation .= "\n\t\t" . 'return $this->hasMany(' . $v['relation_model_name'] . "::class);"; $relation .= "\n\t}"; $properties .= " * @property " . $v['relation_model_name'] . "[] $" . $v['function'] . "\n"; } Loading
src/Manager/UploadManager.php +2 −2 Original line number Diff line number Diff line Loading @@ -172,8 +172,8 @@ class UploadManager */ public static function parsePath($options, $documentRoot) { if (isset($options['temp']) && $options['temp'] && !isset($options['path'])) { // 如果是临时文件,且没有指定保存路径,修改保存路径为临时路径 if (isset($options['temp']) && $options['temp']) { // 如果是临时文件,修改保存路径为临时路径 $options['path'] = 'temp'; } $path = $documentRoot . self::$pathPrefix . $options['path'] . '/' . date('Y-m-d'); Loading
src/Service/Interfaces/BaseInfoServiceInterface.php +0 −1 Original line number Diff line number Diff line Loading @@ -137,5 +137,4 @@ interface BaseInfoServiceInterface */ public function sites(array $relations = [], array $columns = ['id', "name"]): array; }