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

This commit is contained in:
502647092 2023-12-06 02:02:14 +00:00
parent e92b138a30
commit e8e8790c3e

View File

@ -113,8 +113,8 @@
return mealComplete(cook, cookTime, '骑手到店出餐')
}
if (leftTime < ele.autoSubmitLeftTime) {
// 大于最小上报时长 并且距离上报超时不足120秒 直接上报出餐
debug('订单 #' + daySn + ' 骑手未到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 模拟提交出餐.')
// 大于最小上报时长 并且距离上报超时不足 直接上报出餐
debug('订单 #' + daySn + ' 骑手未到店 订单剩余时间 ' + leftTime + 's 小于 ' + ele.autoSubmitLeftTime + 's 模拟提交出餐.')
return mealComplete(cook, cookTime, '骑手未到店出餐')
}
debug('订单 #' + daySn + ' 还剩 ' + cook.mealPreparationInfo.commonShowTime + 's 上报超时.')
@ -133,37 +133,51 @@
if (ele.logs.length > ele.maxLogLength) {
ele.logs = ele.logs.slice(ele.logs.length - ele.maxLogLength)
}
let title = '饿了么自动出餐 By MiaoWoo </br>'
let configInfo = '当前配置: </br><div class="ant-alert-content">'
+ '骑手到店 提前 ' + ele.autoSubmitLeftTimeWhenOnShop + 's 出餐 '
+ '骑手未到店 提前 ' + ele.autoSubmitLeftTime + 's 出餐</br>'
+ '</div>'
let submitInfo = '已自动出餐的订单信息: </br><div class="ant-alert-content">'
+ (ele.submitOrders.length
? ele.submitOrders.map(o => '[' + o.completeTime + '] 订单: #' + o.daySn
+ ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip).join('</br>')
: '当前没有自动出餐的订单.')
+ '</div>'
let orderInfo = '进行中的订单信息: </br><div class="ant-alert-content">'
+ (ele.processOrders.length
let title = '饿了么自动出餐 By MiaoWoo'
let configInfo = `当前配置: </br>
<div class="ant-alert-content">
骑手到店 提前 ${ele.autoSubmitLeftTimeWhenOnShop}s 出餐
骑手未到店 提前 ${ele.autoSubmitLeftTime}s 出餐</br>
</div>`
let submitInfo = `已自动出餐的订单信息: </br>
<div class="ant-alert-content">
${ele.submitOrders.length
? ele.submitOrders
.map(o => '[' + o.completeTime + '] 订单: #' + o.daySn
+ ' 出餐用时 ' + convertSecondsToMinutesSeconds(o.cookTime) + ' ' + o.tip).join('</br>')
: '当前没有自动出餐的订单.'}
</div>`
let orderInfo = `进行中的订单信息: </br>
<div class="ant-alert-content">
${ele.processOrders.length
? ele.processOrders.map(o => ' 订单: #' + o.header.daySn
+ ' 出餐状态 ' + (o.mealPreparationInfo.mealComplete ? '已出餐' : '未出餐')
+ ' 配送状态 ' + o.deliveryInfo.distTraceView.traceView.status + ''
+ (o.deliveryInfo.deliveryDistance ? ' ' + o.deliveryInfo.deliveryDistance : '')).join('</br>')
: '当前没有进行中的订单.')
+ '</div>'
let logs = '运行日志: </br><div class="ant-alert-content">'
+ ele.logs.join('</br>')
+ '</div>'
window.appContainerNoticeBar.innerHTML = '<div style="flex: 1 1 0%;">'
+ title + '</br>'
+ configInfo + '</br>'
+ submitInfo + '</br>'
+ orderInfo + '</br>'
+ '</div>'
+ '<div style="flex: 1 1 0%;">'
+ logs
+ '</div>'
: '当前没有进行中的订单.'}
</div>`
let logs = `运行日志: </br>
<div class="ant-alert-content">
${ele.logs.join('</br>')}
</div>`
window.appContainerNoticeBar.innerHTML = `
<div style="margin-left: 35px; margin-top: 20px; display: flex;">
<div style="flex: 1 1 0%;">
${title}
<div style="margin-top: 20px;">
${configInfo}
</div>
<div style="margin-top: 20px;">
${orderInfo}
</div>
</div>
<div style="flex: 1 1 0%;">
${submitInfo}
</div>
<div style="flex: 1 1 0%;">
${logs}
</div>
</div>`
} catch (error) {
console.log(msg)
}
@ -171,9 +185,6 @@
async function main() {
setTimeout(() => {
window.appContainerNoticeBar = document.getElementById('app-container-notice-bar')
window.appContainerNoticeBar.style.marginLeft = '35px'
window.appContainerNoticeBar.style.marginTop = '20px'
window.appContainerNoticeBar.style.display = 'flex'
updateOrders()
}, 5000)
setInterval(() => { checkCooking() }, 5000)
@ -182,14 +193,14 @@
var SubmitOrdersKey = 'AutoMealComplete:SubmitOrders'
var ele = {
logs: [],
maxLogLength: 15,
maxLogOrderLength: 5,
maxLogLength: 20,
maxLogOrderLength: 20,
orderStatus: {},
processOrders: [],
submitOrders: JSON.parse(localStorage.getItem(SubmitOrdersKey)),
autoCheckTask: undefined,
autoSubmitLeftTime: 180,
autoSubmitLeftTimeWhenOnShop: 300,
autoSubmitLeftTime: 200,
autoSubmitLeftTimeWhenOnShop: 320,
debug: debug,
updateOrders: updateOrders,
checkCooking: checkCooking,