Bladeren bron

bugfix: EK-0524: 结算后台无法下载PDF订单.

kevinElken 7 maanden geleden
bovenliggende
commit
20940c4467
2 gewijzigde bestanden met toevoegingen van 25 en 18 verwijderingen
  1. 12 9
      common/libs/export/BaseExport.php
  2. 13 9
      frontendApi/modules/v1/controllers/ShopController.php

+ 12 - 9
common/libs/export/BaseExport.php

@@ -830,10 +830,11 @@ ORDER;
             $pdf->AddPage();
             // 设置字体
             $pdf->SetFont('stsongstdlight', '', 10, '', true);
-            $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-            if (!file_exists($image)) {
-                $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+            $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+            if (!file_exists($image_file)) {
+                $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
             }
+            $image = file_get_contents($image_file);
 
             $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
             $pdf->writeHTML($context);
@@ -1108,10 +1109,11 @@ ORDER;
             // 设置字体
             $pdf->SetFont('stsongstdlight', '', 10, '', true);
             $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
-            $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-            if (!file_exists($image)) {
-                $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+            $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+            if (!file_exists($image_file)) {
+                $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
             }
+            $image = file_get_contents($image_file);
             $pdf->Image('@' . $image, 165, 5, 20, 10, 'JPG');
             $pdf->writeHTML($context);
             $pdf->Output($realFile, 'F');
@@ -1507,10 +1509,11 @@ ORDER;
             $pdf->AddPage();
             // 设置字体
             $pdf->SetFont('stsongstdlight', '', 10, '', true);
-            $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-            if (!file_exists($image)) {
-                $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+            $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+            if (!file_exists($image_file)) {
+                $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
             }
+            $image = file_get_contents($image_file);
             $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
             $pdf->writeHTML($context);
             $pdf->Output($realFile, 'F');

+ 13 - 9
frontendApi/modules/v1/controllers/ShopController.php

@@ -1046,10 +1046,11 @@ ORDER;
         $pdf->AddPage();
         // 设置字体
         $pdf->SetFont('stsongstdlight', '', 10, '', true);
-        $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-        if (!file_exists($image)) {
-            $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+        $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+        if (!file_exists($image_file)) {
+            $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
         }
+        $image = file_get_contents($image_file);
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);
 
@@ -1313,10 +1314,11 @@ ORDER;
         $pdf->AddPage();
         // 设置字体
         $pdf->SetFont('stsongstdlight', '', 10, '', true);
-        $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-        if (!file_exists($image)) {
-            $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+        $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+        if (!file_exists($image_file)) {
+            $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
         }
+        $image = file_get_contents($image_file);
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);
 
@@ -1886,10 +1888,12 @@ ORDER;
         $pdf->AddPage();
         // 设置字体
         $pdf->SetFont('stsongstdlight', '', 10, '', true);
-        $image = file_get_contents(\Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg');
-        if (!file_exists($image)) {
-            $image = file_get_contents(\Yii::$app->runtimePath . '/uploads/ngds-logo.jpg');
+        $image_file = \Yii::$app->basePath . '/../frontendEle/src/static/img/ngds-logo.jpg';
+        if (!file_exists($image_file)) {
+            $image_file = \Yii::$app->runtimePath . '/uploads/ngds-logo.jpg';
         }
+        $image = file_get_contents($image_file);
+
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);