From 9b38968350be48d9bda4c6dda332ed9db1d1dbca Mon Sep 17 00:00:00 2001 From: 502647092 Date: Fri, 8 Dec 2023 09:05:23 +0000 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20ele/auto-meal-complete.use?= =?UTF-8?q?r.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ele/auto-meal-complete.user.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ele/auto-meal-complete.user.js b/ele/auto-meal-complete.user.js index 544f4ec..adfb4b8 100644 --- a/ele/auto-meal-complete.user.js +++ b/ele/auto-meal-complete.user.js @@ -123,7 +123,8 @@ return mealComplete(cook, cookTime, '骑手未到店') } debug('订单 #' + daySn + ' 还剩 ' + leftTime + 's 上报超时 将于 ' - + (leftTime - (deliveOnShop ? ele.autoSubmitLeftTimeWhenOnShop : ele.autoSubmitLeftTime)) + 's 后自动上报.') + + (Math.max(cook.mealPreparationInfo.minMealCompleteTimeCount, + leftTime - (deliveOnShop ? ele.autoSubmitLeftTimeWhenOnShop : ele.autoSubmitLeftTime))) + 's 后自动上报.') cook.mealPreparationInfo.minMealCompleteTimeCount -= 5 cook.mealPreparationInfo.commonShowTime -= 5 } @@ -158,6 +159,7 @@ ${ele.processOrders.length ? ele.processOrders.map(o => ' 订单: #' + o.header.daySn + ' 出餐状态 ' + (o.mealPreparationInfo.mealComplete ? '已出餐' : '未出餐') + + (o.mealPreparationInfo.minMealCompleteTimeCount > 0 ? `(${o.mealPreparationInfo.minMealCompleteTimeCount}s)` : '') + ' 配送状态 ' + o.deliveryInfo.distTraceView.traceView.status + '' + (o.deliveryInfo.deliveryDistance ? ' ' + o.deliveryInfo.deliveryDistance : '')).join('
') : '当前没有进行中的订单.'} @@ -189,21 +191,19 @@ } } async function scheduleCheck() { - await sleep(ele.checkInterval * 1000) await checkCooking() - scheduleCheck() - } - async function scheduleSync() { - await sleep(ele.syncInterval * 1000) - await syncOrders() + await sleep(ele.checkInterval * 1000) scheduleCheck() } async function main() { - setTimeout(async () => { - window.appContainerNoticeBar = document.getElementById('app-container-notice-bar') - await scheduleSync() - await scheduleCheck() - }, 3000) + while (!document.getElementById('app-container-notice-bar')) { + await sleep(300) + } + window.appContainerNoticeBar = document.getElementById('app-container-notice-bar') + debug('页面注入成功 开始运行...') + syncOrders() + scheduleCheck() + setInterval(() => syncOrders(), ele.syncInterval * 1000) } var SubmitOrdersKey = 'AutoMealComplete:SubmitOrders' var ele = {