|
@@ -40,4 +40,18 @@ public class WeXinJsSdkController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @RequestMapping(value = "/ticket", method = RequestMethod.GET)
|
|
|
+ public String wxjsapiTicket(HttpServletRequest request, @PathVariable String appid) {
|
|
|
+ if (!this.wxMpService.switchover(appid)) {
|
|
|
+ throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid));
|
|
|
+ }
|
|
|
+
|
|
|
+ try { // 直接调用wxMpServer 接口
|
|
|
+ String jsapiTicket = wxMpService.getJsapiTicket();
|
|
|
+ return jsapiTicket;
|
|
|
+ } catch (WxErrorException e) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|