robot-check-service.js
985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const cache = global.yoho.cache.master;
const Promise = require('bluebird');
const co = Promise.coroutine;
const HeaderModel = require('../../../doraemon/models/header');
const index = co(function* (channel) {
const header = yield HeaderModel.requestHeaderData(channel);
return {
headerData: header.headerData
};
});
const removeBlack = (remoteIp) => {
let key = `pc:limiter:${remoteIp}`,
key10m = `pc:limiter:10m:${remoteIp}`,
keyMax = `pc:limiter:max:${remoteIp}`,
key10mMax = `pc:limiter:10m:max:${remoteIp}`,
synchronizeKey = `pc:limiter:synchronize:${remoteIp}`,
spiderKey = `pc:limiter:spider:${remoteIp}`;
return Promise.all([
cache.delAsync(key),
cache.delAsync(key10m),
cache.delAsync(keyMax),
cache.delAsync(key10mMax),
cache.delAsync(synchronizeKey),
cache.delAsync(spiderKey)
]);
};
module.exports = {
index,
removeBlack
};