彻底优化-1
This commit is contained in:
+10
-2
@@ -392,7 +392,12 @@
|
|||||||
toast('⚡ 抢购中...',`${Object.keys(ap).length} 个账号正在抢购 ${selProdName}`,'info',3000);
|
toast('⚡ 抢购中...',`${Object.keys(ap).length} 个账号正在抢购 ${selProdName}`,'info',3000);
|
||||||
let r=await fetch('/api/seckill',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({accountProducts:ap})});
|
let r=await fetch('/api/seckill',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({accountProducts:ap})});
|
||||||
let d=await r.json();
|
let d=await r.json();
|
||||||
addLog(d.msg||'已提交','i');
|
if(d.success){
|
||||||
|
addLog(d.msg||'已提交','i');
|
||||||
|
}else{
|
||||||
|
addLog('❌ 提交失败: '+(d.error||'未知错误'),'e');
|
||||||
|
toast('❌ 提交失败',d.error||'未知错误','error');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 定时抢购 ====================
|
// ==================== 定时抢购 ====================
|
||||||
@@ -429,8 +434,11 @@
|
|||||||
toast('❌ 定时失败',d.error||'未知错误','error');
|
toast('❌ 定时失败',d.error||'未知错误','error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// cancelSchedule 只恢复前端定时状态和按钮显示;当前后端没有对应取消接口。
|
// cancelSchedule 调用后端取消尚未触发的定时任务,并恢复前端按钮状态。
|
||||||
async function cancelSchedule(){
|
async function cancelSchedule(){
|
||||||
|
try{
|
||||||
|
await fetch('/api/cancel-schedule',{method:'POST'});
|
||||||
|
}catch(e){}
|
||||||
scheduleActive=false;
|
scheduleActive=false;
|
||||||
// 清除缓存的定时
|
// 清除缓存的定时
|
||||||
localStorage.removeItem('targetTime');
|
localStorage.removeItem('targetTime');
|
||||||
|
|||||||
Reference in New Issue
Block a user