添加延迟
This commit is contained in:
@@ -676,7 +676,7 @@ function DrawProductionStagePrize() {
|
|||||||
}
|
}
|
||||||
async function PickUp(encryptPin = $.encryptPin, help = false) {
|
async function PickUp(encryptPin = $.encryptPin, help = false) {
|
||||||
$.pickUpMyselfComponent = true;
|
$.pickUpMyselfComponent = true;
|
||||||
const GetUserComponentRes = await GetUserComponent(encryptPin);
|
const GetUserComponentRes = await GetUserComponent(encryptPin, 500);
|
||||||
if (GetUserComponentRes && GetUserComponentRes['ret'] === 0) {
|
if (GetUserComponentRes && GetUserComponentRes['ret'] === 0) {
|
||||||
const { componentList } = GetUserComponentRes['data'];
|
const { componentList } = GetUserComponentRes['data'];
|
||||||
if (componentList && componentList.length <= 0) {
|
if (componentList && componentList.length <= 0) {
|
||||||
@@ -713,29 +713,31 @@ async function PickUp(encryptPin = $.encryptPin, help = false) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function GetUserComponent(pin = $.encryptPin) {
|
function GetUserComponent(pin = $.encryptPin, timeout = 0) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
$.get(taskurl('usermaterial/GetUserComponent', `pin=${pin}`), (err, resp, data) => {
|
setTimeout(() => {
|
||||||
try {
|
$.get(taskurl('usermaterial/GetUserComponent', `pin=${pin}`), (err, resp, data) => {
|
||||||
if (err) {
|
try {
|
||||||
console.log(`${JSON.stringify(err)}`)
|
if (err) {
|
||||||
console.log(`${$.name} API请求失败,请检查网路重试`)
|
console.log(`${JSON.stringify(err)}`)
|
||||||
} else {
|
console.log(`${$.name} API请求失败,请检查网路重试`)
|
||||||
if (safeGet(data)) {
|
} else {
|
||||||
data = JSON.parse(data);
|
if (safeGet(data)) {
|
||||||
if (data['ret'] === 0) {
|
data = JSON.parse(data);
|
||||||
|
if (data['ret'] === 0) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log(`GetUserComponent失败:${JSON.stringify(data)}`)
|
console.log(`GetUserComponent失败:${JSON.stringify(data)}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
})
|
||||||
$.logErr(e, resp)
|
}, timeout)
|
||||||
} finally {
|
|
||||||
resolve(data);
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//收取地下随机零件电力API
|
//收取地下随机零件电力API
|
||||||
|
Reference in New Issue
Block a user