Commit 0f12d14e authored by jiangkebao's avatar jiangkebao
Browse files

Merge branch 'master' of git.huaperfect.com:hwq/micro

parents 62eb3da4 3a163dec
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@ composer require meibuyu/micro @dev
> 权限名会拼接env文件中的APP_NAME属性,请注意唯一性   
> 所有权限必须存在于用户服务的权限表中,若不存在,请联系管理员添加权限
##### 1、@AutoPerm
在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形命名空间_蛇形控制名_蛇形方法名`
在控制器头部添加@AutoPerm注解,为该控制器下所有的方法添加鉴权功能,生成的权限名为`蛇形控制名_蛇形方法名`
```
/**
 * @AutoPerm()
@@ -34,7 +34,7 @@ composer require meibuyu/micro @dev
class UserInfoController {}
```
参数: 
> 1. prefix, 前缀(字符串),默认为蛇形命名空间_蛇形控制名(user_info)
> 1. prefix, 前缀(字符串),默认为蛇形控制名(user_info)
> 2. exclude, 要排除的方法名(字符串数组),默认为空
```
/**
@@ -44,7 +44,7 @@ class UserInfoController {}
```

##### 2、@Perm
在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形命名空间_蛇形控制名_蛇形方法名`
在控制器中的方法头部添加@Perm注解,为当前方法添加鉴权功能,生成权限名为`蛇形控制名_蛇形方法名`
```
/**
 * @Perm()
+3 −2
Original line number Diff line number Diff line
@@ -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;
    }
+3 −3
Original line number Diff line number Diff line
@@ -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";
                }
@@ -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";
                }
@@ -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";
                }
+2 −2
Original line number Diff line number Diff line
@@ -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');
+0 −1
Original line number Diff line number Diff line
@@ -137,5 +137,4 @@ interface BaseInfoServiceInterface
     */
    public function sites(array $relations = [], array $columns = ['id', "name"]): array;


}
Loading