|
|
@ -55,32 +55,32 @@ public class WxMsgController { |
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private HighMerchantStoreService merchantStoreService; |
|
|
|
private HighMerchantStoreService merchantStoreService; |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET) |
|
|
|
// @RequestMapping(value = "/verifyWxToken", method = RequestMethod.GET)
|
|
|
|
@ResponseBody |
|
|
|
// @ResponseBody
|
|
|
|
@ApiOperation(value = "验证servlet") |
|
|
|
// @ApiOperation(value = "验证servlet")
|
|
|
|
public String verifyWxToken( |
|
|
|
// public String verifyWxToken(
|
|
|
|
@RequestParam(name = "signature", required = false) String signature, |
|
|
|
// @RequestParam(name = "signature", required = false) String signature,
|
|
|
|
@RequestParam(name = "timestamp", required = false) String timestamp, |
|
|
|
// @RequestParam(name = "timestamp", required = false) String timestamp,
|
|
|
|
@RequestParam(name = "nonce", required = false) String nonce, |
|
|
|
// @RequestParam(name = "nonce", required = false) String nonce,
|
|
|
|
@RequestParam(name = "echostr", required = false) String echostr |
|
|
|
// @RequestParam(name = "echostr", required = false) String echostr
|
|
|
|
) { |
|
|
|
// ) {
|
|
|
|
|
|
|
|
//
|
|
|
|
try { |
|
|
|
// try {
|
|
|
|
|
|
|
|
//
|
|
|
|
String signatureStr = WxUtils.getSHA1("RgAWdnR5oEOLBdyEjfr4" , timestamp , nonce); |
|
|
|
// String signatureStr = WxUtils.getSHA1("RgAWdnR5oEOLBdyEjfr4" , timestamp , nonce);
|
|
|
|
log.info("signatureStr!!!!!" + signatureStr); |
|
|
|
// log.info("signatureStr!!!!!" + signatureStr);
|
|
|
|
log.info("signature!!!!!" + signature); |
|
|
|
// log.info("signature!!!!!" + signature);
|
|
|
|
if (signature.equals(signatureStr)) { |
|
|
|
// if (signature.equals(signatureStr)) {
|
|
|
|
log.info("验证通过!!!!!"); |
|
|
|
// log.info("验证通过!!!!!");
|
|
|
|
return echostr; |
|
|
|
// return echostr;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
log.info("验证失败!!!!!"); |
|
|
|
// log.info("验证失败!!!!!");
|
|
|
|
return null; |
|
|
|
// return null;
|
|
|
|
} catch (Exception e) { |
|
|
|
// } catch (Exception e) {
|
|
|
|
return null; |
|
|
|
// return null;
|
|
|
|
} |
|
|
|
// }
|
|
|
|
|
|
|
|
//
|
|
|
|
} |
|
|
|
// }
|
|
|
|
@RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST) |
|
|
|
@RequestMapping(value = "/verifyWxToken", method = RequestMethod.POST) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "验证servlet") |
|
|
|
@ApiOperation(value = "验证servlet") |
|
|
@ -251,4 +251,32 @@ public class WxMsgController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/verifyWx", method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "微信签名") |
|
|
|
|
|
|
|
public String verifyWx() { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
|
|
|
|
params.put("appid", SysConst.getSysConfig().getWxH5AppId()); |
|
|
|
|
|
|
|
params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); |
|
|
|
|
|
|
|
params.put("grant_type", "client_credential"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
map.put("noncestr","Wm3WZYTPz0wzccnW"); |
|
|
|
|
|
|
|
map.put("jsapi_ticket",accessTokenObject.getString("ticket")); |
|
|
|
|
|
|
|
map.put("timestamp","1414587457"); |
|
|
|
|
|
|
|
map.put("url","http://mp.weixin.qq.com?params=value"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return WxUtils.getSHA1(map); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|