wesmiler 6 vuotta sitten
vanhempi
commit
0789268781

+ 6 - 1
vendor/thinkcmf/cmf-app/src/weixin/controller/TestController.php

@@ -17,9 +17,14 @@ use cmf\lib\Storage;
 class TestController extends HomeBaseController
 {
     public function index(){
-        $file = "upload/files/print/20200303/49edc7d27a649c0f806d6375228067b1.doc";
+        $file = "files/print/20200310/122c1f244735215998bd071220e7ef46.docx";
 
+        $file = Stroage::convertFile($file,'doc');
+        echo $file;
+        $file = Stroage::onLineConvertFile($file);
+        var_dump($file);
         $file = Stroage::getPdfFilePage($file);
+        var_dump($file);
 
         echo "<img src='/{$file}' width='100%'>";
 

+ 2 - 2
vendor/thinkcmf/cmf-app/src/weixin/model/Stroage.php

@@ -338,12 +338,12 @@ class Stroage extends Model
      * @param $file 文件
      * @return mixed
      */
-    public static function onLineConvertFile($file)
+    public static function onLineConvertFile($file, $type='pdf')
     {
         $fileType = getFileType($file);
         $pathFile = preg_match("/^files/", $file) ? UPLOAD_PATH . $file : $file;
         $path = dirname($pathFile) . '/';
-        $filename = str_replace('.' . $fileType, '.pdf', $file);
+        $filename = str_replace('.' . $fileType, '.'.$type, $file);
         $typeData = config('files.convertTypes');
         $minType = isset($typeData[$fileType]) ? $typeData[$fileType] : '';
         if (empty($minType)) {