shish 1 an în urmă
părinte
comite
17c80dd2d6
1 a modificat fișierele cu 51 adăugiri și 0 ștergeri
  1. 51 0
      console/controllers/HfController.php

+ 51 - 0
console/controllers/HfController.php

@@ -0,0 +1,51 @@
+<?php
+
+namespace console\controllers;
+
+use biz\ghs\classes\GhsClass;
+use biz\shop\classes\ShopClass;
+use biz\shop\services\ShopAdminService;
+use biz\sj\classes\SjClass;
+use bizGhs\admin\classes\AdminClass;
+use bizGhs\custom\classes\CustomClass;
+use bizGhs\custom\models\Custom;
+use bizGhs\order\classes\OrderClass;
+use bizHd\purchase\classes\PurchaseClass;
+use bizHd\saas\classes\ApplyClass;
+use bizHd\saas\services\ApplyService;
+use common\components\dict;
+use common\components\noticeUtil;
+use common\components\stringUtil;
+use common\components\util;
+use yii\console\Controller;
+use Yii;
+
+class HfController extends Controller
+{
+
+    public function actionCopy()
+    {
+        ini_set('memory_limit', '2045M');
+        set_time_limit(0);
+
+        //指定当前环境为批发商
+        Yii::$app->params['ptStyle'] = dict::getDict('ptStyle', 'ghs');
+
+        if (getenv('YII_ENV') == 'production') {
+            $toShopId = 33904;
+            $fromShopId = 12526;
+        } else {
+            $toShopId = 36677;
+            $fromShopId = 36523;
+        }
+
+        $fromCustomList = CustomClass::getAllByCondition(['ownShopId' => $fromShopId], null, '*');
+        foreach ($fromCustomList as $fromCustomer) {
+            $exist = CustomClass::exists(['ownShopId' => $toShopId, 'shopId' => $fromCustomer['shopId']]);
+            if (!$exist) {
+                CustomClass::build($toShopId, $fromCustomer['shopId'], $fromCustomer['name']);
+            }
+        }
+    }
+
+}