Skip to content

Commit 6a76a79

Browse files
Copilotbinarywang
andcommitted
修复单元测试注释中的代码示例,增加变量来源说明
Co-authored-by: binarywang <[email protected]>
1 parent dccb214 commit 6a76a79

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImplTest.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,14 +387,19 @@ public void testSubmitAuditWithQuotaCheck() {
387387
@Test
388388
public void testBatchSubmitAuditWithQuotaManagement() {
389389
// 此测试方法演示批量提交审核时的额度管理策略
390-
// 注意:实际运行需要真实的微信 API 凭据
390+
// 注意:实际运行需要真实的微信 API 凭据,以及 WxOpenComponentService 实例
391391
/*
392+
// 假设已经初始化了 wxOpenComponentService
393+
// WxOpenComponentService wxOpenComponentService = ...;
394+
392395
try {
393396
// 假设需要为多个小程序提交审核
394397
List<String> appIds = Arrays.asList("appid1", "appid2", "appid3");
395398
396-
// 步骤1:检查总体额度是否充足
397-
WxOpenMaQueryQuotaResult quota = wxOpenComponentService.queryQuota();
399+
// 步骤1:通过任意一个小程序服务查询总体额度
400+
// 注意:审核额度是第三方平台级别的,所有授权小程序共享
401+
WxOpenMaService firstMaService = wxOpenComponentService.getWxMaServiceByAppid(appIds.get(0));
402+
WxOpenMaQueryQuotaResult quota = firstMaService.queryQuota();
398403
System.out.println("当前剩余审核额度: " + quota.getRest());
399404
400405
if (quota.getRest() < appIds.size()) {
@@ -429,7 +434,7 @@ public void testBatchSubmitAuditWithQuotaManagement() {
429434
System.out.println(" 失败: " + (appIds.size() - successCount));
430435
431436
// 步骤4:查询剩余额度
432-
quota = wxOpenComponentService.queryQuota();
437+
quota = firstMaService.queryQuota();
433438
System.out.println(" 剩余额度: " + quota.getRest());
434439
435440
} catch (Exception e) {

0 commit comments

Comments
 (0)