|
|
|
@ -365,43 +365,8 @@ public class WechatController { |
|
|
|
|
return ResponseMsgUtil.success(so); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/verifyWx", method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "微信签名") |
|
|
|
|
public ResponseData verifyWx(@RequestParam(value = "url", required = true) String url) { |
|
|
|
|
|
|
|
|
|
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",WxUtils.makeNonStr()); |
|
|
|
|
map.put("jsapi_ticket",accessTokenObject.getString("ticket")); |
|
|
|
|
map.put("timestamp", new Date().getTime()); |
|
|
|
|
map.put("url",url); |
|
|
|
|
|
|
|
|
|
Map<String, Object> objectMap = new HashMap<>(); |
|
|
|
|
objectMap.put("appId" , params.get("appId")); |
|
|
|
|
objectMap.put("timestamp" , map.get("timestamp")); |
|
|
|
|
objectMap.put("nonceStr" , map.get("nonceStr")); |
|
|
|
|
objectMap.put("signature" , WxUtils.getSHA1(map)); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(objectMap); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|