| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace pt\controllers;
- use biz\admin\classes\AdminClass;
- use biz\shop\classes\ShopAdminClass;
- use biz\sj\classes\SjClass;
- use bizHd\admin\services\ShopAdminService;
- use bizHd\saas\classes\ApplyClass;
- use common\components\util;
- use Yii;
- class ShopAdminController extends BaseController
- {
- //员工列表 ssh 2019.12.8
- public function actionList()
- {
- $where = [];
- $where['delStatus'] = 0;
- $list = ShopAdminService::getAdminList($where);
- util::success($list);
- }
- //删除员工、商家、和申请信息 shish
- public function actionDelete()
- {
- $id = Yii::$app->request->get('id');
- $shopAdmin = ShopAdminClass::getAdminInfo($id);
- if (empty($shopAdmin)) {
- util::fail('没有找到员工');
- }
- if (getenv('YII_ENV', 'local') == 'production') {
- util::fail('生产环境不能执行删除操作');
- }
- $adminId = $shopAdmin['adminId'] ?? 0;
- $sjId = $shopAdmin['merchantId'] ?? 0;
- SjClass::deleteById($sjId);
- ApplyClass::deleteByCondition(['sjId' => $sjId]);
- AdminClass::deleteById($adminId);
- ShopAdminClass::deleteById($id);
- util::complete();
- }
- }
|