ShopAdminController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace pt\controllers;
  3. use biz\admin\classes\AdminClass;
  4. use biz\shop\classes\ShopAdminClass;
  5. use biz\sj\classes\SjClass;
  6. use bizHd\admin\services\ShopAdminService;
  7. use bizHd\saas\classes\ApplyClass;
  8. use common\components\util;
  9. use Yii;
  10. class ShopAdminController extends BaseController
  11. {
  12. //员工列表 ssh 2019.12.8
  13. public function actionList()
  14. {
  15. $where = [];
  16. $where['delStatus'] = 0;
  17. $list = ShopAdminService::getAdminList($where);
  18. util::success($list);
  19. }
  20. //删除员工、商家、和申请信息 shish
  21. public function actionDelete()
  22. {
  23. $id = Yii::$app->request->get('id');
  24. $shopAdmin = ShopAdminClass::getAdminInfo($id);
  25. if (empty($shopAdmin)) {
  26. util::fail('没有找到员工');
  27. }
  28. if (getenv('YII_ENV', 'local') == 'production') {
  29. util::fail('生产环境不能执行删除操作');
  30. }
  31. $adminId = $shopAdmin['adminId'] ?? 0;
  32. $sjId = $shopAdmin['merchantId'] ?? 0;
  33. SjClass::deleteById($sjId);
  34. ApplyClass::deleteByCondition(['sjId' => $sjId]);
  35. AdminClass::deleteById($adminId);
  36. ShopAdminClass::deleteById($id);
  37. util::complete();
  38. }
  39. }