更新 mt/auto-meal-complete.user.js

This commit is contained in:
502647092 2023-12-19 09:18:43 +00:00
parent 6f8a9c4b23
commit 6d22e5ce34

View File

@ -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 @@
<div class="ant-alert-content">
${mt.submitOrders.length
? mt.submitOrders
.map(o => '[' + o.completeTime + '] 订单: #' + o.daySn
+ ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip).join('</br>')
.map(o => `<div title='` + JSON.stringify(o.result || {}, null, 4) + `'>[` + o.completeTime + '] 订单: #' + o.daySn
+ ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip + '</div>').join('')
: '当前没有自动出餐的订单.'}
</div>`
let logs = `运行日志: </br>
@ -260,9 +261,9 @@
</div>
<div style="flex: 1 1 0%;">
${submitInfo}
</div>
<div style="flex: 1 1 0%;">
${logs}
<div style="margin-top: 20px;">
${logs}
</div>
</div>
</div>`
} 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()
})();
})();