Commit fba09362 by trace

添加越南/菲律宾贷超数据

parent 0a4e5af8
...@@ -10,7 +10,12 @@ log(`当前奔跑在:${username}`) ...@@ -10,7 +10,12 @@ log(`当前奔跑在:${username}`)
let ding = 'https://oapi.dingtalk.com/robot/send?access_token=' let ding = 'https://oapi.dingtalk.com/robot/send?access_token='
let debugDingding = `${ding}bf03c69128b771107b8715911b8a76db61a55cbd8b00e1a2c955578c2a3da719` let debugDingding = `${ding}bf03c69128b771107b8715911b8a76db61a55cbd8b00e1a2c955578c2a3da719`
let notifyDingding = `${ding}61403ec65efd7a9e40cb6d490e1bfab8aff28800696918a23ec4dffdf5aa1315` let notifyDingding = `${ding}61403ec65efd7a9e40cb6d490e1bfab8aff28800696918a23ec4dffdf5aa1315`
let daichao = `http://admin.uuang.co.id/admin/loan/listactive?current=0&size=10000&descs%5B0%5D=priority&packageId=10002` let daichao = `admin/loan/listactive?current=0&size=10000&descs%5B0%5D=priority&packageId=10002`
let daichaoRegion = [
'http://admin.uuang.co.id/',
'http://admin.ph.g-cashing.com/',
'http://admin.a.vaylaco.com/'
]
// Config ------------------------------------------------------------ // Config ------------------------------------------------------------
let sec = 1000; let sec = 1000;
...@@ -211,7 +216,11 @@ function generateDailyOnlineReport() { ...@@ -211,7 +216,11 @@ function generateDailyOnlineReport() {
} }
async function getDaichao() { async function getDaichao() {
await getPromiss(daichao) for (index in daichaoRegion) {
let region = daichaoRegion[index]
daichaoApiUrl = region + daichao
log(` 贷超 url: ${daichaoApiUrl}`)
await getPromiss(daichaoApiUrl)
.then(val => { .then(val => {
try { try {
daichaoData = JSON.parse(val && val.body && val.body || "{}").data daichaoData = JSON.parse(val && val.body && val.body || "{}").data
...@@ -220,28 +229,32 @@ async function getDaichao() { ...@@ -220,28 +229,32 @@ async function getDaichao() {
errorLog.push(errMsg) errorLog.push(errMsg)
return return
} }
log(`${region} 贷超获取到 ${daichaoData.length} 个数据`)
daichaoApps = daichaoData && daichaoData.map(app => app.packageName) || [] thisDaichaoApps = daichaoData && daichaoData.map(app => app.packageName) || []
for (index in (daichaoData && daichaoData || [])) { for (index in (daichaoData && daichaoData || [])) {
let app = daichaoData[index] let app = daichaoData[index]
daichaoAppInfoes[app.packageName] = { daichaoAppInfoes[app.packageName] = {
name: app.name, name: app.name,
daichaoId: app.id daichaoId: app.id,
mgt: `${region}#/loan/`
} }
} }
if (isTest()) { if (isTest()) {
daichaoApps = daichaoApps.slice(0, 1) thisDaichaoApps = thisDaichaoApps.slice(0, 1)
} }
log(`代超数据: ${daichaoApps.length} 个`) log(`${region} 代超数据: ${thisDaichaoApps.length} 个`)
daichaoApps = [...daichaoApps, ...thisDaichaoApps]
monitorNames["daichao"] = daichaoApps monitorNames["daichao"] = daichaoApps
if (daichaoApps.length == 0) { if (daichaoApps.length == 0) {
log('代超数据为空') log(`目前总共贷超数据为空`)
} }
log(`目前总共贷超数据: ${daichaoApps.length}`)
}) })
.catch(err => { .catch(err => {
errorLog.push(`贷超获取失败:${err.toString()}`) errorLog.push(`贷超获取失败:${err.toString()}`)
return return
}) })
}
} }
// async function getDaichao(url) { // async function getDaichao(url) {
...@@ -514,7 +527,7 @@ function genMail() { ...@@ -514,7 +527,7 @@ function genMail() {
let lastLoopDate = status['lastLoopDate'] && new Date(status['lastLoopDate']) || new Date() let lastLoopDate = status['lastLoopDate'] && new Date(status['lastLoopDate']) || new Date()
let loopInterval = (new Date()).getHours() - lastLoopDate.getHours() let loopInterval = (new Date()).getHours() - lastLoopDate.getHours()
let lastGenerate = `<br/><br/><br/>上次循环时间${lastLoopDate.toLocaleString()}, 间隔: ${loopInterval} 小时` let lastGenerate = `<br/><br/><br/>上次循环时间${lastLoopDate.toLocaleString()}, 间隔: ${loopInterval} 小时`
status['lastLoopDate'] = Date()
if (!isFirstRun if (!isFirstRun
&& !needSendList && !needSendList
&& newOffline.length == 0 && newOffline.length == 0
...@@ -664,7 +677,7 @@ function genMail() { ...@@ -664,7 +677,7 @@ function genMail() {
function isOurs(name, countOurs) { function isOurs(name, countOurs) {
if (daichaoApps.includes(name)) { if (daichaoApps.includes(name)) {
return `<a href="http://admin.uuang.co.id/#/loan/${daichaoAppInfoes[name] && return `<a href="${daichaoAppInfoes[name].mgt}${daichaoAppInfoes[name] &&
daichaoAppInfoes[name].daichaoId || ''}">🏦(贷超 [${daichaoAppInfoes[name].daichaoId}] _ < ${daichaoAppInfoes[name].name} >(->MGT)) | </a>` daichaoAppInfoes[name].daichaoId || ''}">🏦(贷超 [${daichaoAppInfoes[name].daichaoId}] _ < ${daichaoAppInfoes[name].name} >(->MGT)) | </a>`
} }
if (ourAppIds.includes(name)) { if (ourAppIds.includes(name)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment