update wxcode

dev_tj
tangjiang 5 years ago
parent 412e0e3427
commit cc78058d23

@ -4,7 +4,7 @@
* @Github: * @Github:
* @Date: 2020-01-15 15:41:10 * @Date: 2020-01-15 15:41:10
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-17 21:06:46 * @LastEditTime : 2020-01-17 21:28:23
*/ */
import types from './actionTypes.js'; import types from './actionTypes.js';
import { import {
@ -133,10 +133,12 @@ export const evaluateWxCode = (identifier, path) => {
// 定时调用 game_status fetchWxCodeGameStatus // 定时调用 game_status fetchWxCodeGameStatus
let count = 1; let count = 1;
const intervalTime = 500; const intervalTime = 500;
let time_out = false;
function wxCodeGameStatus (intervalTime, finalTime, count, timer) { function wxCodeGameStatus (intervalTime, finalTime, count, timer) {
const excuteTime = (count++) * intervalTime; // 当前执行时间 const excuteTime = (count++) * intervalTime; // 当前执行时间
console.log(finalTime, count, excuteTime); console.log(finalTime, count, excuteTime);
fetchWxCodeGameStatus(identifier, {resubmit: _resubmit}).then(r => { if ((excuteTime / 1000) > (finalTime + 1)) time_out = true;
fetchWxCodeGameStatus(identifier, {resubmit: _resubmit, time_out}).then(r => {
const { status, test_sets = [], gold, experience, next_game, sets_error_count } = r.data; const { status, test_sets = [], gold, experience, next_game, sets_error_count } = r.data;
if (+status > -1 || ((excuteTime / 1000) > (finalTime + 1))) { if (+status > -1 || ((excuteTime / 1000) > (finalTime + 1))) {
clearInterval(timer); clearInterval(timer);

Loading…
Cancel
Save