|
|
@@ -3,9 +3,11 @@
|
|
|
namespace console\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\saas\classes\ApplyClass;
|
|
|
use common\components\util;
|
|
|
use yii\console\Controller;
|
|
|
@@ -26,20 +28,49 @@ 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]);
|
|
|
+ }
|
|
|
+ $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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- $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();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|