-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Fix WeChat League API URL patterns to resolve error 48001 #3651
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,21 +372,21 @@ public interface League { | |
/** 添加团长商品到橱窗 */ | ||
String ADD_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/add"; | ||
/** 查询橱窗上团长商品列表 */ | ||
String LIST_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/getall"; | ||
String LIST_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/list/get"; | ||
/** 从橱窗移除团长商品 */ | ||
String REMOVE_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/remove"; | ||
/** 查询橱窗上团长商品详情 */ | ||
String GET_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/getdetail"; | ||
String GET_SUPPLIER_GOODS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/window/get"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** 获取达人橱窗授权链接 */ | ||
String GET_SUPPLIER_AUTH_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/windowauth/get"; | ||
/** 获取达人橱窗授权状态 */ | ||
String GET_SUPPLIER_AUTH_STATUS_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/windowauth/status/get"; | ||
/** 获取团长账户余额 */ | ||
String GET_SUPPLIER_BALANCE_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/balance/get"; | ||
/** 获取资金流水详情 */ | ||
String GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flowdetail/get"; | ||
String GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flow/detail/get"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** 获取资金流水列表 */ | ||
String GET_SUPPLIER_BALANCE_FLOW_LIST_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flowlist/get"; | ||
String GET_SUPPLIER_BALANCE_FLOW_LIST_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/funds/flow/list/get"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
/** 获取合作商品详情 */ | ||
String GET_SUPPLIER_ITEM_URL = "https://api.weixin.qq.com/channels/ec/league/headsupplier/item/get"; | ||
/** 获取合作商品列表 */ | ||
|
98 changes: 98 additions & 0 deletions
98
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/test/LeagueUrlPatternTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package me.chanjar.weixin.channel.test; | ||
|
||
import me.chanjar.weixin.channel.constant.WxChannelApiUrlConstants.League; | ||
import org.testng.Assert; | ||
import org.testng.annotations.Test; | ||
|
||
/** | ||
* WeChat League API URL Pattern Validation Test | ||
* | ||
* This test verifies that all League API URLs follow consistent patterns | ||
* to avoid the 48001 error (no interface permission) mentioned in issue #3630. | ||
*/ | ||
public class LeagueUrlPatternTest { | ||
|
||
@Test | ||
public void testWindowUrlPatternsAreConsistent() { | ||
// Verify that window-related URLs follow consistent patterns | ||
String listUrl = League.LIST_SUPPLIER_GOODS_URL; | ||
String detailUrl = League.GET_SUPPLIER_GOODS_URL; | ||
|
||
// List URLs should end with /list/get | ||
Assert.assertTrue(listUrl.endsWith("/list/get"), | ||
"LIST_SUPPLIER_GOODS_URL should end with /list/get for consistency"); | ||
|
||
// Detail/Get URLs should end with /get (but not /list/get) | ||
Assert.assertTrue(detailUrl.endsWith("/get"), | ||
"GET_SUPPLIER_GOODS_URL should end with /get"); | ||
Assert.assertFalse(detailUrl.contains("getdetail"), | ||
"GET_SUPPLIER_GOODS_URL should not contain 'getdetail' pattern"); | ||
} | ||
|
||
@Test | ||
public void testFlowUrlPatternsAreConsistent() { | ||
// Verify that flow-related URLs follow the same pattern as other list/detail URLs | ||
String flowDetailUrl = League.GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL; | ||
String flowListUrl = League.GET_SUPPLIER_BALANCE_FLOW_LIST_URL; | ||
|
||
// Flow detail URL should follow proper pattern | ||
Assert.assertTrue(flowDetailUrl.contains("/flow/detail/get"), | ||
"Flow detail URL should use '/flow/detail/get' pattern"); | ||
Assert.assertFalse(flowDetailUrl.contains("flowdetail"), | ||
"Flow detail URL should not use 'flowdetail' pattern"); | ||
|
||
// Flow list URL should follow proper pattern | ||
Assert.assertTrue(flowListUrl.contains("/flow/list/get"), | ||
"Flow list URL should use '/flow/list/get' pattern"); | ||
Assert.assertFalse(flowListUrl.contains("flowlist"), | ||
"Flow list URL should not use 'flowlist' pattern"); | ||
} | ||
|
||
@Test | ||
public void testAllUrlsHaveCorrectBasePattern() { | ||
// Verify all supplier URLs start with the correct base path | ||
String expectedBase = "https://api.weixin.qq.com/channels/ec/league/headsupplier/"; | ||
|
||
String[] supplierUrls = { | ||
League.ADD_SUPPLIER_GOODS_URL, | ||
League.LIST_SUPPLIER_GOODS_URL, | ||
League.REMOVE_SUPPLIER_GOODS_URL, | ||
League.GET_SUPPLIER_GOODS_URL, | ||
League.GET_SUPPLIER_AUTH_URL, | ||
League.GET_SUPPLIER_AUTH_STATUS_URL, | ||
League.GET_SUPPLIER_BALANCE_URL, | ||
League.GET_SUPPLIER_BALANCE_FLOW_DETAIL_URL, | ||
League.GET_SUPPLIER_BALANCE_FLOW_LIST_URL, | ||
League.GET_SUPPLIER_ITEM_URL, | ||
League.GET_SUPPLIER_ITEM_LIST_URL, | ||
League.GET_SUPPLIER_ORDER_URL, | ||
League.GET_SUPPLIER_ORDER_LIST_URL, // This was the working URL mentioned in the issue | ||
League.GET_SUPPLIER_SHOP_URL, | ||
League.GET_SUPPLIER_SHOP_LIST_URL | ||
}; | ||
|
||
for (String url : supplierUrls) { | ||
Assert.assertTrue(url.startsWith(expectedBase), | ||
"URL " + url + " should start with " + expectedBase); | ||
} | ||
} | ||
|
||
@Test | ||
public void testWorkingUrlPatternIsFollowed() { | ||
// The issue mentioned that GET_SUPPLIER_ORDER_LIST_URL works correctly | ||
// All similar URLs should follow the same pattern | ||
String workingUrl = League.GET_SUPPLIER_ORDER_LIST_URL; | ||
String workingPattern = "/order/list/get"; | ||
|
||
Assert.assertTrue(workingUrl.endsWith(workingPattern), | ||
"Working URL should end with " + workingPattern); | ||
|
||
// Other list URLs should follow the same pattern | ||
Assert.assertTrue(League.LIST_SUPPLIER_GOODS_URL.endsWith("/list/get"), | ||
"LIST_SUPPLIER_GOODS_URL should follow the same pattern as working URL"); | ||
Assert.assertTrue(League.GET_SUPPLIER_ITEM_LIST_URL.endsWith("/list/get"), | ||
"GET_SUPPLIER_ITEM_LIST_URL should follow the same pattern as working URL"); | ||
Assert.assertTrue(League.GET_SUPPLIER_SHOP_LIST_URL.endsWith("/list/get"), | ||
"GET_SUPPLIER_SHOP_LIST_URL should follow the same pattern as working URL"); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://developers.weixin.qq.com/doc/store/leagueheadsupplier/api/opentalent/window/api_getallwindow.html 文档在这里,请确认你的修改