正在显示
2 个修改的文件
包含
38 行增加
和
8 行删除
1 | module.exports = { | 1 | module.exports = { |
2 | - uploade:'/Users/fzy/project/koa2_Sequelize_project/uploads/' ///Users/fzy/project/koa2_Sequelize_project/uploads/ | 2 | + uploade:'/Users/fzy/project/koa2_Sequelize_project/uploads/', ///Users/fzy/project/koa2_Sequelize_project/uploads/ |
3 | + recordPath:'http://networkschool.xuedianyun.com:8899/' | ||
3 | } | 4 | } |
@@ -2,6 +2,8 @@ const recordInfo =require( '../model/RecordInfoModel') | @@ -2,6 +2,8 @@ const recordInfo =require( '../model/RecordInfoModel') | ||
2 | const tencentRecordInfoModel =require( '../model/tencentRecordInfoModel') | 2 | const tencentRecordInfoModel =require( '../model/tencentRecordInfoModel') |
3 | const callfile = require('child_process'); | 3 | const callfile = require('child_process'); |
4 | const fs = require('fs'); | 4 | const fs = require('fs'); |
5 | +const moment = require('moment') | ||
6 | +const applacation = require('../applacation') | ||
5 | 7 | ||
6 | 8 | ||
7 | function recordInfoService(){ | 9 | function recordInfoService(){ |
@@ -45,13 +47,40 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{ | @@ -45,13 +47,40 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{ | ||
45 | 47 | ||
46 | recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ | 48 | recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ |
47 | try { | 49 | try { |
48 | - let pathURL = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/'+time+"/"+path | ||
49 | - let myPath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/'+time+"/"+path | ||
50 | - let shell = `/20171011/markettest_1227676976_023539/` | ||
51 | - // let filenames = await callfile.exec(myPath) | ||
52 | - let files=fs.readdirSync(pathURL); | ||
53 | - console.log(files) | ||
54 | - return files | 50 | + //let onlinePath = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/' |
51 | + let onlinePath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/' | ||
52 | + var backFile=[]; | ||
53 | + var fileU | ||
54 | + let addrecord = await recordInfo.findAll({where:{channel:path}}); | ||
55 | + addrecord.forEach(function(record){ | ||
56 | + let date1 = moment(Number( record.createTime)).format('YYYYMMDD') | ||
57 | + let date2 = moment(Number(record.createTime)-8*60*60*1000).format('YYYYMMDDhhmmss') | ||
58 | + let channeFile = onlinePath+date1; | ||
59 | + let fschannefiles=fs.readdirSync(channeFile); | ||
60 | + fschannefiles.forEach(function(cfile){ | ||
61 | + if(record.channel == cfile.split('_')[0]+'_'+cfile.split("_")[1]){ | ||
62 | + let pathURL = onlinePath+date1+"/"+cfile; | ||
63 | + let files=fs.readdirSync(pathURL); | ||
64 | + files.forEach(function(file){ | ||
65 | + let type = file.split('.'); | ||
66 | + if(type[1] != 'm3u8'){ | ||
67 | + }else{ | ||
68 | + let fileN = type[0].split('_'); | ||
69 | + if(date2==fileN[1].slice(0,fileN[1].length-3)){ | ||
70 | + backFile.push({ | ||
71 | + channel:record.channel, | ||
72 | + uid:record.uid, | ||
73 | + createTime:record.createTime, | ||
74 | + fileUrl:applacation.recordPath+date1+'/'+cfile+'/'+file | ||
75 | + }) | ||
76 | + console.log('找到文件',files) | ||
77 | + } | ||
78 | + } | ||
79 | + }) | ||
80 | + } | ||
81 | + }) | ||
82 | + }) | ||
83 | + return backFile | ||
55 | } catch (error) { | 84 | } catch (error) { |
56 | throw error; | 85 | throw error; |
57 | } | 86 | } |
-
请 注册 或 登录 后发表评论