mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-22 03:55:17 +08:00
Merge branch 'dev' of http://192.168.2.2:8099/jsowell/jsowell-charger-web into dev
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.jsowell.api.uniapp;
|
||||
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import com.jsowell.common.core.controller.BaseController;
|
||||
import com.jsowell.pile.domain.AuthorizationEventResult;
|
||||
import com.jsowell.service.AgentDevService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 代开发小程序Controller
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2023/7/27 15:09
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/agentDev")
|
||||
public class AgentDevController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AgentDevService agentDevService;
|
||||
|
||||
@ApiOperation(value = "授权事件接收URL,验证票据")
|
||||
@PostMapping("/platform/event")
|
||||
public ResponseEntity<AuthorizationEventResult> wechatPlatformEvent(@RequestParam("timestamp") String timestamp,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("msg_signature") String msgSignature,
|
||||
@RequestBody String postData) {
|
||||
AuthorizationEventResult<String> resultBean = new AuthorizationEventResult<>();
|
||||
ResponseEntity<AuthorizationEventResult> responseEntity;
|
||||
logger.debug("授权事件接收URL,验证票据");
|
||||
try {
|
||||
resultBean.setData(agentDevService.parseRequest(timestamp,nonce,msgSignature,postData));
|
||||
responseEntity = new ResponseEntity<>(resultBean, HttpStatus.OK);
|
||||
logger.debug("第三方平台授权事件接收URL,验证票据成功");
|
||||
} catch (Exception e) {
|
||||
logger.error("第三方平台授权事件接收URL,验证票据异常", e.getMessage(), e);
|
||||
AuthorizationEventResult<String> errorResultBean = new AuthorizationEventResult<>();
|
||||
errorResultBean.setMsg("第三方平台授权事件接收URL,验证票据异常");
|
||||
errorResultBean.setErrorMsg(e.getMessage());
|
||||
errorResultBean.setCode(422);
|
||||
responseEntity = new ResponseEntity<>(errorResultBean, HttpStatus.UNPROCESSABLE_ENTITY);
|
||||
}
|
||||
return responseEntity;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user