shish 5 سال پیش
والد
کامیت
bf841489e0
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 5 3
      app-ghs/controllers/CsController.php

+ 5 - 3
app-ghs/controllers/CsController.php

@@ -109,9 +109,11 @@ class CsController extends PublicController
         $letter = [1=>['A','B'],2=>['C','D'],3=>['E','F'],4=>['G','H'],5=>['I','J'],6=>['K','L'],7=>['M','N'],
             8=>['O','P'],9=>['Q','R'],10=>['S','T'],11=>['U','V']];
         $lastCell = '';
+        //最大行
+        $max = 50;
         foreach ($formatData as $key => $product) {
-            $currentPage = ceil($i/50);
-            $x = $i%50 == 0 ? 50 : $i%50;
+            $currentPage = ceil($i/$max);
+            $x = $i%$max == 0 ? $max : $i%$max;
             $before = $letter[$currentPage][0] ?? 'A';
             $after = $letter[$currentPage][1] ?? 'B';
             if(isset($product['price']) == false || empty($product['price'])){
@@ -124,7 +126,7 @@ class CsController extends PublicController
             }else{
                 $objPHPExcel->getActiveSheet()->setCellValue($before. $x, $product['name'])->setCellValue($after . $x, $product['price']);
             }
-            $lastCell = $after.$x;
+            $lastCell = $after.$max;
             $i++;
         }