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