shish hace 2 años
padre
commit
6fae244507
Se han modificado 1 ficheros con 25 adiciones y 16 borrados
  1. 25 16
      console/controllers/CustomController.php

+ 25 - 16
console/controllers/CustomController.php

@@ -160,9 +160,6 @@ class CustomController extends Controller
                 $post['introSjName'] = $customerInfo[4];
                 $post['introStyle'] = SjClass::STYLE_SUPPLIER;
 
-
-                noticeUtil::push(json_encode($post), '15280215347');
-
                 $post['name'] = $shopName;
                 if (empty($shopName)) {
                     noticeUtil::push("花店 {$shopName} 手机号 {$mobile} 添加失败,名称没有填写", '15280215347');
@@ -264,29 +261,41 @@ class CustomController extends Controller
     public function actionFileCreateCustom()
     {
         $customerCachedKey = 'file_batch_create_customer_list';
-        $customList = [];
+        $fileCustomList = [];
         while ($count = Yii::$app->redis->executeCommand('LLEN', [$customerCachedKey])) {
             $customer = Yii::$app->redis->executeCommand('RPOP', [$customerCachedKey]);
-            $customList[] = $customer;
+            $fileCustomList[] = $customer;
         }
 
-//        if (empty($customList)) {
+//        if (empty($fileCustomList)) {
 //            return false;
 //        }
 
-        $customList = ['36523,/usr/local/nginx/html/huahuibao/vendor/../../resource/images/uploads/12970/36523/202404/26/dc5d37d62379c51c1a670f9fbea1b76e.txt'];
+        $fileCustomList = ['36523,/usr/local/nginx/html/huahuibao/vendor/../../resource/images/uploads/12970/36523/202404/26/dc5d37d62379c51c1a670f9fbea1b76e.txt'];
+        foreach ($fileCustomList as $fileCustom) {
 
+            $customerInfo = explode(',', $fileCustom);
+            $masterShopId = $customerInfo[0];
+            $masterShop = ShopClass::getById($masterShopId, true);
+            $masterSjId = $masterShop->sjId ?? 0;
+            $masterSjName = $masterShop->merchantName ?? '';
 
-        foreach ($customList as $customer) {
-
-            $customerInfo = explode(',', $customer);
-            $shopId = $customerInfo[0];
             $filePath = $customerInfo[1];
 
             $content = file_get_contents($filePath);
             $content = trim($content);
-            $shopName = '';
-            $mobile = '';
+
+            $arr = explode('
+', $content);
+
+            print_r($arr);
+
+        }
+        die;
+
+
+        foreach ($customList as $customer) {
+
 
             $connection = Yii::$app->db;
             $transaction = $connection->beginTransaction();
@@ -295,9 +304,9 @@ class CustomController extends Controller
 
                 // 组织表单数据
                 $post = [];
-                $post['introSjId'] = $customerInfo[2];
-                $post['introShopId'] = $customerInfo[3];
-                $post['introSjName'] = $customerInfo[4];
+                $post['introSjId'] = $masterSjId;
+                $post['introShopId'] = $masterShopId;
+                $post['introSjName'] = $masterSjName;
                 $post['introStyle'] = SjClass::STYLE_SUPPLIER;
 
                 $post['name'] = $shopName;