Commit ed3d5d7e authored by 何娜's avatar 何娜

增加日志

parent 22bf6962
Pipeline #28034 passed with stage
in 2 seconds
......@@ -115,6 +115,7 @@ class TaskController extends Controller {
} else if (status === 'success') {
ws.send(JSON.stringify({ errcode: 0, data: { state: 2, result: 'success' } }));
} else {
ctx.logger.info('【wslink】 fetchTask')
const result = await service.task.fetchTask({ taskId });
let data,
wsMsg;
......@@ -223,6 +224,7 @@ class TaskController extends Controller {
ctx.body = {
code: 200,
};
ctx.logger.info('【handleCallback】 fetchTask')
const result = await service.task.fetchTask({ taskId });
// let taskNote = {
// status: 'init',
......
'use strict';
module.exports = {
schedule: {
interval: '5m', // 5分钟间隔
type: 'all', // 所有woker
immediate: true,
},
async task(ctx) {
try {
const { host, customerUrl } = ctx.app.config.signatureAPI;
const notifyMap = new Map();
const ret = await ctx.curl(host + customerUrl, {
charset: 'utf-8',
timeout: [30000, 30000],
dataType: 'json',
contentType: 'json',
});
// ctx.logger.info(JSON.stringify(ret.data));
if (ret.data.code === 0) {
ret.data.data.customerList.map(customer => {
if ('callBackUrl' in customer) {
notifyMap.set(customer.appKey, { notifyUrl: customer.callBackUrl });
}
});
}
ctx.app.notifyMap = notifyMap;
// console.log(await ctx.helper.sendMsg({ message: 'test' }));
} catch (e) {
ctx.logger.error('【schedule/notifyUrlTask】catch error:', JSON.stringify(e));
}
},
};
......@@ -10,6 +10,7 @@ class ScheduleService extends Service {
attributes: ['appKey', 'text2', 'currentCount', 'limitCount', 'customerUrl'],
where: { type: 'thxd' },
});
ctx.logger.info('【Schedule】appKeylists', ret.length)
if (ret.length > 0) {
ret.map(customer => {
appKeylists.set(customer.appKey, {
......
......@@ -146,7 +146,6 @@ class TaskService extends Service {
}
phoneInfo.province = html.match(/province:'(.*?)'/)[1];
phoneInfo.operator = html.match(/catName:'(.*?)'/)[1];
ctx.logger.info('phoneArea', alhost + phone, JSON.stringify(phoneInfo), html, phone);
if (phoneInfo.province === '香港') {
phoneInfo.province = '广东';
}
......@@ -155,7 +154,6 @@ class TaskService extends Service {
} else {
phoneInfo.operator = '虚拟运营商';
}
ctx.logger.info('phoneArea result', JSON.stringify(phoneInfo), phone);
return phoneInfo;
}
......
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