shish 4 年 前
コミット
2268798120
1 ファイル変更24 行追加22 行削除
  1. 24 22
      console/controllers/InitController.php

+ 24 - 22
console/controllers/InitController.php

@@ -128,28 +128,6 @@ class InitController extends Controller
             }
         }
 
-
-        //清除零售商城相关的数据
-        $sql = "TRUNCATE xhUser;TRUNCATE xhCustom;truncate xhUserAsset;";
-        Yii::$app->db->createCommand($sql)->execute();
-        $sql = "UPDATE xhOrder SET customId=0,customName='',alipayId=0;";
-        Yii::$app->db->createCommand($sql)->execute();
-        //补已经存在花店的默认客户
-        $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
-        if (!empty($lsShopList)) {
-            foreach ($lsShopList as $lsShop) {
-                $mobile = $lsShop->mobile ?? 0;
-                if (empty($mobile)) {
-                    continue;
-                }
-                $user = UserClass::replaceUser(['mobile' => $mobile]);
-                $custom = \bizHd\custom\classes\CustomClass::replaceCustom($lsShop, $user);
-                $customId = $custom->id ?? 0;
-                $lsShop->defaultCustomId = $customId;
-                $lsShop->save();
-            }
-        }
-
     }
 
     //初始化 ./yii init/main
@@ -234,6 +212,7 @@ class InitController extends Controller
                 self::setGhs($pfShopId, $mainId);
 
             }
+
         }
 
         //零售
@@ -283,6 +262,29 @@ class InitController extends Controller
         //客户和供应商的中央化
         self::ghsCustomMain();
 
+
+        //清除零售商城相关的数据
+        $sql = "TRUNCATE xhUser;TRUNCATE xhCustom;truncate xhUserAsset;";
+        Yii::$app->db->createCommand($sql)->execute();
+        $sql = "UPDATE xhOrder SET customId=0,customName='',alipayId=0;";
+        Yii::$app->db->createCommand($sql)->execute();
+        //补已经存在花店的默认客户
+        $lsShopList = ShopClass::getAllByCondition(['ptStyle' => dict::getDict('ptStyle', 'hd')], null, '*', null, true);
+        if (!empty($lsShopList)) {
+            foreach ($lsShopList as $lsShop) {
+                $mobile = $lsShop->mobile ?? 0;
+                if (empty($mobile)) {
+                    continue;
+                }
+                $user = UserClass::replaceUser(['mobile' => $mobile]);
+                $custom = \bizHd\custom\classes\CustomClass::replaceCustom($lsShop, $user);
+                $customId = $custom->id ?? 0;
+                $lsShop->defaultCustomId = $customId;
+                $lsShop->save();
+            }
+        }
+
+
     }
 
     //客户和供应商的中央化 ssh 20220506