|
@ -7,6 +7,8 @@ import com.yihu.wlyy.web.WeixinBaseController;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.http.MediaType;
|
|
import org.springframework.http.MediaType;
|
|
@ -30,6 +32,7 @@ import java.util.Arrays;
|
|
@Api(description = "微信")
|
|
@Api(description = "微信")
|
|
public class WechatCoreController extends WeixinBaseController {
|
|
public class WechatCoreController extends WeixinBaseController {
|
|
|
|
|
|
|
|
private Logger logger= LoggerFactory.getLogger(WeixinBaseController.class);
|
|
@Autowired
|
|
@Autowired
|
|
private WeiXinCoreService weiXinCoreService;
|
|
private WeiXinCoreService weiXinCoreService;
|
|
@Value("${wechat.wechat_token}")
|
|
@Value("${wechat.wechat_token}")
|
|
@ -83,7 +86,9 @@ public class WechatCoreController extends WeixinBaseController {
|
|
String signature = request.getParameter("signature").toString();
|
|
String signature = request.getParameter("signature").toString();
|
|
String timestamp = request.getParameter("timestamp").toString();
|
|
String timestamp = request.getParameter("timestamp").toString();
|
|
String nonce = request.getParameter("nonce").toString();
|
|
String nonce = request.getParameter("nonce").toString();
|
|
|
|
|
|
|
|
logger.info("signature:"+signature);
|
|
|
|
logger.info("timestamp:"+timestamp);
|
|
|
|
logger.info("nonce:"+nonce);
|
|
if (validate(signature, timestamp, nonce)) {
|
|
if (validate(signature, timestamp, nonce)) {
|
|
String xmlStr = weiXinCoreService.messageProcess(request, getAccessToken());
|
|
String xmlStr = weiXinCoreService.messageProcess(request, getAccessToken());
|
|
// 判断返回值是xml、json格式(取关是空串)
|
|
// 判断返回值是xml、json格式(取关是空串)
|