Jelajahi Sumber

修改路径,将左侧删除/去掉,不然路径会有问题,不是绝对路径

zxiansheng 4 tahun lalu
induk
melakukan
c53a69354a

+ 1 - 1
backendApi/modules/v1/controllers/FinanceController.php

@@ -1168,7 +1168,7 @@ class FinanceController extends BaseController {
         $hash = '';
         $max = strlen($seed) - 1;
         for ($i = 0; $i < $length; $i++) {
-            $hash .= $seed{mt_rand(0, $max)};
+            $hash .= $seed[mt_rand(0, $max)];
         }
         return $hash;
     }

+ 4 - 2
common/libs/export/BaseExport.php

@@ -140,7 +140,7 @@ class BaseExport extends Component {
      */
     public function getSavePath() {
         $this->savePath = $this->pathCreator(date('Ymd', Date::nowTime()));
-        return trim($this->savePath, __DS__);
+        return rtrim($this->savePath, __DS__);
     }
 
     /**
@@ -148,7 +148,8 @@ class BaseExport extends Component {
      */
     public function getSaveBasePath() {
         $this->saveBasePath = Yii::getAlias('@backendApi') . __DS__ . 'web' . __DS__ . 'upload' . __DS__ . \Yii::$app->params['excelLocalDir'];
-        return trim($this->saveBasePath, __DS__);
+        
+        return rtrim($this->saveBasePath, __DS__);
     }
 
     /**
@@ -410,6 +411,7 @@ class BaseExport extends Component {
             'exportId' => $export->ID,
             'userId' => $params['userId'],
         ]);
+
         // 异步处理添加任务
         $taskKey = \Yii::$app->swooleAsyncTimer->asyncHandle($params['action'], $extend);
         if($taskKey === false){