var tools = { // 判断赛事/活动状态 0: 未开始 1: 进行中 2: 已结束 checkMcState(beginSecond, endSecond) { let mcState = 0; // 未开始 if (beginSecond > 0 && endSecond > 0) { const now = Date.now() / 1000; const dif1 = beginSecond - now; const dif2 = endSecond - now; // const dif = 3600*24 - 60; if (dif1 > 0) { console.log("活动未开始"); mcState = 0; // 未开始 } else if (dif2 > 0) { console.log("活动进行中"); mcState = 1; // 进行中 } else { console.log("活动已结束"); mcState = 2; // 已结束 } } return mcState; }, // 动态创建