Commit dd90a984 authored by shiyu's avatar shiyu

公众号

parent b53ca1c5
......@@ -16,10 +16,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
@RestController
@RequestMapping("/officialAccountCallback")
......@@ -91,28 +88,27 @@ public class OfficialAccountController {
@RequestBody(required = false) String xmlInfo,
HttpServletResponse response) throws IOException {
logger.info("222222222222222 :{}", echostr);
/*try {
logger.info("微信通知回调接口原文:{}", xmlInfo);
List<Map<String, String>> list = XmlUtils.fromXml(xmlInfo, "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);
}*/
response.setContentType("text/plain"); // 设置响应的内容类型为HTML
response.setCharacterEncoding("UTF-8"); // 设置响应的字符编码为UTF-8
response.getWriter().write(echostr);
return echostr;
System.out.println("接入失败");
return echostr + "";
}
@RequestMapping(value ="/getSubscribeNotice2")
public Object getSubscribeNotice2(@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 xmlInfo,
HttpServletResponse response) throws IOException {
logger.info("33333 :{}", echostr);
System.out.println("接入失败");
return Long.valueOf(echostr);
}
@RequestMapping(value ="/getToken")
public String getToken(){
String token = null;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment