protected WxAccessTokenStore accessTokenStore;
protected WxJsapiTicketStore jsapiTicketStore;
public AbstractWxApi2() {
this.accessTokenStore = new MemoryAccessTokenStore();
}
protected WxAccessTokenStore accessTokenStore;
protected WxJsapiTicketStore jsapiTicketStore;
public AbstractWxApi2() {
this.accessTokenStore = new MemoryAccessTokenStore();
}
我在获取 WxJsapiTicket 时候调用 jsapiTicketStore.get();后 获取到jsapiTicketStore是空的 ,
看了下源码jsapiTicketStore没有初始化
是不是应该在构造方法里面 初始化下
public AbstractWxApi2() {
this.accessTokenStore = new MemoryAccessTokenStore();
this.jsapiTicketStore = new MemoryJsapiTicketStore();
}
WxApi2 wxApi2 = wxConfigService.getWxApi2(wxid);
if (Lang.isEmpty(Globals.memoryJsapiTicketStore.get(wxid))) {
Globals.memoryJsapiTicketStore.put(wxid, new MemoryJsapiTicketStore());
}
MemoryJsapiTicketStore memoryJsapiTicketStore = Globals.memoryJsapiTicketStore.get(wxid);
wxApi2.setJsapiTicketStore(memoryJsapiTicketStore);
String url = "http://" + Globals.AppDomain + Globals.AppBase + "/public/wx/bzsx/wdsq/sc/" + id;
NutMap jsConfig = wxApi2.genJsSDKConfig(url, "chooseImage", "previewImage", "uploadImage", "downloadImage");
req.setAttribute("jsConfig", Json.toJson(jsConfig));