t-comm
Version:
专业、稳定、纯粹的工具库
79 lines (74 loc) • 2.65 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var tslib_es6 = require('../tslib.es6-01322ba9.js');
var time_time = require('../time/time.js');
var wecomRobot_batchSend = require('../wecom-robot/batch-send.js');
var openSourceReport_api = require('./api.js');
var openSourceReport_parse = require('./parse.js');
require('../wecom-robot/base.js');
require('../wecom-robot/helper.js');
require('axios');
require('../wecom-robot/send-img.js');
require('../node-img/img.js');
var MAX_SHOW_LINK_NAME = 12;
/**
* 请求开源治理数据并发送
* @param options 配置信息
*/
function sendOpenSourceReport(_a) {
var date = _a.date,
chatId = _a.chatId,
webhookUrl = _a.webhookUrl,
requestInfo = _a.requestInfo,
searchInfo = _a.searchInfo,
_b = _a.maxShowLinkNum,
maxShowLinkNum = _b === void 0 ? MAX_SHOW_LINK_NAME : _b,
_c = _a.whiteList,
whiteList = _c === void 0 ? [] : _c,
_d = _a.filterOrgPath,
filterOrgPath = _d === void 0 ? '' : _d;
return tslib_es6.__awaiter(this, void 0, void 0, function () {
var time, formattedDate, reportArr, chatContent, err_1;
return tslib_es6.__generator(this, function (_e) {
switch (_e.label) {
case 0:
time = time_time.timeStampFormat(new Date(date).getTime(), 'yyyyMMdd');
formattedDate = time_time.timeStampFormat(new Date(date).getTime(), 'yyyy-MM-dd');
return [4 /*yield*/, openSourceReport_api.getOpenSourceReport(tslib_es6.__assign({
time: time
}, requestInfo || {}))];
case 1:
reportArr = _e.sent();
chatContent = openSourceReport_parse.parseOpenSourceReport({
reportArr: reportArr,
date: time,
formattedDate: formattedDate,
requestInfo: requestInfo,
searchInfo: searchInfo,
maxShowLinkNum: maxShowLinkNum,
whiteList: whiteList,
filterOrgPath: filterOrgPath
});
if (!chatContent) return [2 /*return*/];
_e.label = 2;
case 2:
_e.trys.push([2, 4,, 5]);
return [4 /*yield*/, wecomRobot_batchSend.batchSendWxRobotMarkdown({
chatId: chatId,
content: chatContent,
webhookUrl: webhookUrl
})];
case 3:
_e.sent();
return [3 /*break*/, 5];
case 4:
err_1 = _e.sent();
console.log('[sendOpenSourceReport] err', err_1);
return [3 /*break*/, 5];
case 5:
return [2 /*return*/];
}
});
});
}
exports.sendOpenSourceReport = sendOpenSourceReport;