Просмотр исходного кода

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

kevinElken 7 месяцев назад
Родитель
Сommit
e489c4e871

+ 6 - 0
common/libs/export/BaseExport.php

@@ -1109,6 +1109,9 @@ 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');
+            }
             $pdf->Image('@' . $image, 165, 5, 20, 10, 'JPG');
             $pdf->writeHTML($context);
             $pdf->Output($realFile, 'F');
@@ -1505,6 +1508,9 @@ ORDER;
             // 设置字体
             $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');
+            }
             $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
             $pdf->writeHTML($context);
             $pdf->Output($realFile, 'F');

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

@@ -1047,6 +1047,9 @@ ORDER;
         // 设置字体
         $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');
+        }
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);
 
@@ -1311,6 +1314,9 @@ ORDER;
         // 设置字体
         $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');
+        }
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);
 
@@ -1881,6 +1887,9 @@ ORDER;
         // 设置字体
         $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');
+        }
         $pdf->Image('@' . $image, 15, 12, 20, 7, 'JPG');
         $pdf->writeHTML($context);