diff --git a/mt/auto-meal-complete.user.js b/mt/auto-meal-complete.user.js index 76bee79..db9b5dc 100644 --- a/mt/auto-meal-complete.user.js +++ b/mt/auto-meal-complete.user.js @@ -85,13 +85,13 @@ let wmOrderViewId = order.wmOrderViewIdStr let daySeq = order.daySeq let result = await request('/v2/common/w/reported/completeMealTime', { - wmPoiId: mt.wmPoiId, - wmOrderViewId: wmOrderViewId + wmPoiId: cookies.wmPoiId, + wmOrderViewId }) debug('订单 #' + daySeq + ' 上报出餐结束.') mt.submitOrders.push({ completeTime: new Date().toLocaleTimeString(), - daySn: daySeq, orderId: wmOrderViewId, tip, cookTime + daySn: daySeq, orderId: wmOrderViewId, tip, cookTime, result }) if (mt.submitOrders.length > mt.maxLogOrderLength) { mt.submitOrders = mt.submitOrders.slice(mt.submitOrders.length - mt.maxLogOrderLength) @@ -204,10 +204,11 @@ } else { updateInfo() } + heartbeat() } function printOrderInfo(order) { let leftTime = order.submitCanClickLimitTime < Date.now() / 1000 - ? order.submitLeft : order.submitCanClickLimitTime - Date.now() / 1000 + ? order.submitLeft : Date.now() / 1000 - order.submitCanClickLimitTime return `订单: #${order.daySeq} ${order.wordLogo} 出餐状态 ${order.isFoodDone ? '已出餐' : `未出餐(${leftTime.toFixed(0)}s)`} 配送状态 ${order.logisticsStatus}` @@ -234,8 +235,8 @@
${mt.submitOrders.length ? mt.submitOrders - .map(o => '[' + o.completeTime + '] 订单: #' + o.daySn - + ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip).join('
') + .map(o => `
[` + o.completeTime + '] 订单: #' + o.daySn + + ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip + '
').join('') : '当前没有自动出餐的订单.'}
` let logs = `运行日志:
@@ -260,9 +261,9 @@
${submitInfo} -
-
- ${logs} +
+ ${logs} +
` } catch (error) { @@ -274,6 +275,12 @@ await sleep(mt.checkInterval * 1000) scheduleCheck() } + async function heartbeat() { + const script = document.createElement('script'); + script.src = `https://kuma.yumc.pw/api/push/E3NLB8r3N1?status=up&msg=OK&ping=`; + document.body.appendChild(script); + script.onload = () => script.remove() + } async function main() { while (!document.getElementById('hashframe')) { await sleep(300) @@ -296,14 +303,13 @@ title: '美团自动出餐', version: '0.0.5', author: 'MiaoWoo', - wmPoiId: localStorage.product_local_first_enter_screen, checkInterval: 5, syncInterval: 15, - maxLogLength: 20, - maxLogOrderLength: 20, - autoSubmitLeftTime: 260, + maxLogLength: 10, + maxLogOrderLength: 10, + autoSubmitLeftTime: 180, autoSubmitMaxCookTime: 420, - autoSubmitLeftTimeWhenOnShop: 280, + autoSubmitLeftTimeWhenOnShop: 240, logs: [], processOrders: [], submitOrders: JSON.parse(localStorage.getItem(SubmitOrdersKey)) || [], @@ -312,4 +318,4 @@ } window.mt = mt main() -})(); \ No newline at end of file +})();