mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-20 10:38:13 +08:00
完善ticket相关代码,完成#844遗留问题
This commit is contained in:
@@ -325,26 +325,85 @@ public class WxOpenInMemoryConfigStorage implements WxOpenConfigStorage {
|
||||
|
||||
@Override
|
||||
public String getTicket(TicketType type) {
|
||||
switch (type) {
|
||||
case JSAPI: {
|
||||
return wxOpenConfigStorage.getJsapiTicket(appId);
|
||||
}
|
||||
case WX_CARD: {
|
||||
return wxOpenConfigStorage.getCardApiTicket(appId);
|
||||
}
|
||||
default: {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Lock getTicketLock(TicketType type) {
|
||||
switch (type) {
|
||||
case JSAPI: {
|
||||
return this.jsapiTicketLock;
|
||||
}
|
||||
case WX_CARD: {
|
||||
return this.cardApiTicketLock;
|
||||
}
|
||||
default: {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTicketExpired(TicketType type) {
|
||||
switch (type) {
|
||||
case JSAPI: {
|
||||
return wxOpenConfigStorage.isJsapiTicketExpired(appId);
|
||||
}
|
||||
case WX_CARD: {
|
||||
return wxOpenConfigStorage.isCardApiTicketExpired(appId);
|
||||
}
|
||||
default: {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void expireTicket(TicketType type) {
|
||||
|
||||
switch (type) {
|
||||
case JSAPI: {
|
||||
wxOpenConfigStorage.expireJsapiTicket(appId);
|
||||
break;
|
||||
}
|
||||
case WX_CARD: {
|
||||
wxOpenConfigStorage.expireCardApiTicket(appId);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTicket(TicketType type, String ticket, int expiresInSeconds) {
|
||||
switch (type) {
|
||||
case JSAPI: {
|
||||
wxOpenConfigStorage.updateJsapiTicket(appId, ticket, expiresInSeconds);
|
||||
break;
|
||||
}
|
||||
case WX_CARD: {
|
||||
wxOpenConfigStorage.updateCardApiTicket(appId, ticket, expiresInSeconds);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -383,9 +442,6 @@ public class WxOpenInMemoryConfigStorage implements WxOpenConfigStorage {
|
||||
wxOpenConfigStorage.expireJsapiTicket(appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡券api_ticket
|
||||
*/
|
||||
@Override
|
||||
public String getCardApiTicket() {
|
||||
return wxOpenConfigStorage.getCardApiTicket(appId);
|
||||
|
Reference in New Issue
Block a user