| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace business\controllers;
- use biz\admin\classes\AdminClass;
- use biz\admin\services\AdminService;
- use common\components\jwt;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class AdminController extends BaseController
- {
-
- public $withoutLogin = [];
-
- //获取登陆员工的权限 shish 2019.11.24
- public function actionLoginAuth()
- {
- $auth = AdminService::getAuth();
- util::success($auth);
- }
-
- //员工列表 shish 2019.12.8
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $where['merchantId'] = $this->merchantId;
- $list = AdminService::getAdminList($where);
- util::success($list);
- }
-
- //添加员工 shish 2019.12.8
- public function actionAdd()
- {
- $post = Yii::$app->request->post();
- $post['merchantId'] = $this->merchantId;
- $admin = AdminService::addAdmin($post);
- $id = $admin['id'];
- $info = AdminService::getDetail($id);
- util::success($info);
- }
-
- //删除员工 shish 2019.12.9
- public function actionDelete()
- {
- $id = Yii::$app->request->get('id');
- $admin = AdminClass::getById($id);
- AdminService::valid($admin, $this->merchantId);
- AdminService::deleteAdmin($admin, $this->adminId);
- util::ok();
- }
-
- //修改员工 shish 2019.12.9
- public function actionUpdate()
- {
- $post = Yii::$app->request->post();
- $id = isset($post['id']) && is_numeric($post['id']) ? $post['id'] : 0;
- unset($post['id']);
- $originalAdmin = AdminService::getById($id);
- $admin = AdminService::updateAdmin($originalAdmin, $post);
- $info = AdminService::getDetail($id);
- util::success($info);
- }
-
- //查看员工详情 shish 2019.12.9
- public function actionDetail()
- {
- $id = Yii::$app->request->get('id');
- $admin = AdminService::getDetail($id);
- AdminService::valid($admin, $this->merchantId);
- util::success($admin);
- }
-
- }
|