Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
motorCity
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
motorCity
Commits
71f9b2ee
Commit
71f9b2ee
authored
Aug 10, 2022
by
孙香冬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
8306a6a3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
5 deletions
+41
-5
AutoX.png
images/img/AutoX.png
+0
-0
data.ts
src/biz/jgfwnl/data.ts
+3
-3
interfaceService.ts
src/data/interface/interfaceService.ts
+35
-2
main.ts
src/main.ts
+3
-0
No files found.
images/img/A
UTO X
.png
→
images/img/A
utoX
.png
View file @
71f9b2ee
File moved
src/biz/jgfwnl/data.ts
View file @
71f9b2ee
...
...
@@ -50,7 +50,7 @@ export async function getCSGK(req, res) {
let
今日功能测试
data
=
{
"里程"
:
"1478km"
,
"时长"
:
"421.3h"
};
ret
[
"api4"
]
=
getKeyValueNumberOutData
(
"今日功能测试"
,
今日功能测试
data
);
let
测试牌照分布
data
=
{
"http://192.168.0.117:30001/img/A
UTO
X.png"
:
"61辆"
,
"http://192.168.0.117:30001/img/阿利昂斯.png"
:
"45辆"
,
let
测试牌照分布
data
=
{
"http://192.168.0.117:30001/img/A
uto
X.png"
:
"61辆"
,
"http://192.168.0.117:30001/img/阿利昂斯.png"
:
"45辆"
,
"http://192.168.0.117:30001/img/百度.png"
:
"31辆"
,
"http://192.168.0.117:30001/img/宝马.png"
:
"47辆"
,
"http://192.168.0.117:30001/img/初速度.png"
:
"65辆"
,
"http://192.168.0.117:30001/img/滴滴.png"
:
"71辆"
,
"http://192.168.0.117:30001/img/丰田.png"
:
"18辆"
,
"http://192.168.0.117:30001/img/华为.png"
:
"23辆"
,
...
...
@@ -66,8 +66,8 @@ export async function getCSGK(req, res) {
ret
[
"api5"
]
=
getKeyValueNumberOutData
(
"测试牌照分布"
,
测试牌照分布
data
);
let
路侧监控视频
data
=
{
"
路侧监控视频"
:
"http://10.51.50.53:8278/live/13060200882000000001@31011402601318800184@34020000001320000001.m3u8?vhost=bduv0utmss4c3nzidjn.a.e-web.com.cn"
};
ret
[
"api6"
]
=
getKeyValueNumberOutData
(
"路侧监控视频"
,
路侧监控视频
data
);
let
路侧监控视频
data
=
{
"
src"
:
"http://10.51.50.53:8278/live/13060200882000000001@31011402601318800184@34020000001320000001.m3u8?vhost=bduv0utmss4c3nzidjn.a.e-web.com.cn"
,
"type"
:
'application/x-mpegURL'
};
ret
[
"api6"
]
=
({
title
:
"路侧监控视频"
,
dataList
:
路侧监控视频
data
}
);
res
.
send
(
ret
);
}
...
...
src/data/interface/interfaceService.ts
View file @
71f9b2ee
import
moment
=
require
(
"moment"
)
import
{
get
}
from
"../../util/request"
;
let
月里程数据
=
[];
//格式 [{key:"日期 格式是 2021.1", count:"测试里程", autoCount:"功能测试里程"}]
let
月里程数据
=
[
{
key
:
"2021.01"
,
count
:
"31km"
,
autoCount
:
"45km"
}
];
//格式 [{key:"日期 格式是 2021.1", count:"测试里程", autoCount:"功能测试里程"}]
let
企业日里程数据
=
{};
//格式 {"企业名称":{count:"测试里程", autoCount:"功能测试里程"} }
let
lastMonths
=
""
;
//数据库源数据接口
export
async
function
getTestAnalysis
()
{
//在月里程数据集合中 从后往前拿20个月份的数据,动态的拿本月的数据 拼接好返回 不要改变源数据
let
{
newDateArr
,
whereDateArr
}
=
getPreMonthDay
(
20
);
let
monthMileage
=
[];
let
testMileage
=
[];
let
functionTestMileage
=
[];
for
(
let
i
=
0
;
i
<
newDateArr
.
length
;
i
++
)
{
let
months
=
newDateArr
[
i
];
月里程数据
.
forEach
(
item
=>
{
let
{
key
,
count
,
autoCount
}
=
item
;
if
(
months
==
key
)
{
testMileage
.
push
({
key
,
value
:
count
});
functionTestMileage
.
push
({
key
,
value
:
autoCount
});
}
})
}
}
...
...
@@ -46,7 +60,8 @@ export async function initData() {
企业日里程数据
[
enterprise
].
autoCount
+=
auto_mileage
;
});
月里程数据
.
push
(
{
count
,
autoCount
:
testCount
,
key
}
);
let
addItem
=
{
count
,
autoCount
:
testCount
,
key
};
月里程数据
.
push
(
addItem
);
lastMonths
=
months
;
}
...
...
@@ -126,4 +141,21 @@ async function getInterfaceData(st, et, index) {
console
.
log
();
return
[];
}
}
/**
* 获取几个月前的日期
* @param monthNum 月数
* @returns
*/
function
getPreMonthDay
(
monthNum
)
{
let
whereDateArr
=
[];
let
newDateArr
=
[];
for
(
let
i
=
1
;
i
<=
monthNum
;
i
++
)
{
let
whereDate
=
moment
().
subtract
(
i
,
"months"
).
format
(
"YYMM"
);
whereDateArr
.
push
(
whereDate
);
let
newDate
=
moment
().
subtract
(
i
,
"months"
).
format
(
"YYYY.MM"
);
newDateArr
.
push
(
newDate
);
}
return
{
newDateArr
,
whereDateArr
};
}
\ No newline at end of file
src/main.ts
View file @
71f9b2ee
import
{
initConfig
,
port
}
from
"./config/serverConfig"
;
import
{
getTestAnalysis
}
from
"./data/interface/interfaceService"
;
import
{
httpServer
}
from
"./net/http_server"
;
async
function
lanuch
()
{
// await initConfig();
httpServer
.
createServer
(
port
);
console
.
log
(
'This indicates that the server is started successfully.'
);
await
getTestAnalysis
();
}
lanuch
();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment