| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace ghs\controllers;
- use bizHd\admin\services\AdminRoleAuthService;
- use bizHd\admin\services\AdminRoleService;
- use bizHd\admin\services\AdminService;
- use common\components\util;
- use Yii;
- class AdminRoleAuthController extends BaseController
- {
- //管理员角色权限 ssh 2020.1.23
- public function actionAuth()
- {
- $roleId = Yii::$app->request->get('roleId', 0);
- $role = AdminRoleService::getById($roleId);
- AdminRoleService::valid($role, $this->sjId);
- $roleAuth = AdminRoleAuthService::getByCondition(['roleId' => $roleId, 'endId' => 1]);
- $auth = isset($roleAuth['auth']) ? $roleAuth['auth'] : '';
- $ids = !empty($auth) ? explode(',', $auth) : [];
- util::success(['ids' => $ids]);
- }
- //权限更新 ssh 2020.1.23
- public function actionUpdate()
- {
- $roleId = Yii::$app->request->post('roleId', 0);
- $authIdList = Yii::$app->request->post('authIdList', ['*']);
- $auth = AdminRoleAuthService::getByCondition(['roleId' => $roleId, 'endId' => 1]);
- AdminRoleAuthService::valid($auth, $this->sjId);
- AdminRoleAuthService::updateByCondition(['roleId' => $roleId, 'endId' => 1], ['auth' => implode(',', $authIdList)]);
- util::complete();
- }
- }
|