shish 2 years ago
parent
commit
fac30774c8
1 changed files with 9 additions and 16 deletions
  1. 9 16
      console/controllers/CustomController.php

+ 9 - 16
console/controllers/CustomController.php

@@ -160,6 +160,8 @@ 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');
@@ -271,31 +273,22 @@ class CustomController extends Controller
 //            return false;
 //        }
 
-        $customList = ['36523,/usr/local/nginx/html/huahuibao/vendor/../../resource/images/uploads/12970/36523/202404/26/028d7e2fada10ffa401a9dfcb5684c73.xls'];
+        $customList = ['36523,/usr/local/nginx/html/huahuibao/vendor/../../resource/images/uploads/12970/36523/202404/26/dc5d37d62379c51c1a670f9fbea1b76e.txt'];
 
-        $phpExcelFile = Yii::getAlias("@vendor/phpoffice/phpexcel/");
-        require_once($phpExcelFile . 'Classes/PHPExcel.php');
 
         foreach ($customList as $customer) {
 
-            $connection = Yii::$app->db;
-            $transaction = $connection->beginTransaction();
-
             $customerInfo = explode(',', $customer);
             $shopId = $customerInfo[0];
             $filePath = $customerInfo[1];
 
-            $PHPExcel = new \PHPExcel(); // 拿到实例,待会儿用
-            $PHPReader = new \PHPExcel_Reader_Excel2007();
-            if (!$PHPReader->canRead($filePath)) {
-                $PHPReader = new \PHPExcel_Reader_Excel5();
-                if (!$PHPReader->canRead($filePath)) {
+            $content = file_get_contents($filePath);
+            $content = trim($content);
+            $shopName = '';
+            $mobile = '';
 
-                    util::stop('无法读取文件');
-                }
-            }
-            $allSheet = $PHPExcel->getSheetCount(); // sheet数
-echo $allSheet;die;
+            $connection = Yii::$app->db;
+            $transaction = $connection->beginTransaction();
 
             try {