| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?php
- namespace ghs\controllers;
- use bizGhs\admin\classes\ShopAdminClass;
- use bizGhs\admin\services\AdminRoleService;
- use bizGhs\admin\services\ShopAdminService;
- use biz\wx\services\WxOpenService;
- use common\components\jwt;
- use common\components\util;
- use Yii;
- use yii\web\Controller;
- class ShopAdminController extends BaseController
- {
-
- //创建管理员数据准备 shish 2020.4.17
- public function actionPrepareBind()
- {
- $post = Yii::$app->request->post();
- $roleId = isset($post['roleId']) ? $post['roleId'] : 0;
- $role = AdminRoleService::getById($roleId);
- if (empty($role) || isset($role['ghsId']) != $this->ghsId) {
- util::fail('请选择角色!');
- }
- unset($post['userId']);
- unset($post['status']);
- $post['shopId'] = $this->shopId;
- $post['adminId'] = $this->adminId;
- $merchant = WxOpenService::getGhsWxInfo();
- $post['merchant'] = $merchant;
- $respond = ShopAdminService::prepareBindAdmin($post);
- $miniCode = isset($respond['miniCode']) ? Yii::$app->params['imgHost'] . $respond['miniCode'] : '';
- util::success(['miniCode' => $miniCode]);
- }
-
- //创建管理员 shish 2020.4.20
- public function actionGenerateAdmin()
- {
- $post = Yii::$app->request->post();
- $respond = ShopAdminService::generateAdmin($post);
- util::success($respond);
- }
-
- //收款通知 shish 2020.1.4
- public function actionUpdateRemind()
- {
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : 0;
- $remind = isset($get['remind']) && is_numeric($get['remind']) ? $get['remind'] : 0;
- $shopAdmin = ShopAdminService::getById($id);
- ShopAdminService::valid($shopAdmin, $this->shopId);
- ShopAdminService::updateById($id, ['remind' => $remind]);
- util::complete();
- }
-
- //启用与停用 shish 2020.1.4
- public function actionUpdateStatus()
- {
- $get = Yii::$app->request->get();
- $id = isset($get['id']) && is_numeric($get['id']) ? $get['id'] : 0;
- $status = isset($get['status']) ? $get['status'] : 0;
- $shopAdmin = ShopAdminService::getById($id);
- ShopAdminService::valid($shopAdmin, $this->shopId);
- ShopAdminService::updateById($id, ['status' => $status]);
- util::complete();
- }
-
- //员工列表 shish 2019.12.8
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $where = [];
- $where['shopId'] = $this->shopId;
- $where['delStatus'] = 0;
- $list = ShopAdminService::getAdminList($where);
- util::success($list);
- }
-
- //获取员工信息 shish 2021.1.13
- public function actionDetail()
- {
- $get = Yii::$app->request->get();
- $id = isset($get['id']) ? $get['id'] : 0;
- $respond = ShopAdminService::getShopAdmin($id);
- ShopAdminClass::valid($respond, $this->ghsId);
- util::success($respond);
- }
-
- }
|