Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
张艾宸
/
webScreen
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
799967501@qq.com
2020-10-10 10:08:11 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
31db053cec05a02560eb345ff8f6f989af1a1e77
31db053c
1 parent
e6dc4ee1
修改日期转换问题
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
65 行增加
和
23 行删除
config/config.json
config/method.js
routes/index.js
config/config.json
查看文件 @
31db053
{
"GETCLASSURL"
:
"http://139.196.126.156:8081/getLogs/recordClassList"
,
"GETCLASSURLPARAMETER"
:
{
"siteId"
:
[],
"siteId"
:
[
"quanpinzy"
],
"key"
:
"xdymp4record20191225"
,
"page"
:
1
,
"maxMedia"
:
1
...
...
config/method.js
查看文件 @
31db053
...
...
@@ -5,39 +5,51 @@ const methods = {
let
YesterdayTime
=
(
new
Date
).
getTime
()
-
24
*
60
*
60
*
1000
let
YesterdayTimeDate
=
new
Date
(
YesterdayTime
)
let
year
=
YesterdayTimeDate
.
getFullYear
()
year
=
year
.
toString
()
let
month
=
YesterdayTimeDate
.
getMonth
()
+
1
let
date
=
YesterdayTimeDate
.
getDate
()
let
startTime
=
new
Date
(
year
+
"-"
+
month
+
"-"
+
date
+
" 5:30:00"
).
getTime
()
let
endTime
=
new
Date
(
year
+
"-"
+
month
+
"-"
+
date
+
" 23:59:00"
).
getTime
()
if
(
month
<
10
)
{
if
(
month
<
10
)
{
month
=
'0'
+
month
}
else
{
month
=
month
.
toString
()
}
if
(
date
<
10
){
if
(
date
<
10
)
{
date
=
'0'
+
date
}
else
{
date
=
date
.
toString
()
}
return
{
startTime
,
endTime
,
ymd
:
year
+
month
+
date
ymd
:
year
+
month
+
date
}
},
dayTimeYMD
()
{
let
dayTimeDate
=
new
Date
()
let
year
=
dayTimeDate
.
getFullYear
()
year
=
year
.
toString
()
let
month
=
dayTimeDate
.
getMonth
()
+
1
let
date
=
dayTimeDate
.
getDate
()
if
(
month
<
10
)
{
if
(
month
<
10
)
{
month
=
'0'
+
month
}
else
{
month
=
month
.
toString
()
}
if
(
date
<
10
)
{
if
(
date
<
10
)
{
date
=
'0'
+
date
}
else
{
date
=
date
.
toString
()
}
return
{
ymd
:
year
+
month
+
date
ymd
:
year
+
month
+
date
}
},
async
getRequestClassIds
(
url
,
siteId
,
key
,
startTime
,
endTime
,
page
)
{
async
getRequestClassIds
(
url
,
siteId
,
key
,
startTime
,
endTime
,
page
)
{
let
axiosUrl
=
`
$
{
url
}?
siteId
=
$
{
siteId
}
&
key
=
$
{
key
}
&
from
=
$
{
startTime
}
&
to
=
$
{
endTime
}
&
page
=
$
{
page
}
`
console
.
log
(
'axiosUrl'
,
axiosUrl
)
let
result
=
await
axios
.
get
(
axiosUrl
)
return
result
},
...
...
routes/index.js
查看文件 @
31db053
...
...
@@ -13,6 +13,7 @@ const { YesterdayTime, getRequestClassIds, dayTimeYMD } = method
let
siteIds
=
[]
let
classid
=
[]
let
classidPost
=
[]
let
parentData
=
{}
var
classobj
=
{};
let
className
=
""
...
...
@@ -94,8 +95,22 @@ class MediaCreat {
}
let
files
=
fs
.
readdirSync
(
ymdDir
);
// let interValGetFile = setInterval(()=>{
this
.
wrieLog
(
"files:"
+
files
)
if
(
files
.
indexOf
(
id
+
".mp4"
)
!=
-
1
)
{
this
.
wrieLog
(
"已存在:"
+
id
+
"课堂号,停止继续录制"
)
if
(
type
==
'post'
)
{
if
(
classidPost
.
length
)
{
let
shiftData
=
classidPost
.
shift
()
this
.
wrieLog
(
" 录制下一节课 课堂号:"
+
shiftData
[
'classId'
])
this
.
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
type
)
}
}
else
{
if
(
classid
.
length
)
{
let
shiftData
=
classid
.
shift
()
this
.
wrieLog
(
" 录制下一节课 课堂号:"
+
shiftData
[
'classId'
])
this
.
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
type
)
}
}
return
}
// 目前url是linux的写法 win系统不支持
...
...
@@ -115,18 +130,34 @@ class MediaCreat {
if
(
files
.
indexOf
(
id
+
".mp4"
)
==
-
1
)
{
this
.
wrieLog
(
" 课堂录制未发现该"
+
id
+
"课堂号"
)
}
else
{
if
(
classid
.
length
)
{
let
shiftData
=
classid
.
shift
()
this
.
wrieLog
(
" 录制下一节课 课堂号:"
+
shiftData
[
'classId'
])
this
.
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
type
)
if
(
type
==
'get'
)
{
if
(
classid
.
length
)
{
let
shiftData
=
classid
.
shift
()
this
.
wrieLog
(
" 录制下一节课 课堂号:"
+
shiftData
[
'classId'
])
this
.
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
type
)
}
else
{
this
.
wrieLog
(
"录制结束:------>"
)
fs
.
writeFile
(
ymdDir
+
"/download.json"
,
`
{
"code"
:
"0"
,
"success"
:
"ok"
}
`
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
}
});
}
}
else
{
this
.
wrieLog
(
"录制结束:------>"
)
fs
.
writeFile
(
ymdDir
+
"/download.json"
,
`
{
"code"
:
"0"
,
"success"
:
"ok"
}
`
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
}
});
if
(
classidPost
.
length
)
{
let
shiftData
=
classidPost
.
shift
()
this
.
wrieLog
(
" 录制下一节课 课堂号:"
+
shiftData
[
'classId'
])
this
.
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
type
)
}
else
{
this
.
wrieLog
(
"录制结束:------>"
)
fs
.
writeFile
(
ymdDir
+
"/download.json"
,
`
{
"code"
:
"0"
,
"success"
:
"ok"
}
`
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
}
});
}
}
}
})
}
...
...
@@ -193,19 +224,18 @@ router.post('/recording', async function (req, res, next) {
let
fileConfig
=
new
MediaCreat
().
getConfigFileJson
()
if
(
!
fileConfig
)
return
false
let
{
classId
,
maxMedia
}
=
req
.
body
if
(
classid
.
length
>
0
)
{
if
(
classid
Post
.
length
>
0
)
{
// 有正在录制中的课堂,禁止重复
res
.
send
({
code
:
"1"
,
message
:
"有正在录制中的课堂"
,
data
:
classid
});
res
.
send
({
code
:
"1"
,
message
:
"有正在录制中的课堂"
,
data
:
classid
Post
});
return
}
if
(
classId
&&
classId
.
length
)
{
classid
=
classId
classid
Post
=
classId
if
(
!
maxMedia
||
maxMedia
==
undefined
)
{
maxMedia
=
1
}
console
.
log
(
"maxMedia"
,
maxMedia
)
for
(
let
i
=
0
;
i
<
maxMedia
;
i
++
)
{
let
shiftData
=
classid
.
shift
()
let
shiftData
=
classid
Post
.
shift
()
if
(
shiftData
)
{
new
MediaCreat
().
recordingCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
],
'post'
)
}
else
{
...
...
请
注册
或
登录
后发表评论