From 34c373c11e68d273e42dec6fca6d609fa4e15cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=9F=E5=B8=85?= <133814250@qq.com> Date: Thu, 23 Feb 2023 18:18:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83v2.2.10=E7=89=88=E6=9C=AC?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E8=AF=B7=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=EF=BC=9Ahttps://github.com/bufanyun/hotgo/blob/v2.0/d?= =?UTF-8?q?ocs/guide-zh-CN/start-update-log.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide-zh-CN/start-rewrite.md | 130 ----------- docs/guide-zh-CN/sys-auth.md | 215 ------------------- server/internal/logic/hook/access_log.go | 2 +- web/src/views/system/config/BasicSetting.vue | 4 +- 4 files changed, 3 insertions(+), 348 deletions(-) delete mode 100644 docs/guide-zh-CN/start-rewrite.md delete mode 100644 docs/guide-zh-CN/sys-auth.md diff --git a/docs/guide-zh-CN/start-rewrite.md b/docs/guide-zh-CN/start-rewrite.md deleted file mode 100644 index b3cb527..0000000 --- a/docs/guide-zh-CN/start-rewrite.md +++ /dev/null @@ -1,130 +0,0 @@ -## 伪静态 - -目录 - -- Nginx -- Apache -- IIS - -### Nginx - -推荐配置 - -``` -location / { - try_files $uri $uri/ /index.php$is_args$args; -} -location /backend { - try_files $uri $uri/ /backend/index.php$is_args$args; -} -location /api { - try_files $uri $uri/ /api/index.php$is_args$args; -} -location /merchant { - try_files $uri $uri/ /merchant/index.php$is_args$args; -} -location /html5 { - try_files $uri $uri/ /html5/index.php$is_args$args; -} -location /oauth2 { - try_files $uri $uri/ /oauth2/index.php$is_args$args; -} - -location ~* ^/attachment/.*\.(php|php5)$ -{ - deny all; -} -``` - -类似Apache的配置 - -``` -location / -{ - index index.html index.htm index.php; - - if (!-e $request_filename) { - rewrite ^/backend(.*)$ /backend/index.php?s=$1 last; - rewrite ^/merchant(.*)$ /merchant/index.php?s=$1 last; - rewrite ^/api(.*)$ /api/index.php?s=$1 last; - rewrite ^/html5(.*)$ /html5/index.php?s=$1 last; - rewrite ^/oauth2(.*)$ /oauth2/index.php?s=$1 last; - rewrite ^/(.*)$ /index.php?s=$1 last; - break; - } - - #autoindex on; -} -``` - -### Apache - -> 注意系统默认自带了.htaccess,所以环境如果是apache可以不用再配置 - -``` -Options +FollowSymLinks -IndexIgnore */* -RewriteEngine on - -# if a directory or a file exists, use it directly -RewriteCond %{REQUEST_FILENAME} !-f -RewriteCond %{REQUEST_FILENAME} !-d - -# otherwise forward it to index.php -RewriteRule . index.php -``` - -### IIS - -> rule 部分配置 - -``` - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` diff --git a/docs/guide-zh-CN/sys-auth.md b/docs/guide-zh-CN/sys-auth.md deleted file mode 100644 index c745486..0000000 --- a/docs/guide-zh-CN/sys-auth.md +++ /dev/null @@ -1,215 +0,0 @@ -## 权限控制 - -- 控制说明 -- 如何页面块/按钮自由控制显示权限 -- 不进行权限认证的路由 -- 新增应用的 RBAC 授权 - -> RageFrame已经内置的 RBAC 权限管理,并对其进行了二次开发,无限父子级权限分组、可自由分配子级权限 - -### 控制说明 - -可以把权限理解为一个大的库,往里面丢各种名称,可以是路由、自定义名称等 - -系统自定义了几个默认的名称 - -- menuCate:1 => 平台管理导航菜单 -- menuCate:2 => 微信公众号导航菜单 -- menuCate:3 => 系统管理导航菜单 -- menuCate:4 => 应用中心导航菜单 - -> 为什么要命名为cate:1这种名称呢,因为是后面带的是菜单分类数据库自带的id,如果自己有改动比如删除后添加注意修改权限名称 - -> 注意!!! -> 注意!!! -> 注意!!! -> -> 权限的路由一定要包含菜单路由才会显示 - -**举个例子** - -已授权权限 - -``` - [ - '/test/index', - '/test/system', - - ... - ], -``` - -你的菜单 - -``` - [ - 'testList', // 这里是菜单的顶级别名 - 'child' => [ - '/test/index', // 子菜单 - '/test/system', // 子菜单 - '/test/test', // 子菜单 - ... - ] - - ... - ], -``` - -这里看到你授权菜单的子菜单但是没有授权 testList 别名,那么你整个菜单都会被隐藏,如果想显示你必须把 testList 也加入权限 - -### 如何页面块/按钮自由控制显示权限 - -按钮快捷方式:使用 [Html](helper-html.md) 辅助类 -自定义验证如下:使用 [Auth](helper-auth.md) 辅助类 - -### 不进行权限认证的路由 - -> 修改地址 `backend/config/params` 找到 `noAuthRoute` - -``` -/** - * 不需要验证的路由全称 - * - * 注意: 前面以绝对路径/为开头 - */ -'noAuthRoute' => [ - '/main/index',// 系统主页 - '/main/system',// 系统首页 - '/menu-provinces/index',// 微信个性化菜单省市区 - '/wechat/common/select-news',// 微信自动回复获取图文 - '/wechat/common/select-attachment',// 微信自动回复获取图片/视频/ - '/wechat/analysis/image',// 微信显示素材图片 -], -``` - -### 新增应用的 RBAC 授权 - -获取分配角色列表 - -``` -/** - * @param string $app_id 应用id - * @param bool $sourceAuthChild 权限来源(false:所有权限,true:当前角色) - * @return array - */ -Yii::$app->services->rbacAuthRole->getDropDown($app_id, $sourceAuthChild) -``` - -分配为用户角色 - -``` -/** - * @param array $role_ids 角色id - * @param int $user_id 用户id - * @param string $app_id 应用id - * @throws UnprocessableEntityHttpException - */ -Yii::$app->services->rbacAuthAssignment->assign($role_ids, $user_id, $app_id); -``` - -权限管理 - -> 下面为新增应用权限(比如增加前台会员的权限)案例 - -``` - - */ -class AuthItemController extends BaseController -{ - use AuthItemTrait; - - /** - * @var AuthItem - */ - public $modelClass = AuthItem::class; - - /** - * 默认应用 - * - * @var string - */ - public $appId = AppEnum::MERCHANT; - - /** - * 渲染视图前缀(默认) - * - * @var string - */ - public $viewPrefix = '@backend/modules/base/views/auth-item/'; -} -``` - -角色管理 - -> 下面为新增应用权限(比如增加前台会员的角色)案例 - -``` - - */ -class AuthRoleController extends BaseController -{ - use AuthRoleTrait; - - /** - * @var AuthRole - */ - public $modelClass = AuthRole::class; - - /** - * 默认应用 - * - * @var string - */ - public $appId = AppEnum::MERCHANT; - - /** - * 权限来源 - * - * false:所有权限,true:当前角色 - * - * @var bool - */ - public $sourceAuthChild = false; - - /** - * 渲染视图前缀(默认) - * - * @var string - */ - public $viewPrefix = '@backend/modules/base/views/auth-role/'; - - /** - * @throws \yii\base\InvalidConfigException - */ - public function init() - { - parent::init(); - - $this->merchant_id = Yii::$app->request->get('merchant_id'); - $this->merchant_id && Yii::$app->services->merchant->setId($this->merchant_id); - } -} -``` diff --git a/server/internal/logic/hook/access_log.go b/server/internal/logic/hook/access_log.go index 584c481..7b127a7 100644 --- a/server/internal/logic/hook/access_log.go +++ b/server/internal/logic/hook/access_log.go @@ -32,7 +32,7 @@ func (s *sHook) accessLog(r *ghttp.Request) { simple.SafeGo(ctx, func(ctx context.Context) { if err := service.SysLog().AutoLog(ctx); err != nil { - g.Log().Warningf(ctx, "hook accessLog err:%+v", err) + g.Log().Infof(ctx, "hook accessLog err:%+v", err) } }) } diff --git a/web/src/views/system/config/BasicSetting.vue b/web/src/views/system/config/BasicSetting.vue index a12357d..918563b 100644 --- a/web/src/views/system/config/BasicSetting.vue +++ b/web/src/views/system/config/BasicSetting.vue @@ -26,14 +26,14 @@