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