明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
L
letian_backend
Project
Project
Details
Activity
Releases
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
zengfanpei
letian_backend
Commits
8ea31534
Commit
8ea31534
authored
Dec 19, 2024
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
18c3ecd1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
9 deletions
+13
-9
index.js
cron/index.js
+2
-2
ipsCron.js
cron/ipsCron.js
+1
-1
smcCron.js
cron/smcCron.js
+2
-2
wsCron.js
cron/wsCron.js
+3
-3
collectSMCModule.js
module/collectSMCModule.js
+5
-1
No files found.
cron/index.js
View file @
8ea31534
...
...
@@ -54,7 +54,7 @@ const cron = () => {
if
(
sysConfig
&&
sysConfig
.
cron
&&
sysConfig
.
cron
.
collectDeviceInfo
)
{
console
.
log
(
"collectDeviceInfo1:"
,
new
Date
());
// 每10分钟
new
nodeCron
.
schedule
(
'40 */
5
* * * *'
,
async
()
=>
{
new
nodeCron
.
schedule
(
'40 */
1
* * * *'
,
async
()
=>
{
await
smcCron
.
collectDeviceInfo1
({
deviceHQType
:
1
});
},
{
timezone
:
"Asia/Shanghai"
});
}
...
...
@@ -63,7 +63,7 @@ const cron = () => {
if
(
sysConfig
&&
sysConfig
.
cron
&&
sysConfig
.
cron
.
collectDeviceInfo
)
{
console
.
log
(
"collectDeviceInfo2:"
,
new
Date
());
new
nodeCron
.
schedule
(
'30 */
5
* * * *'
,
async
()
=>
{
new
nodeCron
.
schedule
(
'30 */
1
* * * *'
,
async
()
=>
{
await
smcCron
.
collectDeviceInfo1
({
deviceHQType
:
2
});
},
{
timezone
:
"Asia/Shanghai"
});
}
...
...
cron/ipsCron.js
View file @
8ea31534
...
...
@@ -40,7 +40,7 @@ async function collectDeviceInfo4({ deviceHQType }) {
if
(
result
&&
result
.
data
&&
result
.
status
&&
result
.
data
.
state
==
"success"
)
{
let
obj
=
result
.
data
.
data
||
{};
obj
.
name
=
dev
.
name
||
obj
.
name
;
console
.
log
(
obj
);
//
console.log(obj);
await
collectIPSModule
.
insertHQData
(
obj
);
// 3. 处理虫情每日种类数量记录
...
...
cron/smcCron.js
View file @
8ea31534
...
...
@@ -73,7 +73,7 @@ async function handleCJData(colInfo, deviceHQType) {
let
handleData
=
{},
attrExistMap
=
{};
//1. 先获取到attr配置
let
attrs
=
await
DB
.
CollectAttribute
.
find
({
del
:
0
,
enable
:
true
,
deviceHQType
:
{
$in
:
[
0
,
deviceHQType
]
}
});
console
.
log
(
attrs
)
//
console.log(attrs)
let
types
=
colInfo
.
type
.
split
(
'/'
);
let
data
=
colInfo
.
data
.
split
(
'|'
);
for
(
let
i
=
0
;
i
<
types
.
length
;
i
++
)
{
...
...
@@ -161,7 +161,7 @@ async function handleDeviceThreshold(obj) {
}
}
}
console
.
log
(
exceeds
);
//
console.log(exceeds);
// 处理通知模板
if
(
exceeds
.
length
)
{
let
role
=
await
DB
.
Role
.
findOne
({
key
:
"notice_role"
});
...
...
cron/wsCron.js
View file @
8ea31534
...
...
@@ -70,7 +70,7 @@ async function handleCJData(colInfo, deviceHQType) {
let
handleData
=
{};
//1. 先获取到attr配置
let
attrs
=
await
DB
.
CollectAttribute
.
find
({
del
:
0
,
enable
:
true
,
deviceHQType
:
{
$in
:
[
0
,
deviceHQType
]}});
console
.
log
(
attrs
)
//
console.log(attrs)
let
types
=
colInfo
.
type
.
split
(
'/'
);
let
data
=
colInfo
.
data
.
split
(
'|'
);
for
(
let
i
=
0
;
i
<
types
.
length
;
i
++
)
{
...
...
@@ -88,7 +88,7 @@ async function handleCJData(colInfo, deviceHQType) {
}
}
}
console
.
log
(
handleData
,
"======1"
)
//
console.log(handleData, "======1")
return
handleData
;
}
...
...
@@ -145,7 +145,7 @@ async function handleDeviceThreshold(obj) {
}
}
}
console
.
log
(
exceeds
);
//
console.log(exceeds);
// 处理通知模板
if
(
exceeds
.
length
)
{
let
role
=
await
DB
.
Role
.
findOne
({
key
:
"notice_role"
});
...
...
module/collectSMCModule.js
View file @
8ea31534
...
...
@@ -34,10 +34,14 @@ async function insertHQData(data) {
}
// return await DB.CollectSMC.findOneAndUpdate({time: data.time}, data, {upsert: true})
let
check
=
await
DB
.
CollectSMC
.
findOne
({
time
:
data
.
time
});
console
.
log
(
err
,
"--------20241219"
,
check
);
if
(
!
check
)
{
// 没有就新增
await
DB
.
CollectSMC
.
create
(
data
);
await
DB
.
CollectSMC
.
create
(
data
).
catch
(
err
=>
{
console
.
log
(
err
,
"--------20241219"
);
});
}
console
.
log
(
err
,
"--------20241219"
);
return
!!
check
;
}
catch
(
error
)
{
console
.
log
(
error
);
...
...
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