diff --git a/ele/auto-meal-complete.user.js b/ele/auto-meal-complete.user.js index 59f58f4..04aeaf8 100644 --- a/ele/auto-meal-complete.user.js +++ b/ele/auto-meal-complete.user.js @@ -31,7 +31,7 @@ function convertSecondsToMinutesSeconds(seconds) { var minutes = Math.floor(seconds / 60); var remainingSeconds = seconds % 60; - return minutes + "分" + remainingSeconds.toFixed(2) + "秒"; + return minutes + "分" + remainingSeconds.toFixed(0) + "秒"; } function getShopId() { return parseInt(localStorage.shopId) @@ -81,7 +81,7 @@ // "queryType": "COOKING" }) } - async function mealComplete(cook, cookTime) { + async function mealComplete(cook, cookTime, tip) { let orderId = cook.id let daySn = cook.header.daySn let result = await request('ShipmentService', 'mealComplete', { @@ -89,10 +89,11 @@ "orderId": orderId }) debug('订单 #' + daySn + ' 上报出餐结束.') - ele.submitOrders.push({ daySn, orderId, cookTime }) + ele.submitOrders.push({ completeTime: new Date().toLocaleTimeString(), daySn, orderId, tip, cookTime }) if (ele.submitOrders.length > ele.maxLogOrderLength) { ele.submitOrders = ele.submitOrders.slice(ele.submitOrders.length - ele.maxLogOrderLength) } + localStorage.setItem(SubmitOrdersKey, JSON.stringify(ele.submitOrders)) await sleep(5) await updateOrders() return result @@ -109,12 +110,12 @@ && cook.mealPreparationInfo.minMealCompleteTimeCount < 0 && leftTime < ele.autoSubmitLeftTimeWhenOnShop) { debug('订单 #' + daySn + ' 骑手到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.') - return mealComplete(cook, cookTime) + return mealComplete(cook, cookTime, '骑手到店出餐') } if (leftTime < ele.autoSubmitLeftTime) { // 大于最小上报时长 并且距离上报超时不足120秒 直接上报出餐 debug('订单 #' + daySn + ' 骑手未到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.') - return mealComplete(cook, cookTime) + return mealComplete(cook, cookTime, '骑手未到店出餐') } debug('订单 #' + daySn + ' 还剩 ' + cook.mealPreparationInfo.commonShowTime + 's 上报超时.') cook.mealPreparationInfo.minMealCompleteTimeCount -= 5 @@ -123,7 +124,6 @@ } async function updateOrders() { let orders = await queryInProcessOrders() - ele.autoCheckTime = Date.now() / 1000 ele.processOrders = orders.result || [] debug('更新订单数据 目前进行中订单: ' + ele.processOrders.length + '个') } @@ -140,7 +140,8 @@ + '' let submitInfo = '已自动出餐的订单信息: