Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
cd942b0e
Commit
cd942b0e
authored
Sep 29, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
3b614c60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
6 deletions
+23
-6
WebConfiguration.java
.../com/xxfc/platform/universal/config/WebConfiguration.java
+2
-2
UserInfoController.java
...xfc/platform/universal/controller/UserInfoController.java
+21
-4
No files found.
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/config/WebConfiguration.java
View file @
cd942b0e
...
...
@@ -32,8 +32,8 @@ public class WebConfiguration implements WebMvcConfigurer {
addPathPatterns
(
getIncludePathPatterns
());
registry
.
addInterceptor
(
getUserAuthRestInterceptor
()).
addPathPatterns
(
getIncludePathPatterns
());
registry
.
addInterceptor
(
getWeChatH5LoginInterceptor
()
).
addPathPatterns
(
getWxIncludePathPatterns
());
/*
registry.addInterceptor(getWeChatH5LoginInterceptor()
).addPathPatterns(getWxIncludePathPatterns());
*/
}
@Bean
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/UserInfoController.java
View file @
cd942b0e
...
...
@@ -3,16 +3,17 @@ package com.xxfc.platform.universal.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.UserAgentUtil
;
import
com.xxfc.platform.universal.biz.WeixinService
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
/**
* 用户
*/
...
...
@@ -25,10 +26,26 @@ public class UserInfoController {
@Autowired
WeixinService
weixinService
;
@Value
(
"${wx.sendUrl}"
)
private
String
sendUrl
;
@RequestMapping
(
value
=
"getOpenId"
,
method
=
RequestMethod
.
GET
)
//匹配的是href中的download请求
public
ObjectRestResponse
sendSms
(
HttpServletRequest
request
)
throws
Exception
{
return
ObjectRestResponse
.
succ
(
weixinService
.
getSession
(
request
));
boolean
isWx
=
UserAgentUtil
.
isWexinBrowser
(
request
);
if
(
isWx
)
{
//session里面获取用户信息
String
openId
=
weixinService
.
getSession
(
request
);
if
(
StringUtils
.
isBlank
(
openId
)){
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"sendUrl"
,
sendUrl
);
return
ObjectRestResponse
.
createFailedResultWithObj
(
1001
,
""
,
json
);
}
return
ObjectRestResponse
.
succ
(
openId
);
}
return
ObjectRestResponse
.
succ
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment