Procházet zdrojové kódy

refactor: modify method

master
Daniel Qian před 10 roky
rodič
revize
01cee5a3d9
4 změnil soubory, kde provedl 37 přidání a 2 odebrání
  1. +8
    -0
      weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java
  2. +4
    -0
      weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java
  3. +17
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java
  4. +8
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java

+ 8
- 0
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpService.java Zobrazit soubor

@@ -43,6 +43,14 @@ public interface WxCpService {
*/
public void userAuthenticated(String userId) throws WxErrorException;

/**
* 获取access_token, 不强制刷新access_token
* @see #getAccessToken(boolean)
* @return
* @throws WxErrorException
*/
public String getAccessToken() throws WxErrorException;

/**
* <pre>
* 获取access_token,本方法线程安全


+ 4
- 0
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/api/WxCpServiceImpl.java Zobrazit soubor

@@ -71,6 +71,10 @@ public class WxCpServiceImpl implements WxCpService {
execute(new SimpleGetRequestExecutor(), url, null);
}

public String getAccessToken() throws WxErrorException {
return getAccessToken(false);
}

public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {
wxCpConfigStorage.expireAccessToken();


+ 17
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpService.java Zobrazit soubor

@@ -28,7 +28,15 @@ public interface WxMpService {
* @return
*/
public boolean checkSignature(String timestamp, String nonce, String signature);

/**
* 获取access_token, 不强制刷新access_token
* @see #getAccessToken(boolean)
* @return
* @throws WxErrorException
*/
public String getAccessToken() throws WxErrorException;

/**
* <pre>
* 获取access_token,本方法线程安全
@@ -46,6 +54,14 @@ public interface WxMpService {
*/
public String getAccessToken(boolean forceRefresh) throws WxErrorException;

/**
* 获得jsapi_ticket,不强制刷新jsapi_ticket
* @see #getJsapiTicket(boolean)
* @return
* @throws WxErrorException
*/
public String getJsapiTicket() throws WxErrorException;

/**
* <pre>
* 获得jsapi_ticket


+ 8
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpServiceImpl.java Zobrazit soubor

@@ -68,7 +68,11 @@ public class WxMpServiceImpl implements WxMpService {
return false;
}
}

public String getAccessToken() throws WxErrorException {
return getAccessToken(false);
}

public String getAccessToken(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {
wxMpConfigStorage.expireAccessToken();
@@ -106,6 +110,9 @@ public class WxMpServiceImpl implements WxMpService {
return wxMpConfigStorage.getAccessToken();
}

public String getJsapiTicket() throws WxErrorException {
return getJsapiTicket(false);
}

public String getJsapiTicket(boolean forceRefresh) throws WxErrorException {
if (forceRefresh) {


Načítá se…
Zrušit
Uložit