Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhangjian1949
microservices-platform
提交
b484f603
microservices-platform
项目概览
zhangjian1949
/
microservices-platform
与 Fork 源项目一致
Fork自
zlt2000 / microservices-platform
通知
6
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
microservices-platform
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
b484f603
编写于
5月 10, 2019
作者:
zlt2000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充内容
上级
a6844100
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
18 deletion
+36
-18
zlt-business/search-center/search-server/src/main/java/com/central/SearchCenterApp.java
...rch-server/src/main/java/com/central/SearchCenterApp.java
+1
-0
zlt-doc/sql/user-center.sql
zlt-doc/sql/user-center.sql
+6
-0
zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/filter/pre/RequestStatisticsFilter.java
...m/central/gateway/filter/pre/RequestStatisticsFilter.java
+29
-18
未找到文件。
zlt-business/search-center/search-server/src/main/java/com/central/SearchCenterApp.java
浏览文件 @
b484f603
...
...
@@ -9,6 +9,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author zlt
* @date 2019/5/1
*/
@EnableLoginArgResolver
@EnableDiscoveryClient
...
...
zlt-doc/sql/user-center.sql
浏览文件 @
b484f603
...
...
@@ -132,6 +132,9 @@ INSERT INTO `sys_menu` VALUES (67, -1, '任务管理', '#!job', 'http://127.0.0.
INSERT
INTO
`sys_menu`
VALUES
(
68
,
63
,
'应用吞吐量监控'
,
'#!sentinel'
,
'http://127.0.0.1:6999'
,
NULL
,
'layui-icon-chart'
,
4
,
'2019-01-22 16:31:55'
,
'2019-01-22 16:34:03'
,
1
,
0
);
INSERT
INTO
`sys_menu`
VALUES
(
69
,
37
,
'配置中心'
,
'#!nacos'
,
'http://127.0.0.1:8848/nacos'
,
NULL
,
'layui-icon-tabs'
,
1
,
'2019-01-23 14:06:10'
,
'2019-01-23 14:06:10'
,
1
,
0
);
INSERT
INTO
`sys_menu`
VALUES
(
70
,
63
,
'APM监控'
,
'#!apm'
,
'http://127.0.0.1:8080'
,
null
,
'layui-icon-engine'
,
5
,
'2019-02-27 10:31:55'
,
'2019-02-27 10:31:55'
,
1
,
0
);
INSERT
INTO
`sys_menu`
VALUES
(
71
,
-
1
,
'搜索管理'
,
'javascript:;'
,
''
,
NULL
,
'layui-icon-set'
,
3
,
'2018-08-25 10:41:58'
,
'2019-01-23 15:07:07'
,
1
,
0
);
INSERT
INTO
`sys_menu`
VALUES
(
72
,
71
,
'索引管理'
,
'#!index'
,
'search/index_manager.html'
,
NULL
,
'layui-icon-template'
,
1
,
'2019-01-10 18:35:55'
,
'2019-01-12 00:27:20'
,
1
,
0
);
INSERT
INTO
`sys_menu`
VALUES
(
73
,
71
,
'用户搜索'
,
'#!userSearch'
,
'search/user_search.html'
,
NULL
,
'layui-icon-user'
,
2
,
'2019-01-10 18:35:55'
,
'2019-01-12 00:27:20'
,
1
,
0
);
-- ----------------------------
-- Table structure for sys_role_menu
...
...
@@ -164,6 +167,9 @@ INSERT INTO `sys_role_menu` VALUES (1, 67);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
68
);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
69
);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
70
);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
71
);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
72
);
INSERT
INTO
`sys_role_menu`
VALUES
(
1
,
73
);
INSERT
INTO
`sys_role_menu`
VALUES
(
2
,
2
);
INSERT
INTO
`sys_role_menu`
VALUES
(
2
,
3
);
INSERT
INTO
`sys_role_menu`
VALUES
(
2
,
4
);
...
...
zlt-gateway/zuul-gateway/src/main/java/com/central/gateway/filter/pre/RequestStatisticsFilter.java
浏览文件 @
b484f603
package
com.central.gateway.filter.pre
;
import
cn.hutool.core.util.StrUtil
;
import
com.central.log.monitor.PointUtil
;
import
com.netflix.zuul.ZuulFilter
;
import
com.netflix.zuul.context.RequestContext
;
...
...
@@ -11,14 +12,16 @@ import org.springframework.stereotype.Component;
import
javax.servlet.http.HttpServletRequest
;
/**
* 统计分析埋点过滤器
*
请求
统计分析埋点过滤器
*
* @author zlt
* @date 201
8/11/20
* @date 201
9/5/6
*/
@Slf4j
@Component
public
class
RequestStatisticsFilter
extends
ZuulFilter
{
private
final
static
String
UNKNOWN_STR
=
"unknown"
;
@Override
public
String
filterType
()
{
return
FilterConstants
.
PRE_TYPE
;
...
...
@@ -41,9 +44,10 @@ public class RequestStatisticsFilter extends ZuulFilter {
UserAgent
userAgent
=
UserAgent
.
parseUserAgentString
(
req
.
getHeader
(
"User-Agent"
));
//埋点
PointUtil
.
debug
(
"0"
,
"request-statistics"
,
"ip="
+
this
.
getIpAddr
(
req
)
+
"&browser="
+
userAgent
.
getBrowser
()
+
"&operatingSystem="
+
userAgent
.
getOperatingSystem
());
PointUtil
.
debug
(
"0"
,
"request-statistics"
,
"ip="
+
this
.
getIpAddr
(
req
)
+
"&browser="
+
userAgent
.
getBrowser
()
+
"&operatingSystem="
+
userAgent
.
getOperatingSystem
());
return
null
;
}
...
...
@@ -52,21 +56,28 @@ public class RequestStatisticsFilter extends ZuulFilter {
*/
public
String
getIpAddr
(
HttpServletRequest
request
){
String
ip
=
request
.
getHeader
(
"X-Forwarded-For"
);
if
(
i
p
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
if
(
i
sEmptyIP
(
ip
))
{
ip
=
request
.
getHeader
(
"Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_CLIENT_IP
"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_X_FORWARDED_FOR"
);
}
if
(
ip
==
null
||
ip
.
length
()
==
0
||
"unknown"
.
equalsIgnoreCase
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
if
(
isEmptyIP
(
ip
))
{
ip
=
request
.
getHeader
(
"WL-Proxy-Client-IP"
);
if
(
isEmptyIP
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_CLIENT_IP"
);
if
(
isEmptyIP
(
ip
))
{
ip
=
request
.
getHeader
(
"HTTP_X_FORWARDED_FOR
"
);
if
(
isEmptyIP
(
ip
))
{
ip
=
request
.
getRemoteAddr
();
}
}
}
}
}
return
ip
;
}
private
boolean
isEmptyIP
(
String
ip
)
{
if
(
StrUtil
.
isEmpty
(
ip
)
||
UNKNOWN_STR
.
equalsIgnoreCase
(
ip
))
{
return
true
;
}
return
false
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录