更新 ele/auto-meal-complete.user.js
This commit is contained in:
parent
a73e863fe7
commit
fd4c405d20
@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @name 饿了么自动出餐
|
||||
// @namespace https://circlecloud.ltd/
|
||||
// @version 0.1
|
||||
// @version 0.0.5
|
||||
// @description 自动出餐
|
||||
// @author MiaoWoo
|
||||
// @match https://melody.shop.ele.me/app/shop/**/order__processing
|
||||
@ -95,7 +95,7 @@
|
||||
}
|
||||
localStorage.setItem(SubmitOrdersKey, JSON.stringify(ele.submitOrders))
|
||||
await sleep(5)
|
||||
await updateOrders()
|
||||
await syncOrders()
|
||||
return result
|
||||
}
|
||||
async function checkCooking() {
|
||||
@ -108,7 +108,7 @@
|
||||
let leftTime = cook.mealPreparationInfo.commonShowTime
|
||||
let deliveOnShop = cook.deliveryInfo.distTraceView.traceView.status == '骑士已到店'
|
||||
|| (cook.deliveryInfo.deliveryDistance
|
||||
&& cook.deliveryInfo.deliveryDistance.endsWith('m')
|
||||
&& !cook.deliveryInfo.deliveryDistance.endsWith('km')
|
||||
&& parseInt(cook.deliveryInfo.deliveryDistance) < 100)
|
||||
if (deliveOnShop && cook.mealPreparationInfo.minMealCompleteTimeCount < 0
|
||||
&& leftTime < ele.autoSubmitLeftTimeWhenOnShop) {
|
||||
@ -128,7 +128,7 @@
|
||||
cook.mealPreparationInfo.commonShowTime -= 5
|
||||
}
|
||||
}
|
||||
async function updateOrders() {
|
||||
async function syncOrders() {
|
||||
let orders = await queryInProcessOrders()
|
||||
ele.processOrders = orders.result || []
|
||||
debug('更新订单数据 目前进行中订单: ' + ele.processOrders.length + '个')
|
||||
@ -139,7 +139,7 @@
|
||||
if (ele.logs.length > ele.maxLogLength) {
|
||||
ele.logs = ele.logs.slice(ele.logs.length - ele.maxLogLength)
|
||||
}
|
||||
let title = '饿了么自动出餐 By MiaoWoo'
|
||||
let title = `${ele.title} Version: ${ele.version} By ${ele.author}`
|
||||
let configInfo = `当前配置: </br>
|
||||
<div class="ant-alert-content">
|
||||
骑手到店 提前 ${ele.autoSubmitLeftTimeWhenOnShop}s 出餐
|
||||
@ -188,17 +188,31 @@
|
||||
console.log(msg)
|
||||
}
|
||||
}
|
||||
async function scheduleCheck() {
|
||||
await sleep(ele.checkInterval * 1000)
|
||||
await checkCooking()
|
||||
scheduleCheck()
|
||||
}
|
||||
async function scheduleSync() {
|
||||
await sleep(ele.syncInterval * 1000)
|
||||
await syncOrders()
|
||||
scheduleCheck()
|
||||
}
|
||||
async function main() {
|
||||
setTimeout(() => {
|
||||
setTimeout(async () => {
|
||||
window.appContainerNoticeBar = document.getElementById('app-container-notice-bar')
|
||||
updateOrders()
|
||||
}, 5000)
|
||||
setInterval(() => { checkCooking() }, 5000)
|
||||
setInterval(() => { updateOrders() }, 20000)
|
||||
await scheduleSync()
|
||||
await scheduleCheck()
|
||||
}, 3000)
|
||||
}
|
||||
var SubmitOrdersKey = 'AutoMealComplete:SubmitOrders'
|
||||
var ele = {
|
||||
title: '饿了么自动出餐',
|
||||
version: '0.0.5',
|
||||
author: 'MiaoWoo',
|
||||
logs: [],
|
||||
checkInterval: 5,
|
||||
syncInterval: 15,
|
||||
maxLogLength: 20,
|
||||
maxLogOrderLength: 20,
|
||||
orderStatus: {},
|
||||
@ -208,7 +222,7 @@
|
||||
autoSubmitLeftTime: 200,
|
||||
autoSubmitLeftTimeWhenOnShop: 320,
|
||||
debug: debug,
|
||||
updateOrders: updateOrders,
|
||||
syncOrders: syncOrders,
|
||||
checkCooking: checkCooking,
|
||||
mealComplete: mealComplete,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user