UNPKG

t-comm

Version:

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

45 lines (41 loc) 1.32 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); // 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(_ref) { var chatIdMap = _ref.chatIdMap, start = _ref.start, isFailed = _ref.isFailed, isSendAll = _ref.isSendAll, isOnlyMe = _ref.isOnlyMe, _ref$shouldSendSucces = _ref.shouldSendSuccess, shouldSendSuccess = _ref$shouldSendSucces === void 0 ? defaultShouldSendSuccess : _ref$shouldSendSucces; 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 []; } exports.getE2ERobotChatId = getE2ERobotChatId;