Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
spider-ufo
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
lzhy
5 years ago
Commit
f47c3a71ed94fb343e21e68797411e8b48a0fb94
1 parent
953fe54d
增加监控
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
libs/dingding-alert.js
libs/spider.js
libs/dingding-alert.js
View file @
f47c3a7
const
rp
=
require
(
'request-promise'
);
const
REG_AT
=
/@
(\d
+
)
/g
;
module
.
exports
=
(
text
)
=>
{
module
.
exports
=
(
text
,
sendTo
)
=>
{
let
match
;
let
accessToken
=
sendTo
===
'bjSpider'
?
'ed18d72771bb5df6ee70ee6d59e67d7399f6c5b9a67ebffa06a47c29cc5235c8'
:
'499f845e894e0aebb6d29ec9f3b186cbb99bfa89cd4347fa4c0e8efd4081ecd5'
;
const
ats
=
[];
while
((
match
=
REG_AT
.
exec
(
text
)))
{
ats
.
push
(
match
[
1
]);
}
...
...
@@ -18,9 +18,8 @@ module.exports = (text) => {
isAtAll
:
false
}
};
return
rp
({
uri
:
'https://oapi.dingtalk.com/robot/send?access_token=499f845e894e0aebb6d29ec9f3b186cbb99bfa89cd4347fa4c0e8efd4081ecd5'
,
uri
:
'https://oapi.dingtalk.com/robot/send?access_token='
+
accessToken
,
method
:
'POST'
,
headers
:
{
'Content-Type'
:
'application/json; charset=utf-8'
...
...
libs/spider.js
View file @
f47c3a7
...
...
@@ -4,8 +4,10 @@ const nodeLockup = require('node-lockup');
const
chalk
=
require
(
'chalk'
);
const
{
logger
}
=
require
(
'./logger'
);
const
ddAlert
=
require
(
'../libs/dingding-alert'
);
const
config
=
require
(
'../config/index'
);
const
moment
=
require
(
'moment'
);
const
detailUrl
=
'https://app.poizon.com/api/v1/h5/index/fire/flow/product/detail'
;
const
buyNowInfoUrl
=
'https://app.poizon.com/api/v1/h5/inventory/price/h5/queryBuyNowInfo'
;
...
...
@@ -130,6 +132,8 @@ const task = async(options, tick = 1) => {
}
catch
(
error
)
{
logger
.
error
(
chalk
.
red
(
`
error
:
$
{
options
}:
tick
:
$
{
tick
}
====>
$
{
error
}
`
));
if
(
tick
>=
3
)
{
var
currentime
=
moment
(
Date
.
now
()).
format
(
'YYYY-MM-DD HH:mm:ss'
)
ddAlert
(
`监控报警
:
$
{
error
}
—
$
{
currentime
}
`
,
'bjSpider'
);
return
Promise
.
resolve
({});
}
return
task
(
options
,
tick
+
1
);
...
...
Please
register
or
login
to post a comment