mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-04 04:37:46 +08:00
🎨 #2853 【企业微信】配置类中增加会话存档secret的配置项
This commit is contained in:
parent
512975fb86
commit
48a22a0e60
@ -78,9 +78,12 @@ public class WxCpMsgAuditServiceImpl implements WxCpMsgAuditService {
|
|||||||
|
|
||||||
Finance.loadingLibraries(osLib, prefixPath);
|
Finance.loadingLibraries(osLib, prefixPath);
|
||||||
long sdk = Finance.NewSdk();
|
long sdk = Finance.NewSdk();
|
||||||
|
//因为会话存档单独有个secret,优先使用会话存档的secret
|
||||||
long ret = Finance.Init(sdk, cpService.getWxCpConfigStorage().getCorpId(),
|
String msgAuditSecret = cpService.getWxCpConfigStorage().getMsgAuditSecret();
|
||||||
cpService.getWxCpConfigStorage().getCorpSecret());
|
if(StringUtils.isEmpty(msgAuditSecret)) {
|
||||||
|
msgAuditSecret = cpService.getWxCpConfigStorage().getCorpSecret();
|
||||||
|
}
|
||||||
|
long ret = Finance.Init(sdk, cpService.getWxCpConfigStorage().getCorpId(),msgAuditSecret);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
Finance.DestroySdk(sdk);
|
Finance.DestroySdk(sdk);
|
||||||
throw new WxErrorException("init sdk err ret " + ret);
|
throw new WxErrorException("init sdk err ret " + ret);
|
||||||
|
@ -257,4 +257,10 @@ public interface WxCpConfigStorage {
|
|||||||
* @return key webhook key
|
* @return key webhook key
|
||||||
*/
|
*/
|
||||||
String getWebhookKey();
|
String getWebhookKey();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取会话存档的secret
|
||||||
|
* @return msg audit secret
|
||||||
|
*/
|
||||||
|
String getMsgAuditSecret();
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,7 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
|
|||||||
/**
|
/**
|
||||||
* 会话存档私钥以及sdk路径
|
* 会话存档私钥以及sdk路径
|
||||||
*/
|
*/
|
||||||
|
private volatile String msgAuditSecret;
|
||||||
private volatile String msgAuditPriKey;
|
private volatile String msgAuditPriKey;
|
||||||
private volatile String msgAuditLibPath;
|
private volatile String msgAuditLibPath;
|
||||||
private volatile String oauth2redirectUri;
|
private volatile String oauth2redirectUri;
|
||||||
@ -435,4 +436,18 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
|
|||||||
this.webhookKey = webhookKey;
|
this.webhookKey = webhookKey;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMsgAuditSecret() {
|
||||||
|
return this.msgAuditSecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置会话存档secret
|
||||||
|
* @param msgAuditSecret
|
||||||
|
*/
|
||||||
|
public WxCpDefaultConfigImpl setMsgAuditSecret(String msgAuditSecret) {
|
||||||
|
this.msgAuditSecret = msgAuditSecret;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -466,4 +466,8 @@ public class WxCpRedisConfigImpl implements WxCpConfigStorage {
|
|||||||
return this.getWebhookKey();
|
return this.getWebhookKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMsgAuditSecret() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user