From ddee2e82b3f9e6db2bb20bfc3d824a5eedae8628 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 9 Feb 2023 11:53:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=85=88=E6=8F=90=E4=BA=A4=E4=B8=80?= =?UTF-8?q?=E4=B8=8B=E5=89=8D=E7=AB=AF=E7=9B=91=E6=8E=A7=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E4=BA=BA--=E8=A7=82=E5=AF=9F=E8=80=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sentry/AppApiMonitor/AppApiMonitor.vue | 65 +++++++++++++++---- ui/lib/js/observer.js | 39 +++++++++++ 2 files changed, 91 insertions(+), 13 deletions(-) create mode 100644 ui/lib/js/observer.js diff --git a/project/oms/apps/sentry/AppApiMonitor/AppApiMonitor.vue b/project/oms/apps/sentry/AppApiMonitor/AppApiMonitor.vue index f5489ce1..fd808bf4 100644 --- a/project/oms/apps/sentry/AppApiMonitor/AppApiMonitor.vue +++ b/project/oms/apps/sentry/AppApiMonitor/AppApiMonitor.vue @@ -4,13 +4,21 @@ @@ -19,26 +27,57 @@ diff --git a/ui/lib/js/observer.js b/ui/lib/js/observer.js new file mode 100644 index 00000000..d899ab73 --- /dev/null +++ b/ui/lib/js/observer.js @@ -0,0 +1,39 @@ +/** + * 获取符合要求的请求 + * @param entries 监测的请求对象 + * @param type 设置满足条件的请求类型 + * @returns {PerformanceEntry[]} + */ +const getRequests = (entries = performance.getEntriesByType('resource'), type = ['xmlhttprequest']) => + entries?.filter(e => type.includes(e.initiatorType)) || [] + +/** + * 观察者工具对象,用于前端接口监测 + */ +class Observer { + constructor() { + this.saveLogs(getRequests()) + this.ins = new PerformanceObserver((list, ob) => { + const watchLogs = getRequests(list.getEntriesByType("resource")) + this.saveLogs(watchLogs) + }) + this.ins.observe({entryTypes: ["resource"]}) + } + + saveLogs(list = []) { + list.map(e => { + if (!/sockjs/.test(e.name)) { + const api = { + status: e.responseStatus, + path: e.name, + url: location.href, + nodeProcess: process.env.NODE_ENV, + } + console.log(api) + // http.post("/node/monitorApi/addOrUpdate", api) + } + }) + } +} + +export default Observer From be3eca952d0b384ba5c58e34e08d0227e3ed6fe8 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 9 Feb 2023 15:36:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E9=93=9C=E4=BB=81=E6=89=93=E5=8D=A1?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/tongren/AppSignInfo/AppSignInfo.vue | 34 +++++ project/tongren/AppSignInfo/list.vue | 158 ++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 project/tongren/AppSignInfo/AppSignInfo.vue create mode 100644 project/tongren/AppSignInfo/list.vue diff --git a/project/tongren/AppSignInfo/AppSignInfo.vue b/project/tongren/AppSignInfo/AppSignInfo.vue new file mode 100644 index 00000000..789573e2 --- /dev/null +++ b/project/tongren/AppSignInfo/AppSignInfo.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/project/tongren/AppSignInfo/list.vue b/project/tongren/AppSignInfo/list.vue new file mode 100644 index 00000000..a35d6b76 --- /dev/null +++ b/project/tongren/AppSignInfo/list.vue @@ -0,0 +1,158 @@ + + + + + From 609b6edbbaca08d029d30bb65801ec116d151632 Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 9 Feb 2023 15:42:45 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BC=BA=E5=88=B6=E6=95=B0=E5=AD=97?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/tongren/AppSignInfo/list.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/tongren/AppSignInfo/list.vue b/project/tongren/AppSignInfo/list.vue index a35d6b76..cd86d35c 100644 --- a/project/tongren/AppSignInfo/list.vue +++ b/project/tongren/AppSignInfo/list.vue @@ -15,7 +15,7 @@ - + From 89a7eb344192e124d6c2c2371fcd5f4c5df1688f Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 9 Feb 2023 16:10:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E9=93=9C=E4=BB=81=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E9=BB=94=E8=A5=BF=E5=8D=97=E8=B4=A6=E5=8F=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/appsSync.js | 2 +- project/tongren/AppAccountTr/AppAccountTr.vue | 281 ++++++++++++++++++ project/tongren/AppSignInfo/list.vue | 2 +- 3 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 project/tongren/AppAccountTr/AppAccountTr.vue diff --git a/bin/appsSync.js b/bin/appsSync.js index 8e63bbca..9ab5d455 100644 --- a/bin/appsSync.js +++ b/bin/appsSync.js @@ -3,7 +3,7 @@ const {chalkTag, findApp, fs} = require("./tools"); const compiler = require('vue-template-compiler') const saveApps = app => { if (app.list.length > 0) { - return axios.post("http://dvcp.sinoecare.net/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => { + return axios.post("http://192.168.1.87:12525/node/wechatapps/addOrUpdate", app, {timeout: 1000}).then(res => { if (res.data.code == 0) chalkTag.done("产品库目录已同步至后台数据库...") }).catch(() => 0) } else return Promise.reject("没有应用") diff --git a/project/tongren/AppAccountTr/AppAccountTr.vue b/project/tongren/AppAccountTr/AppAccountTr.vue new file mode 100644 index 00000000..4c8aa38d --- /dev/null +++ b/project/tongren/AppAccountTr/AppAccountTr.vue @@ -0,0 +1,281 @@ + + + + + diff --git a/project/tongren/AppSignInfo/list.vue b/project/tongren/AppSignInfo/list.vue index cd86d35c..46906462 100644 --- a/project/tongren/AppSignInfo/list.vue +++ b/project/tongren/AppSignInfo/list.vue @@ -15,7 +15,7 @@ - +