UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

43 lines (41 loc) 1.24 kB
// const defaultShouldSendAll = (time) => { // const date = new Date(); // date.setHours(9, 10, 0, 0); // const end = date.getTime(); // date.setHours(9, 0, 0, 0); // const start = date.getTime(); // return time > start && time < end; // }; var defaultShouldSendSuccess = function defaultShouldSendSuccess(time) { var hour = new Date(time).getHours(); var minute = new Date(time).getMinutes(); return minute < 10 && [10, 14, 18].indexOf(hour) >= 0; }; function getE2ERobotChatId(_a) { var chatIdMap = _a.chatIdMap, start = _a.start, isFailed = _a.isFailed, isSendAll = _a.isSendAll, isOnlyMe = _a.isOnlyMe, // shouldSendAll = defaultShouldSendAll, _b = _a.shouldSendSuccess, // shouldSendAll = defaultShouldSendAll, shouldSendSuccess = _b === void 0 ? defaultShouldSendSuccess : _b; if (isSendAll) { return chatIdMap.ALL; } if (isOnlyMe) { return chatIdMap.ONLY_ME; } // if (shouldSendAll?.(start)) { // return chatIdMap.ALL; // } if (isFailed) { return chatIdMap.FAIL; } if (shouldSendSuccess === null || shouldSendSuccess === void 0 ? void 0 : shouldSendSuccess(start)) { return chatIdMap.SUCCESS; } return []; } export { getE2ERobotChatId };