Sfoglia il codice sorgente

删除账号方法

shish 4 anni fa
parent
commit
03eeca9be0
1 ha cambiato i file con 15 aggiunte e 11 eliminazioni
  1. 15 11
      console/controllers/SjController.php

+ 15 - 11
console/controllers/SjController.php

@@ -26,20 +26,24 @@ class SjController extends Controller
         foreach ($argv as $key => $item) {
             if ($key > 1) {
                 $mobile = $item;
-                $shop = ShopClass::getByCondition(['mobile' => $mobile], true);
-                if (!empty($shop)) {
-                    $merchantName = $shop->merchantName ?? '';
-                    if (!empty($merchantName)) {
-                        SjClass::deleteByCondition(['name' => $merchantName]);
+                $shopList = ShopClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($shopList)) {
+                    foreach ($shopList as $shop) {
+                        $merchantName = $shop->merchantName ?? '';
+                        if (!empty($merchantName)) {
+                            SjClass::deleteByCondition(['name' => $merchantName]);
+                        }
+                        $shop->delete();
                     }
-                    $shop->delete();
                 }
                 ApplyClass::deleteByCondition(['mobile' => $mobile]);
-                $admin = AdminClass::getByCondition(['mobile' => $mobile], true);
-                if (!empty($admin)) {
-                    $adminId = $admin->id ?? 0;
-                    ShopAdminClass::deleteByCondition(['adminId' => $adminId]);
-                    $admin->delete();
+                $adminList = AdminClass::getAllByCondition(['mobile' => $mobile], null, '*', null, true);
+                if (!empty($adminList)) {
+                    foreach ($adminList as $admin) {
+                        $adminId = $admin->id ?? 0;
+                        ShopAdminClass::deleteByCondition(['adminId' => $adminId]);
+                        $admin->delete();
+                    }
                 }
             }
         }