Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
5edb3a02
Commit
5edb3a02
authored
Oct 12, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公众号
parent
76c5cb18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/OfficialAccountController.java
...in/java/com/wwdz/ch/wx/api/OfficialAccountController.java
+35
-4
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/api/OfficialAccountController.java
View file @
5edb3a02
package
com.wwdz.ch.wx.api
;
package
com.wwdz.ch.wx.api
;
import
com.alibaba.fastjson.JSONObject
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.StringUtils
;
import
com.xxdxxs.utils.XmlUtils
;
import
com.xxdxxs.utils.XmlUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
...
@@ -17,6 +19,7 @@ import java.io.InputStream;
...
@@ -17,6 +19,7 @@ import java.io.InputStream;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.UUID
;
@RestController
@RestController
@RequestMapping
(
"/officialAccountCallback"
)
@RequestMapping
(
"/officialAccountCallback"
)
...
@@ -75,10 +78,34 @@ public class OfficialAccountController {
...
@@ -75,10 +78,34 @@ public class OfficialAccountController {
}
}
}
}
}
}
return
""
;
return
"
success
"
;
}
}
@RequestMapping
(
value
=
"/getSubscribeNotice"
)
public
Object
getNotice
(
@RequestParam
(
required
=
false
,
name
=
"signature"
)
String
signature
,
@RequestParam
(
required
=
false
,
name
=
"timestamp"
)
String
timestamp
,
@RequestParam
(
required
=
false
,
name
=
"nonce"
)
String
nonce
,
@RequestParam
(
required
=
false
,
name
=
"echostr"
)
String
echostr
,
@RequestBody
(
required
=
false
)
String
xml
)
{
try
{
List
<
Map
<
String
,
String
>>
list
=
XmlUtils
.
fromXml
(
xml
,
"xml"
);
Map
<
String
,
String
>
contentMap
=
list
.
get
(
0
);
String
event
=
contentMap
.
get
(
"Event"
);
if
(
SUBSCRIBE_EVENT
.
equals
(
event
)
||
UNSUBSCRIBE_EVENT
.
equals
(
event
))
{
String
userOpenId
=
contentMap
.
get
(
"FromUserName"
);
String
createTime
=
contentMap
.
get
(
"CreateTime"
);
Date
date
=
new
Date
(
createTime
);
logger
.
info
(
"openId:{}, event :{}, time:{}"
,
userOpenId
,
event
,
date
);
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"视频号回调推送error : {}"
,
e
);
}
return
"success"
;
}
@RequestMapping
(
value
=
"/getToken"
)
@RequestMapping
(
value
=
"/getToken"
)
public
String
getToken
(){
public
String
getToken
(){
String
token
=
null
;
String
token
=
null
;
...
@@ -89,4 +116,8 @@ public class OfficialAccountController {
...
@@ -89,4 +116,8 @@ public class OfficialAccountController {
}
}
return
token
;
return
token
;
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
StringUtil
.
generateRandomString
(
32
));
}
}
}
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