@Test public void testCreateJsapiSignature() throws WxErrorException { final WxJsapiSignature jsapiSignature = this.wxService.getJsapiService().createJsapiSignature("http: System.out.println(jsapiSignature); assertThat(jsapiSignature).isNotNull(); }
@Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); return WxJsapiSignature .builder() .appId(this.wxMaService.getWxMaConfig().getAppid()) .timestamp(timestamp) .nonceStr(randomStr) .url(url) .signature(signature) .build(); }
WxMaJsapiServiceImpl implements WxMaJsapiService { @Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); return WxJsapiSignature .builder() .appId(this.wxMaService.getWxMaConfig().getAppid()) .timestamp(timestamp) .nonceStr(randomStr) .url(url) .signature(signature) .build(); } }
WxMaJsapiServiceImpl implements WxMaJsapiService { @Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); return WxJsapiSignature .builder() .appId(this.wxMaService.getWxMaConfig().getAppid()) .timestamp(timestamp) .nonceStr(randomStr) .url(url) .signature(signature) .build(); } WxMaJsapiServiceImpl(WxMaService wxMaService); }
WxMaJsapiServiceImpl implements WxMaJsapiService { @Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); return WxJsapiSignature .builder() .appId(this.wxMaService.getWxMaConfig().getAppid()) .timestamp(timestamp) .nonceStr(randomStr) .url(url) .signature(signature) .build(); } WxMaJsapiServiceImpl(WxMaService wxMaService); String getCardApiTicket(); String getCardApiTicket(boolean forceRefresh); @Override String getJsapiTicket(); @Override String getJsapiTicket(boolean forceRefresh); @Override WxJsapiSignature createJsapiSignature(String url); }
WxMaJsapiServiceImpl implements WxMaJsapiService { @Override public WxJsapiSignature createJsapiSignature(String url) throws WxErrorException { long timestamp = System.currentTimeMillis() / 1000; String randomStr = RandomUtils.getRandomStr(); String jsapiTicket = getJsapiTicket(false); String signature = SHA1.genWithAmple("jsapi_ticket=" + jsapiTicket, "noncestr=" + randomStr, "timestamp=" + timestamp, "url=" + url); return WxJsapiSignature .builder() .appId(this.wxMaService.getWxMaConfig().getAppid()) .timestamp(timestamp) .nonceStr(randomStr) .url(url) .signature(signature) .build(); } WxMaJsapiServiceImpl(WxMaService wxMaService); String getCardApiTicket(); String getCardApiTicket(boolean forceRefresh); @Override String getJsapiTicket(); @Override String getJsapiTicket(boolean forceRefresh); @Override WxJsapiSignature createJsapiSignature(String url);  }