Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加会话存档secret配置 #2853

Merged
merged 1 commit into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ public WxCpChatDatas getChatDatas(long seq, @NonNull long limit, String proxy, S

Finance.loadingLibraries(osLib, prefixPath);
long sdk = Finance.NewSdk();

long ret = Finance.Init(sdk, cpService.getWxCpConfigStorage().getCorpId(),
cpService.getWxCpConfigStorage().getCorpSecret());
//因为会话存档单独有个secret,优先使用会话存档的secret
String msgAuditSecret = cpService.getWxCpConfigStorage().getMsgAuditSecret();
if(StringUtils.isEmpty(msgAuditSecret)) {
msgAuditSecret = cpService.getWxCpConfigStorage().getCorpSecret();
}
long ret = Finance.Init(sdk, cpService.getWxCpConfigStorage().getCorpId(),msgAuditSecret);
if (ret != 0) {
Finance.DestroySdk(sdk);
throw new WxErrorException("init sdk err ret " + ret);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,10 @@ public interface WxCpConfigStorage {
* @return key webhook key
*/
String getWebhookKey();

/**
* 获取会话存档的secret
* @return msg audit secret
*/
String getMsgAuditSecret();
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public class WxCpDefaultConfigImpl implements WxCpConfigStorage, Serializable {
/**
* 会话存档私钥以及sdk路径
*/
private volatile String msgAuditSecret;
private volatile String msgAuditPriKey;
private volatile String msgAuditLibPath;
private volatile String oauth2redirectUri;
Expand Down Expand Up @@ -435,4 +436,18 @@ public WxCpDefaultConfigImpl setWebhookKey(String webhookKey) {
this.webhookKey = webhookKey;
return this;
}

@Override
public String getMsgAuditSecret() {
return this.msgAuditSecret;
}

/**
* 设置会话存档secret
* @param msgAuditSecret
*/
public WxCpDefaultConfigImpl setMsgAuditSecret(String msgAuditSecret) {
this.msgAuditSecret = msgAuditSecret;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -466,4 +466,8 @@ public String getWebhookKey() {
return this.getWebhookKey();
}

@Override
public String getMsgAuditSecret() {
return null;
}
}