| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace ghs\controllers;
- use bizGhs\admin\classes\AdminClass;
- use bizGhs\admin\services\AdminRoleService;
- use bizGhs\admin\services\AdminService;
- use common\components\jwt;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class AdminRoleController extends BaseController
- {
- //角色列表 ssh 2019.12.9
- public function actionList()
- {
- $list = AdminRoleService::getRoleList($this->mainId);
- util::success($list);
- }
- //添加员工 ssh 2019.12.10
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['sjId'] = $this->sjId;
- $post['mainId'] = $this->mainId;
- $respond = AdminRoleService::addRole($post);
- util::success($respond);
- }
- //修改角色 ssh 2019.12.10
- public function actionUpdate()
- {
- $post = Yii::$app->request->post();
- $id = isset($post['id']) ? $post['id'] : 0;
- unset($post['id']);
- $role = AdminRoleService::getById($id);
- AdminRoleService::valid($role, $this->sjId);
- AdminRoleService::updateRole($role, $post);
- util::complete('修改成功');
- }
- //角色删除 ssh 2019.12.10
- public function actionDelete()
- {
- $id = Yii::$app->request->post('id', 0);
- $role = AdminRoleService::getById($id);
- AdminRoleService::valid($role, $this->sjId);
- AdminRoleService::deleteRole($role);
- util::complete('删除成功');
- }
- }
|