正在显示
3 个修改的文件
包含
65 行增加
和
23 行删除
1 | { | 1 | { |
2 | "GETCLASSURL": "http://139.196.126.156:8081/getLogs/recordClassList", | 2 | "GETCLASSURL": "http://139.196.126.156:8081/getLogs/recordClassList", |
3 | "GETCLASSURLPARAMETER": { | 3 | "GETCLASSURLPARAMETER": { |
4 | - "siteId": [], | 4 | + "siteId": ["quanpinzy"], |
5 | "key": "xdymp4record20191225", | 5 | "key": "xdymp4record20191225", |
6 | "page": 1, | 6 | "page": 1, |
7 | "maxMedia": 1 | 7 | "maxMedia": 1 |
@@ -5,39 +5,51 @@ const methods = { | @@ -5,39 +5,51 @@ const methods = { | ||
5 | let YesterdayTime = (new Date).getTime() - 24 * 60 * 60 * 1000 | 5 | let YesterdayTime = (new Date).getTime() - 24 * 60 * 60 * 1000 |
6 | let YesterdayTimeDate = new Date(YesterdayTime) | 6 | let YesterdayTimeDate = new Date(YesterdayTime) |
7 | let year = YesterdayTimeDate.getFullYear() | 7 | let year = YesterdayTimeDate.getFullYear() |
8 | + year = year.toString() | ||
8 | let month = YesterdayTimeDate.getMonth() + 1 | 9 | let month = YesterdayTimeDate.getMonth() + 1 |
9 | let date = YesterdayTimeDate.getDate() | 10 | let date = YesterdayTimeDate.getDate() |
10 | let startTime = new Date(year + "-" + month + "-" + date + " 5:30:00").getTime() | 11 | let startTime = new Date(year + "-" + month + "-" + date + " 5:30:00").getTime() |
11 | let endTime = new Date(year + "-" + month + "-" + date + " 23:59:00").getTime() | 12 | let endTime = new Date(year + "-" + month + "-" + date + " 23:59:00").getTime() |
12 | - if(month < 10){ | 13 | + if (month < 10) { |
13 | month = '0' + month | 14 | month = '0' + month |
15 | + }else{ | ||
16 | + month = month.toString() | ||
14 | } | 17 | } |
15 | - if(date < 10){ | 18 | + |
19 | + if (date < 10) { | ||
16 | date = '0' + date | 20 | date = '0' + date |
21 | + }else{ | ||
22 | + date = date.toString() | ||
17 | } | 23 | } |
18 | return { | 24 | return { |
19 | startTime, | 25 | startTime, |
20 | endTime, | 26 | endTime, |
21 | - ymd:year+month+date | 27 | + ymd: year + month + date |
22 | } | 28 | } |
23 | }, | 29 | }, |
24 | dayTimeYMD() { | 30 | dayTimeYMD() { |
25 | let dayTimeDate = new Date() | 31 | let dayTimeDate = new Date() |
26 | let year = dayTimeDate.getFullYear() | 32 | let year = dayTimeDate.getFullYear() |
33 | + year = year.toString() | ||
27 | let month = dayTimeDate.getMonth() + 1 | 34 | let month = dayTimeDate.getMonth() + 1 |
28 | let date = dayTimeDate.getDate() | 35 | let date = dayTimeDate.getDate() |
29 | - if(month < 10){ | 36 | + if (month < 10) { |
30 | month = '0' + month | 37 | month = '0' + month |
38 | + }else{ | ||
39 | + month = month.toString() | ||
31 | } | 40 | } |
32 | - if(date < 10){ | 41 | + if (date < 10) { |
33 | date = '0' + date | 42 | date = '0' + date |
43 | + }else{ | ||
44 | + date = date.toString() | ||
34 | } | 45 | } |
35 | return { | 46 | return { |
36 | - ymd:year+ month + date | 47 | + ymd: year + month + date |
37 | } | 48 | } |
38 | }, | 49 | }, |
39 | - async getRequestClassIds(url, siteId, key, startTime, endTime,page) { | 50 | + async getRequestClassIds(url, siteId, key, startTime, endTime, page) { |
40 | let axiosUrl = `${url}?siteId=${siteId}&key=${key}&from=${startTime}&to=${endTime}&page=${page}` | 51 | let axiosUrl = `${url}?siteId=${siteId}&key=${key}&from=${startTime}&to=${endTime}&page=${page}` |
52 | + console.log('axiosUrl', axiosUrl) | ||
41 | let result = await axios.get(axiosUrl) | 53 | let result = await axios.get(axiosUrl) |
42 | return result | 54 | return result |
43 | }, | 55 | }, |
@@ -13,6 +13,7 @@ const { YesterdayTime, getRequestClassIds, dayTimeYMD } = method | @@ -13,6 +13,7 @@ const { YesterdayTime, getRequestClassIds, dayTimeYMD } = method | ||
13 | let siteIds = [] | 13 | let siteIds = [] |
14 | 14 | ||
15 | let classid = [] | 15 | let classid = [] |
16 | +let classidPost = [] | ||
16 | let parentData = {} | 17 | let parentData = {} |
17 | var classobj = {}; | 18 | var classobj = {}; |
18 | let className = "" | 19 | let className = "" |
@@ -94,8 +95,22 @@ class MediaCreat { | @@ -94,8 +95,22 @@ class MediaCreat { | ||
94 | } | 95 | } |
95 | let files = fs.readdirSync(ymdDir); | 96 | let files = fs.readdirSync(ymdDir); |
96 | // let interValGetFile = setInterval(()=>{ | 97 | // let interValGetFile = setInterval(()=>{ |
98 | + this.wrieLog("files:" + files) | ||
97 | if (files.indexOf(id + ".mp4") != -1) { | 99 | if (files.indexOf(id + ".mp4") != -1) { |
98 | this.wrieLog("已存在:" + id + "课堂号,停止继续录制") | 100 | this.wrieLog("已存在:" + id + "课堂号,停止继续录制") |
101 | + if (type == 'post') { | ||
102 | + if (classidPost.length) { | ||
103 | + let shiftData = classidPost.shift() | ||
104 | + this.wrieLog(" 录制下一节课 课堂号:" + shiftData['classId']) | ||
105 | + this.recordingCreat(shiftData['classId'], shiftData['siteId'], type) | ||
106 | + } | ||
107 | + } else { | ||
108 | + if (classid.length) { | ||
109 | + let shiftData = classid.shift() | ||
110 | + this.wrieLog(" 录制下一节课 课堂号:" + shiftData['classId']) | ||
111 | + this.recordingCreat(shiftData['classId'], shiftData['siteId'], type) | ||
112 | + } | ||
113 | + } | ||
99 | return | 114 | return |
100 | } | 115 | } |
101 | // 目前url是linux的写法 win系统不支持 | 116 | // 目前url是linux的写法 win系统不支持 |
@@ -115,18 +130,34 @@ class MediaCreat { | @@ -115,18 +130,34 @@ class MediaCreat { | ||
115 | if (files.indexOf(id + ".mp4") == -1) { | 130 | if (files.indexOf(id + ".mp4") == -1) { |
116 | this.wrieLog(" 课堂录制未发现该" + id + "课堂号") | 131 | this.wrieLog(" 课堂录制未发现该" + id + "课堂号") |
117 | } else { | 132 | } else { |
118 | - if (classid.length) { | ||
119 | - let shiftData = classid.shift() | ||
120 | - this.wrieLog(" 录制下一节课 课堂号:" + shiftData['classId']) | ||
121 | - this.recordingCreat(shiftData['classId'], shiftData['siteId'], type) | 133 | + if (type == 'get') { |
134 | + if (classid.length) { | ||
135 | + let shiftData = classid.shift() | ||
136 | + this.wrieLog(" 录制下一节课 课堂号:" + shiftData['classId']) | ||
137 | + this.recordingCreat(shiftData['classId'], shiftData['siteId'], type) | ||
138 | + } else { | ||
139 | + this.wrieLog("录制结束:------>") | ||
140 | + fs.writeFile(ymdDir + "/download.json", `{ "code": "0", "success": "ok"}`, function (err) { | ||
141 | + if (err) { | ||
142 | + console.log(err); | ||
143 | + } | ||
144 | + }); | ||
145 | + } | ||
122 | } else { | 146 | } else { |
123 | - this.wrieLog("录制结束:------>") | ||
124 | - fs.writeFile(ymdDir + "/download.json", `{ "code": "0", "success": "ok"}`, function (err) { | ||
125 | - if (err) { | ||
126 | - console.log(err); | ||
127 | - } | ||
128 | - }); | 147 | + if (classidPost.length) { |
148 | + let shiftData = classidPost.shift() | ||
149 | + this.wrieLog(" 录制下一节课 课堂号:" + shiftData['classId']) | ||
150 | + this.recordingCreat(shiftData['classId'], shiftData['siteId'], type) | ||
151 | + } else { | ||
152 | + this.wrieLog("录制结束:------>") | ||
153 | + fs.writeFile(ymdDir + "/download.json", `{ "code": "0", "success": "ok"}`, function (err) { | ||
154 | + if (err) { | ||
155 | + console.log(err); | ||
156 | + } | ||
157 | + }); | ||
158 | + } | ||
129 | } | 159 | } |
160 | + | ||
130 | } | 161 | } |
131 | }) | 162 | }) |
132 | } | 163 | } |
@@ -193,19 +224,18 @@ router.post('/recording', async function (req, res, next) { | @@ -193,19 +224,18 @@ router.post('/recording', async function (req, res, next) { | ||
193 | let fileConfig = new MediaCreat().getConfigFileJson() | 224 | let fileConfig = new MediaCreat().getConfigFileJson() |
194 | if (!fileConfig) return false | 225 | if (!fileConfig) return false |
195 | let { classId, maxMedia } = req.body | 226 | let { classId, maxMedia } = req.body |
196 | - if (classid.length > 0) { | 227 | + if (classidPost.length > 0) { |
197 | // 有正在录制中的课堂,禁止重复 | 228 | // 有正在录制中的课堂,禁止重复 |
198 | - res.send({ code: "1", message: "有正在录制中的课堂", data: classid }); | 229 | + res.send({ code: "1", message: "有正在录制中的课堂", data: classidPost }); |
199 | return | 230 | return |
200 | } | 231 | } |
201 | if (classId && classId.length) { | 232 | if (classId && classId.length) { |
202 | - classid = classId | 233 | + classidPost = classId |
203 | if (!maxMedia || maxMedia == undefined) { | 234 | if (!maxMedia || maxMedia == undefined) { |
204 | maxMedia = 1 | 235 | maxMedia = 1 |
205 | } | 236 | } |
206 | - console.log("maxMedia", maxMedia) | ||
207 | for (let i = 0; i < maxMedia; i++) { | 237 | for (let i = 0; i < maxMedia; i++) { |
208 | - let shiftData = classid.shift() | 238 | + let shiftData = classidPost.shift() |
209 | if (shiftData) { | 239 | if (shiftData) { |
210 | new MediaCreat().recordingCreat(shiftData['classId'], shiftData['siteId'], 'post') | 240 | new MediaCreat().recordingCreat(shiftData['classId'], shiftData['siteId'], 'post') |
211 | } else { | 241 | } else { |
-
请 注册 或 登录 后发表评论