@RestController @RequestMapping(value="/wechat") public class WeChatController extends Object
| 构造器和说明 |
|---|
WeChatController() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
fullNetPublish(me.chanjar.weixin.mp.bean.message.WxMpXmlMessage inMessage,
String requestBody,
String appId,
String signature,
String timestamp,
String nonce,
String openid,
String encType,
String msgSignature) |
void |
gotoPreAuthUrl(javax.servlet.http.HttpServletResponse response)
跳转到微信授权页面 扫码授权
wechat.bytedesk.com/wechat/mp/oauth/redirect/{uid}
|
void |
miniPush(Map map)
小程序 推送
|
void |
mpPush(Map map)
公众号消息 推送
|
Object |
msgEventCallback(String requestBody,
String appId,
String signature,
String timestamp,
String nonce,
String openid,
String encType,
String msgSignature) |
void |
oauthCallback(String authorizationCode,
javax.servlet.http.HttpSession session,
javax.servlet.http.HttpServletResponse response)
处理授权事件Get
授权成功之后回调地址
因为post过来的信息,服务端拿不到user_id, 而且消息一般都是post先到,然后浏览器回调,执行get,
才能够从session中拿到user_id,故基于以上原因(假设),在此处更新user_id
绑定公众号到管理员所属的默认工作组
|
Object |
oauthCallback(String requestBody,
String timestamp,
String nonce,
String signature,
String encType,
String msgSignature,
javax.servlet.http.HttpSession session)
处理授权事件POST
授权事件接收URL
wechat.bytedesk.com/wechat/mp/oauth/callback
授权过程中:
1.
|
@GetMapping(value="/mp/oauth/redirect") public void gotoPreAuthUrl(javax.servlet.http.HttpServletResponse response)
response - response@GetMapping(value="/mp/oauth/callback")
@ResponseBody
public void oauthCallback(@RequestParam(value="auth_code")
String authorizationCode,
javax.servlet.http.HttpSession session,
javax.servlet.http.HttpServletResponse response)
authorizationCode - codesession - sessionresponse - response@PostMapping(value="/mp/oauth/callback") public Object oauthCallback(@RequestBody(required=false) String requestBody, @RequestParam(value="timestamp") String timestamp, @RequestParam(value="nonce") String nonce, @RequestParam(value="signature") String signature, @RequestParam(name="encrypt_type",required=false) String encType, @RequestParam(name="msg_signature",required=false) String msgSignature, javax.servlet.http.HttpSession session)
requestBody - bodytimestamp - timenonce - noncesignature - signencType - encmsgSignature - signsession - session@RequestMapping(value="/mp/msgevent/{appId}/callback")
public Object msgEventCallback(@RequestBody(required=false)
String requestBody,
@PathVariable(value="appId")
String appId,
@RequestParam(value="signature")
String signature,
@RequestParam(value="timestamp")
String timestamp,
@RequestParam(value="nonce")
String nonce,
@RequestParam(value="openid")
String openid,
@RequestParam(value="encrypt_type")
String encType,
@RequestParam(value="msg_signature")
String msgSignature)
requestBody - bodyappId - appsignature - signtimestamp - timenonce - nonceopenid - idencType - encmsgSignature - signpublic Object fullNetPublish(me.chanjar.weixin.mp.bean.message.WxMpXmlMessage inMessage, String requestBody, String appId, String signature, String timestamp, String nonce, String openid, String encType, String msgSignature)
inMessage - inrequestBody - bodyappId - appidsignature - sigtimestamp - timestampnonce - nonceopenid - openidencType - enctypemsgSignature - msg@PostMapping(value="/mp/push")
@ResponseBody
public void mpPush(@RequestBody
Map map)
map - map@PostMapping(value="/mini/push")
@ResponseBody
public void miniPush(@RequestBody
Map map)
map - mapCopyright © 2019. All rights reserved.