From 2ac288a8d4a173985534b322ceadd8dd218264b6 Mon Sep 17 00:00:00 2001 From: jayzou Date: Wed, 16 Jan 2019 21:47:34 +0800 Subject: [PATCH 1/2] fix aggregate(xx).cursor({}).exec().toArray() is not function --- exts/yapi-plugin-statistics/statisMockModel.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/exts/yapi-plugin-statistics/statisMockModel.js b/exts/yapi-plugin-statistics/statisMockModel.js index 0a55336b..8c307f67 100644 --- a/exts/yapi-plugin-statistics/statisMockModel.js +++ b/exts/yapi-plugin-statistics/statisMockModel.js @@ -35,10 +35,11 @@ class statisMockModel extends baseModel { return this.model.countDocuments({}); } - getDayCount(timeInterval) { + async getDayCount(timeInterval) { let end = timeInterval[1]; let start = timeInterval[0]; - return this.model.aggregate([ + let data = []; + const cursor = this.model.aggregate([ { $match: { date: { $gt: start, $lte: end } @@ -53,8 +54,11 @@ class statisMockModel extends baseModel { { $sort: { _id: 1 } } - ]).cursor({}).exec().toArray(); - } + ]).cursor({}).exec(); + await cursor.eachAsync(doc => data.push(doc)); + return data; + + } list() { return this.model.find({}).select('date').exec(); From 93309d8f69956880b3eed2595343e2cbb0c4ff2f Mon Sep 17 00:00:00 2001 From: jayzou Date: Thu, 17 Jan 2019 10:59:11 +0800 Subject: [PATCH 2/2] fix: #768 --- exts/yapi-plugin-wiki/wikiPage/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exts/yapi-plugin-wiki/wikiPage/index.js b/exts/yapi-plugin-wiki/wikiPage/index.js index 1545cf40..13ae4a41 100644 --- a/exts/yapi-plugin-wiki/wikiPage/index.js +++ b/exts/yapi-plugin-wiki/wikiPage/index.js @@ -131,11 +131,11 @@ class WikiPage extends Component { }; this.handleWebsocketAccidentClose(sendEditor, status => { // 如果websocket 启动不成功用户依旧可以对wiki 进行编辑 - if (!status) { + // if (!status) { this.setState({ isEditor: !this.state.isEditor }); - } + // } }); };