Преглед изворни кода

[接收微信回调][修改]

release_toaliyun_real
Stormeye Wu пре 7 година
родитељ
комит
3816b747d8
1 измењених фајлова са 15 додато и 6 уклоњено
  1. +15
    -6
      mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java

+ 15
- 6
mallinkAdmin/src/main/java/com/iformall/controller/WechatCalllbackController.java Прегледај датотеку

@@ -12,8 +12,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;

@RestController
@RequestMapping("wxOpen")
@RequestMapping("/wxOpen")
public class WechatCalllbackController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@@ -21,10 +25,15 @@ public class WechatCalllbackController extends BaseController {
protected WxOpenService wxOpenService;

@RequestMapping("/notify")
public Object receiveTicket(@RequestBody(required = false) String requestBody, @RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce, @RequestParam("signature") String signature,
@RequestParam(name = "encrypt_type", required = false) String encType,
@RequestParam(name = "msg_signature", required = false) String msgSignature) {
public Object receiveTicket(HttpServletRequest request) throws IOException {
logger.info("[" +getIpAddr() + "]接收微信请求");
InputStream inStream = request.getInputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = inStream.read(buffer)) != -1) {
logger.debug(buffer.toString());
}
/*
logger.info(
"\n接收微信请求:[signature=[{}], encType=[{}], msgSignature=[{}],"
+ " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ",
@@ -45,7 +54,7 @@ public class WechatCalllbackController extends BaseController {
} catch (WxErrorException e) {
this.logger.error("notify", e);
}
*/

return "success";
}


Loading…
Откажи
Сачувај