|
|
@@ -3,6 +3,7 @@
|
|
|
namespace business\controllers;
|
|
|
|
|
|
use biz\admin\services\AdminRoleAuthService;
|
|
|
+use biz\admin\services\AdminRoleService;
|
|
|
use biz\admin\services\AdminService;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
@@ -13,14 +14,24 @@ class AdminRoleAuthController extends BaseController
|
|
|
//管理员角色权限 shish 2020.1.23
|
|
|
public function actionAuth()
|
|
|
{
|
|
|
- $adminId = Yii::$app->request->get('adminId', 0);
|
|
|
- $admin = AdminService::getById($adminId);
|
|
|
- AdminService::valid($admin, $this->merchantId);
|
|
|
- $roleId = $admin['roleId'];
|
|
|
+ $roleId = Yii::$app->request->get('roleId', 0);
|
|
|
+ $role = AdminRoleService::getById($roleId);
|
|
|
+ AdminRoleService::valid($role, $this->merchantId);
|
|
|
$roleAuth = AdminRoleAuthService::getByCondition(['roleId' => $roleId, 'endId' => 1]);
|
|
|
$auth = isset($roleAuth['auth']) ? $roleAuth['auth'] : '';
|
|
|
$ids = !empty($auth) ? explode(',', $auth) : [];
|
|
|
util::success(['ids' => $ids]);
|
|
|
}
|
|
|
|
|
|
+ //权限更新 shish 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->merchantId);
|
|
|
+ AdminRoleAuthService::updateByCondition(['roleId' => $roleId, 'endId' => 1], ['auth' => implode(',', $authIdList)]);
|
|
|
+ util::ok();
|
|
|
+ }
|
|
|
+
|
|
|
}
|