更新 'mcbbs/vending-machine.user.js'

This commit is contained in:
502647092 2020-12-10 16:07:59 +00:00
parent b5d35d6416
commit 6c9b29e076

View File

@ -51,6 +51,9 @@
} }
return stock return stock
} }
async function updateStatus(message) {
await fetch(`https://reward.yumc.pw/mcbbs/updateStatus/message/${message}`).then(r => r.json())
}
async function lowStockNotify(stock, order_id, goods_amount) { async function lowStockNotify(stock, order_id, goods_amount) {
await fetch(`https://reward.yumc.pw/mcbbs/lowStockNotify/stock/${stock}/order_id/${order_id}/goods_amount/${goods_amount}`).then(r => r.json()) await fetch(`https://reward.yumc.pw/mcbbs/lowStockNotify/stock/${stock}/order_id/${order_id}/goods_amount/${goods_amount}`).then(r => r.json())
} }
@ -72,7 +75,9 @@
} }
} }
async function sendOrderAction(openFn, back = false) { async function sendOrderAction(openFn, back = false) {
let timeoutTask = setTimeout(() => { location.href = '/home.php?mod=magic&action=mybox' }, 90000) let timeoutTask = setTimeout(() => { location.href = '/home.php?mod=magic&action=mybox' }, 120000)
let messagetext = document.getElementById('messagetext')
updateStatus(messagetext && messagetext.innerText || '')
let count = 0 let count = 0
let stock = updateStock() let stock = updateStock()
let result = await fetch('https://reward.yumc.pw/mcbbs/needSendOrder').then(r => r.json()) let result = await fetch('https://reward.yumc.pw/mcbbs/needSendOrder').then(r => r.json())