新增 微信第三方平台 小程序/公众号授权事件回调接口

This commit is contained in:
Lemon
2023-07-28 17:03:10 +08:00
parent a5fcc876a0
commit e9c8624e1f
3 changed files with 75 additions and 13 deletions

View File

@@ -28,8 +28,7 @@ public class AgentDevController extends BaseController {
private AgentDevService agentDevService;
/**
* 授权事件接收URL,验证票据
* 微信平台 10 分钟推送一次
* 授权事件接收URL,验证票据
*
* @param timestamp
* @param nonce
@@ -44,19 +43,20 @@ public class AgentDevController extends BaseController {
@RequestBody String postData) {
AuthorizationEventResult<String> resultBean = new AuthorizationEventResult<>();
ResponseEntity<AuthorizationEventResult> responseEntity;
logger.info("授权事件接收URL,验证票据");
logger.info("第三方平台授权事件接收URL params:{}", postData);
try {
resultBean.setData(agentDevService.parseRequest(timestamp, nonce, msgSignature, postData));
responseEntity = new ResponseEntity<>(resultBean, HttpStatus.OK);
logger.info("第三方平台授权事件接收URL,验证票据成功");
logger.info("第三方平台授权事件接收URL success");
} catch (Exception e) {
logger.error("第三方平台授权事件接收URL,验证票据异常", e.getMessage(), e);
logger.error("第三方平台授权事件接收URL error:{}", e.getMessage(), e);
AuthorizationEventResult<String> errorResultBean = new AuthorizationEventResult<>();
errorResultBean.setMsg("第三方平台授权事件接收URL,验证票据异常");
errorResultBean.setMsg("第三方平台授权事件接收URL error");
errorResultBean.setErrorMsg(e.getMessage());
errorResultBean.setCode(422);
responseEntity = new ResponseEntity<>(errorResultBean, HttpStatus.UNPROCESSABLE_ENTITY);
}
logger.info("第三方平台授权事件接收URL result:{}", resultBean);
return responseEntity;
}