diff --git a/App.js b/App.js index f96d4ea..75b2b31 100644 --- a/App.js +++ b/App.js @@ -294,27 +294,30 @@ async routine() { getAdDataCount -=1; pageChangeCount -=1; + try { + if (getAdDataCount<=0) { + await this.getAdDataList() + getAdDataCount = heartConfig.dataRefreshInterval + } else if (hbRequestCount<=0) { + await this.hbRequest() + hbRequestCount = heartConfig.heartbeatInterval + } - if (getAdDataCount<=0) { - await this.getAdDataList() - getAdDataCount = heartConfig.dataRefreshInterval - } else if (hbRequestCount<=0) { - await this.hbRequest() - hbRequestCount = heartConfig.heartbeatInterval - } - - if (pageChangeCount <= 0) { //页面切换间隔 - if (this.state.contentDisplayStatus) { - this.setState({ contentDisplayStatus: false}) - if (this.updateContent()) { - this.setState({ contentDisplayStatus: true}) + if (pageChangeCount <= 0) { //页面切换间隔 + if (this.state.contentDisplayStatus) { + this.setState({ contentDisplayStatus: false}) + if (this.updateContent()) { + this.setState({ contentDisplayStatus: true}) + } + } else { + await this.getBaseInfo() + await this.getAdDataList() } - } else { - await this.getBaseInfo() - await this.getAdDataList() + pageChangeCount = heartConfig.pageChangeInterval } - pageChangeCount = heartConfig.pageChangeInterval - } + } catch(e){ + this.setState({ versionInfo: this.state.versionInfo+'[E]'}); + } setTimeout(()=>{ this.routine();