更新 'mcbbs/vending-machine.user.js'
This commit is contained in:
		@@ -13,6 +13,7 @@
 | 
				
			|||||||
    const lastOrderKey = 'circlebox:lastorder'
 | 
					    const lastOrderKey = 'circlebox:lastorder'
 | 
				
			||||||
    let checkTimes = 0
 | 
					    let checkTimes = 0
 | 
				
			||||||
    let stock = 0
 | 
					    let stock = 0
 | 
				
			||||||
 | 
					    let messagetext = undefined
 | 
				
			||||||
    async function sleep(time) {
 | 
					    async function sleep(time) {
 | 
				
			||||||
        return new Promise((resolve, reject) => setTimeout(resolve, time))
 | 
					        return new Promise((resolve, reject) => setTimeout(resolve, time))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -21,6 +22,13 @@
 | 
				
			|||||||
            let params = location.href.split('?')[1].split('&').map(s => s.split('=')).reduce((pre, cur, index) => { pre[cur[0]] = cur[1]; return pre }, {})
 | 
					            let params = location.href.split('?')[1].split('&').map(s => s.split('=')).reduce((pre, cur, index) => { pre[cur[0]] = cur[1]; return pre }, {})
 | 
				
			||||||
            if (!params.action) { return location.href = '/home.php?mod=magic&action=mybox' }
 | 
					            if (!params.action) { return location.href = '/home.php?mod=magic&action=mybox' }
 | 
				
			||||||
            console.log(params)
 | 
					            console.log(params)
 | 
				
			||||||
 | 
					            messagetext = document.getElementById('messagetext')
 | 
				
			||||||
 | 
					            if (messagetext) {
 | 
				
			||||||
 | 
					                updateStatus(messagetext.innerText)
 | 
				
			||||||
 | 
					                return
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
 | 
					                updateStatus('')
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            switch (params.action || "shop") {
 | 
					            switch (params.action || "shop") {
 | 
				
			||||||
                case "shop":
 | 
					                case "shop":
 | 
				
			||||||
                    await shopAction(params)
 | 
					                    await shopAction(params)
 | 
				
			||||||
@@ -78,12 +86,10 @@
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    async function sendOrderAction(openFn, back = false) {
 | 
					    async function sendOrderAction(openFn, back = false) {
 | 
				
			||||||
        let timeoutTask = setTimeout(() => { location.href = '/home.php?mod=magic&action=mybox' }, 120000)
 | 
					        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 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())
 | 
				
			||||||
        if (result.code != 200) {
 | 
					        if (result.code != 200) {
 | 
				
			||||||
            if (++checkTimes > 30 || back) {
 | 
					            if (++checkTimes > 5 || back) {
 | 
				
			||||||
                location.href = '/home.php?mod=magic&action=mybox'
 | 
					                location.href = '/home.php?mod=magic&action=mybox'
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            clearTimeout(timeoutTask)
 | 
					            clearTimeout(timeoutTask)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user