$item) { if ($key > 1) { $mobile = $item; $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]); } $sjId = $shop->sjId ?? 0; $shop->delete(); if (!empty($sjId)) { $ghsList = GhsClass::getAllByCondition(['ownSjId' => $sjId], null, '*', null, true); if (!empty($ghsList)) { foreach ($ghsList as $ghs) { $customId = $ghs->customId; $ghs->delete(); $current = CustomClass::getById($customId, true); if (!empty($current)) { $current->delete(); } } } $customList = CustomClass::getAllByCondition(['ownSjId' => $sjId], null, '*', null, true); if (!empty($customList)) { foreach ($customList as $custom) { $ghsId = $custom->ghsId; $custom->delete(); $current = GhsClass::getById($ghsId, true); if (!empty($current)) { $current->delete(); } } } } } } ApplyClass::deleteByCondition(['mobile' => $mobile]); $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(); } } } } } }