lrf402788946 4 lat temu
rodzic
commit
65ba0818a9
1 zmienionych plików z 11 dodań i 12 usunięć
  1. 11 12
      app/controller/files.js

+ 11 - 12
app/controller/files.js

@@ -72,9 +72,8 @@ class FilesController extends Controller {
     assert(type, 'type不允许为空');
     const { ctx, app } = this;
     const url = app.config.wx.wxdown(appid, serverid);
-    console.log(url);
-    console.log(type);
     const file = await this.ctx.curl(url);
+    console.log(url);
     const stream = new wxstream.PassThrough();
     stream.end(file.data);
     const rootPath = `${app.config.cdn.repos_root_path}`;
@@ -89,17 +88,17 @@ class FilesController extends Controller {
       const dirs = [ 'wxadio' ];
       const saved = await this.wxsaveFile(rootPath, dirs, stream, '.amr');
       // 音频时如果需要使用转码,以下调用ffmpeg进行转码处理
-      const hz = '.mp3';
+      // const hz = '.mp3';
       const resultname = `${saved.id}${hz}`;
-      const ffurl = `${saved.filePath}${resultname}`;
-      if (!ffmpeg) throw new BusinessError(ErrorCode.SERVICE_FAULT, '转换失败');
-      new ffmpeg({ source: `${saved.filePath}${saved.fileName}` })
-        .saveToFile(ffurl, function(retcode, error) {
-        })
-        .on('end', function() {
-          // 在这里处理完成后的结果
-          console.log('Finished processing');
-        });
+      // const ffurl = `${saved.filePath}${resultname}`;
+      // if (!ffmpeg) throw new BusinessError(ErrorCode.SERVICE_FAULT, '转换失败');
+      // new ffmpeg({ source: `${saved.filePath}${saved.fileName}` })
+      //   .saveToFile(ffurl, function(retcode, error) {
+      //   })
+      //   .on('end', function() {
+      //     // 在这里处理完成后的结果
+      //     console.log('Finished processing');
+      //   });
       uri = `${rootUrl}/${dirs.join('/')}/${resultname}`;
     } else if (type === '2') {
       const dirs = [ 'wxvideo' ];