ShopAdminController.php 1020 B

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