shish 4 年 前
コミット
473845771c
1 ファイル変更13 行追加4 行削除
  1. 13 4
      app-pt/controllers/ShopAdminController.php

+ 13 - 4
app-pt/controllers/ShopAdminController.php

@@ -5,6 +5,7 @@ namespace pt\controllers;
 use biz\admin\classes\AdminClass;
 use biz\ghs\classes\GhsClass;
 use biz\shop\classes\ShopAdminClass;
+use biz\shop\classes\ShopClass;
 use biz\sj\classes\SjClass;
 use bizGhs\custom\classes\CustomClass;
 use bizHd\admin\services\ShopAdminService;
@@ -40,14 +41,21 @@ class ShopAdminController extends BaseController
         try {
             $adminId = $shopAdmin['adminId'] ?? 0;
             $sjId = $shopAdmin['sjId'] ?? 0;
+            $mainId = $shopAdmin['mainId'] ?? 0;
+            $shopList = ShopClass::getAllByCondition(['mainId' => $mainId], null, '*', null, true);
+            if (!empty($shopList)) {
+                foreach ($shopList as $shop) {
+                    $mobile = $shop->mobile ?? '';
+                    if (!empty($mobile)) {
+                        ApplyClass::deleteByCondition(['mobile' => $mobile]);
+                    }
+                    $shop->delete();
+                }
+            }
             $sj = SjClass::getById($sjId, true);
             if (!empty($sj)) {
                 $sj->delete();
             }
-            $apply = ApplyClass::getByCondition(['sjId' => $sjId], true);
-            if (!empty($apply)) {
-                $apply->delete();
-            }
             $admin = AdminClass::getById($adminId, true);
             if (!empty($admin)) {
                 $admin->delete();
@@ -56,6 +64,7 @@ class ShopAdminController extends BaseController
             if (!empty($shopAdmin)) {
                 $shopAdmin->delete();
             }
+            ShopAdminClass::deleteByCondition(['mainId' => $mainId]);
             $ghsList = GhsClass::getAllByCondition(['ownSjId' => $sjId], null, '*', null, true);
             if (!empty($ghsList)) {
                 foreach ($ghsList as $ghs) {