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
张艾宸
2019-12-31 18:44:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
34d759305a9dbf1b2bed5dfab72007fa9fec56ef
34d75930
1 parent
5787f51c
修改配置文件为config.json
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
20 行增加
和
3 行删除
routes/index.js
routes/index.js
查看文件 @
34d7593
...
...
@@ -6,11 +6,11 @@ const fs = require("fs");
const
method
=
require
(
"../config/method"
)
const
config
=
require
(
"../config/config"
)
const
{
GETCLASSURL
,
GETCLASSURLPARAMETER
,
PROJECTCATALOG
,
PROJECTWINCATALOG
,
BACKMEDIACONFIG
}
=
config
//
const { GETCLASSURL, GETCLASSURLPARAMETER, PROJECTCATALOG, PROJECTWINCATALOG, BACKMEDIACONFIG } = config
const
{
YesterdayTime
,
getRequestClassIds
}
=
method
const
{
startTime
,
endTime
,
ymd
}
=
YesterdayTime
()
let
siteIds
=
GETCLASSURLPARAMETER
.
siteId
let
siteIds
=
[]
let
classid
=
[]
let
parentData
=
{}
...
...
@@ -24,7 +24,10 @@ class MediaCreat {
constructor
()
{
}
// 取出所有数据
async
allData
()
{
let
fileConfig
=
await
new
MediaCreat
().
getConfigFileJson
()
if
(
!
fileConfig
)
return
false
className
=
siteIds
.
shift
()
const
{
GETCLASSURL
,
GETCLASSURLPARAMETER
}
=
JSON
.
parse
(
fileConfig
)
let
page
=
1
if
(
className
)
{
let
result
=
await
getRequestClassIds
(
GETCLASSURL
,
className
,
GETCLASSURLPARAMETER
.
key
,
startTime
,
endTime
,
page
)
...
...
@@ -42,7 +45,6 @@ class MediaCreat {
}
}
parentData
[
result
.
data
.
data
.
siteId
]
=
Array
.
from
(
parentData
[
result
.
data
.
data
.
siteId
])
if
(
siteIds
.
length
)
{
return
await
new
MediaCreat
().
allData
()
}
...
...
@@ -52,6 +54,10 @@ class MediaCreat {
}
}
async
mediaCreat
(
id
,
siteId
)
{
let
fileConfig
=
await
new
MediaCreat
().
getConfigFileJson
()
if
(
!
fileConfig
)
return
false
const
{
BACKMEDIACONFIG
,
PROJECTWINCATALOG
,
PROJECTCATALOG
}
=
JSON
.
parse
(
fileConfig
)
let
mediaDir
=
PROJECTCATALOG
+
"/media/"
let
classDir
=
PROJECTCATALOG
+
"/media/"
+
siteId
let
ymdDir
=
PROJECTCATALOG
+
"/media/"
+
siteId
+
"/"
+
ymd
...
...
@@ -95,10 +101,21 @@ class MediaCreat {
}
});
}
async
getConfigFileJson
(){
const
buffer
=
fs
.
readFileSync
(
process
.
cwd
()
+
"/config/config.json"
)
return
String
(
buffer
)
}
}
router
.
get
(
'/'
,
async
function
(
req
,
res
,
next
)
{
let
fileConfig
=
await
new
MediaCreat
().
getConfigFileJson
()
if
(
!
fileConfig
)
return
false
const
{
GETCLASSURLPARAMETER
}
=
JSON
.
parse
(
fileConfig
)
siteIds
=
GETCLASSURLPARAMETER
.
siteId
let
result
=
await
new
MediaCreat
().
allData
()
if
(
result
)
{
// 去重
...
...
请
注册
或
登录
后发表评论