From 0b3c129df07805335e8dfebf437e3f9f795d2b05 Mon Sep 17 00:00:00 2001 From: "1340691923@qq.com" <1340691923@qq.com> Date: Fri, 11 Mar 2022 09:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/config.go | 2 +- router/analysis.go | 16 +++++++++++++--- vue/src/views/behavior-analysis/trace.vue | 9 ++++++++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/model/config.go b/model/config.go index 83128a7..5f3a03c 100644 --- a/model/config.go +++ b/model/config.go @@ -89,7 +89,7 @@ type LogConfig struct { func (this *Config) GetCkQueryLimit() int { if this.Manager.CkQueryLimit == 0 { - return 10 + return 5 } return this.Manager.CkQueryLimit } diff --git a/router/analysis.go b/router/analysis.go index ce286e0..1c75986 100644 --- a/router/analysis.go +++ b/router/analysis.go @@ -18,21 +18,31 @@ func runAnalysis(app *fiber.App) { c.MountApi(api_config.MountApiBasePramas{Remark: "获取分析面板初始化数据", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.GetConfigs) c.MountApi(api_config.MountApiBasePramas{Remark: "根据事件名查找指标的运算函数", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.LoadPropQuotas) c.MountApi(api_config.MountApiBasePramas{Remark: "获取上报字段所有的值", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.GetValues) + appG = appG.Use(middleware.OperaterLog) - appG = appG.(*fiber.Group). - Use(middleware.OperaterLog). + appG = appG. Use(limiter.New( limiter.Config{ Max: model.GlobConfig.GetCkQueryLimit(), Expiration: time.Duration(model.GlobConfig.GetCkQueryExpiration()) * time.Second, })) + c.MountApi(api_config.MountApiBasePramas{Remark: "事件分析查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.EventList) c.MountApi(api_config.MountApiBasePramas{Remark: "漏斗分析查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.FunnelList) c.MountApi(api_config.MountApiBasePramas{Remark: "留存分析查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.RetentionList) - c.MountApi(api_config.MountApiBasePramas{Remark: "智能路径分析查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.TraceList) + c.MountApi(api_config.MountApiBasePramas{Remark: "用户属性分析查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.UserAttrList) c.MountApi(api_config.MountApiBasePramas{Remark: "用户列表查询", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.UserList) c.MountApi(api_config.MountApiBasePramas{Remark: "查询用户访问过的事件详情", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.UserEventDetailList) c.MountApi(api_config.MountApiBasePramas{Remark: "查询用户访问过的事件统计", AbsolutePath: AbsolutePath}, appG.(*fiber.Group), BehaviorAnalysisController{}.UserEventCountList) + + f := appG. + Use(limiter.New( + limiter.Config{ + Max: 1, + Expiration: 2 * time.Second, + })) + + c.MountApi(api_config.MountApiBasePramas{Remark: "智能路径分析查询", AbsolutePath: AbsolutePath}, f.(*fiber.Group), BehaviorAnalysisController{}.TraceList) } } diff --git a/vue/src/views/behavior-analysis/trace.vue b/vue/src/views/behavior-analysis/trace.vue index 9704dbc..ccc9e22 100644 --- a/vue/src/views/behavior-analysis/trace.vue +++ b/vue/src/views/behavior-analysis/trace.vue @@ -45,7 +45,7 @@