Преглед изворни кода

Merge branch 'master' of http://git.huaml.com/zhh/huahuibao

shish пре 1 година
родитељ
комит
19f5aed0bf
2 измењених фајлова са 67 додато и 3 уклоњено
  1. 66 1
      app-ghs/controllers/CsController.php
  2. 1 2
      common/components/book.php

+ 66 - 1
app-ghs/controllers/CsController.php

@@ -43,7 +43,72 @@ use bizGhs\stock\classes\StockRecordClass;
 class CsController extends BaseController
 {
 
-    public $guestAccess = ['list'];
+    public $guestAccess = ['list', 'read'];
+
+    public function actionRead()
+    {
+        $phpExcelFile = Yii::getAlias("@vendor/phpoffice/phpexcel/");
+        $currentDirectory = getcwd();
+
+        require_once($phpExcelFile . 'Classes/PHPExcel/IOFactory.php');
+        $spreadsheet = \PHPExcel_IOFactory::load($currentDirectory . "/123.xlsx");
+
+        //print_r($objPHPExcel->getActiveSheet()->toArray());
+
+//        foreach ($spreadsheet->getActiveSheet()->getRowIterator() as $row) {
+//            foreach ($row->getCellIterator() as $cell) {
+//                if (!$cell->getValue()) { // 跳过空白单元格
+//                    continue;
+//                }
+//                echo 'Cell ' . $cell->getColumn() . $cell->getRow() . ' = ' . $cell->getValue() . '<br />';
+//            }
+//        }
+
+
+
+        // 获取活动工作表
+        $worksheet = $spreadsheet->getActiveSheet();
+
+        // 遍历每一行
+        foreach ($worksheet->getRowIterator() as $row) {
+            $cellIterator = $row->getCellIterator();
+            $cellIterator->setIterateOnlyExistingCells(FALSE); // 这里设置为迭代所有单元格,包括空单元格
+
+            // 遍历每列
+            $rowData = [];
+            foreach ($cellIterator as $cell) {
+                $rowData[] = $cell->getValue();
+            }
+
+            // 输出当前行数据
+            echo implode(", ", $rowData) . "\n";
+        }
+
+
+
+//        // 加载Excel文件
+//        $spreadsheet = IOFactory::load($filePath);
+//
+//        // 获取活动工作表
+//        $worksheet = $spreadsheet->getActiveSheet();
+//
+//        // 遍历每一行
+//        foreach ($worksheet->getRowIterator() as $row) {
+//            $cellIterator = $row->getCellIterator();
+//            $cellIterator->setIterateOnlyExistingCells(FALSE); // 这里设置为迭代所有单元格,包括空单元格
+//
+//            // 遍历每列
+//            $rowData = [];
+//            foreach ($cellIterator as $cell) {
+//                $rowData[] = $cell->getValue();
+//            }
+//
+//            // 输出当前行数据
+//            echo implode(", ", $rowData) . "\n";
+//        }
+
+
+    }
 
     public function actionList()
     {

+ 1 - 2
common/components/book.php

@@ -95,8 +95,7 @@ class book
         ],
         'chargeStandard' => [
             ['style' => 'info', 'value' => '软件年费980元/年,客户通过小程序下单,会扣千分之3.3手续费(即1千元扣3.3元)。',],
-            ['style' => 'info', 'value' => '为保证软件公司的收支稳定,软件系统上带有广告,如需去掉广告,需另付3900元/年,可去除所有广告。',],
-            ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国100多家批发商磨合使用,非常成熟好用,请放心购买使用,以下套餐已包含第一年年费。',],
+            ['style' => 'info', 'value' => '根据你自身门店情况,选择以下套餐。下面列出的套餐,已经过全国100多家批发商磨合使用,非常成熟好用,请放心购买使用,以下套餐已含首年年费。',],
             ['style' => 'info', 'value' => '-------------------------------------------',],
             ['style' => 'smallTitle', 'value' => '仓库版',],
             ['style' => 'info', 'value' => '整套软件功能(一年)',],