repo
stringclasses
1k values
file_url
stringlengths
96
373
file_path
stringlengths
11
294
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
6 values
commit_sha
stringclasses
1k values
retrieved_at
stringdate
2026-01-04 14:45:56
2026-01-04 18:30:23
truncated
bool
2 classes
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSchemeServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSchemeServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.scheme.WxMaGenerateNfcSchemeRequest; import cn.binarywang.wx.miniapp.bean.scheme.WxMaGenerateSchemeRequest; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.time.DateUtils; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.Date; /** * @author : cofedream * created on : 2021-01-28 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaSchemeServiceImplTest { @Inject private WxMaService wxService; @Test public void testGenerate() throws WxErrorException { final Date date = DateUtils.addMinutes(new Date(), 20); // 20分钟后失效 final long expireTime = date.getTime() / 1000; final String generate = this.wxService.getWxMaSchemeService().generate(WxMaGenerateSchemeRequest.newBuilder() .jumpWxa(WxMaGenerateSchemeRequest.JumpWxa.newBuilder() // .path("/pages/productView/editPhone/editPhone") // 都可以 .path("pages/productView/editPhone/editPhone") // .query("") .build()) .isExpire(true) // 到期失效 .expireTime(expireTime) // 失效时间 .build()); System.out.println("generate:"); System.out.println(generate); } @Test public void testGenerateNfc() throws WxErrorException { final Date date = DateUtils.addMinutes(new Date(), 20); // 20分钟后失效 final long expireTime = date.getTime() / 1000; final String generate = this.wxService.getWxMaSchemeService().generateNFC(WxMaGenerateNfcSchemeRequest.newBuilder() .jumpWxa(WxMaGenerateNfcSchemeRequest.JumpWxa.newBuilder() // .path("/pages/productView/editPhone/editPhone") // 都可以 .path("pages/productView/editPhone/editPhone") // .query("") .build()) .modelId("") // 到期失效 .sn("") // 失效时间 .build()); System.out.println("generate:"); System.out.println(generate); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaCodeServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaCodeServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaCodeService; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.code.*; import cn.binarywang.wx.miniapp.config.WxMaConfig; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 20:18 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaCodeServiceImplTest { @Inject private WxMaService wxService; @Inject private WxMaConfig wxMaConfig; @Test public void testGetCategory() throws Exception { List<WxMaCodeSubmitAuditItem> categories = wxService.getCodeService().getCategory(); System.out.println(String.valueOf(categories)); } @Test public void testCommit() throws Exception { String themeColor = "#0074d9"; String themeFontColor = "#ffffff"; Map<String, Object> ext = new HashMap<>(); ext.put("appName", "xxx"); ext.put("verified", true); ext.put("navigationBarBackgroundColor", themeColor); ext.put("navigationBarTextStyle", themeFontColor); ext.put("companyId", 4128); ext.put("companyFullName", "xxx有限公司"); WxMaCodeService wxMaCodeService = wxService.getCodeService(); WxMaCodeCommitRequest commitRequest = WxMaCodeCommitRequest .builder() .templateId(6L) .userVersion("v0.1.0") .userDesc("init") .extConfig(WxMaCodeExtConfig.builder() .extAppid(wxMaConfig.getAppid()) .extEnable(true) .ext(ext) .window( WxMaCodeExtConfig.PageConfig .builder() .navigationBarBackgroundColor(themeColor) .navigationBarTextStyle(themeFontColor) .build() ) .build()) .build(); wxMaCodeService.commit(commitRequest); } @Test public void testGetQrCode() throws Exception { byte[] qrCode = wxService.getCodeService().getQrCode(null); assertTrue(qrCode.length > 0); } @Test public void testGetPage() throws Exception { List<String> pageList = wxService.getCodeService().getPage(); System.out.println(String.valueOf(pageList)); } @Test public void testSubmitAudit() throws Exception { WxMaCodeSubmitAuditRequest auditRequest = WxMaCodeSubmitAuditRequest .builder() .itemList(Arrays.asList( WxMaCodeSubmitAuditItem .builder() .address("pages/logs/logs") .tag("工具 效率") .firstClass("工具") .firstId(287L) .secondClass("效率") .secondId(616L) .title("日志") .build() )).build(); long auditId = wxService.getCodeService().submitAudit(auditRequest); assertTrue(auditId > 0); // 421937937 System.out.println(auditId); } @Test public void testGetAuditStatus() throws Exception { WxMaCodeAuditStatus auditStatus = wxService.getCodeService().getAuditStatus(421937937L); System.out.println(auditStatus); assertNotNull(auditStatus); } @Test public void testGetLatestAuditStatus() throws Exception { WxMaCodeAuditStatus auditStatus = wxService.getCodeService().getLatestAuditStatus(); System.out.println(auditStatus); assertNotNull(auditStatus); } @Test public void testRelease() throws Exception { wxService.getCodeService().release(); } @Test public void testChangeVisitStatus() throws Exception { wxService.getCodeService().changeVisitStatus("open"); } @Test public void testRevertCodeRelease() throws Exception { wxService.getCodeService().revertCodeRelease(); } @Test public void testGetSupportVersion() throws Exception { WxMaCodeVersionDistribution distribution = wxService.getCodeService().getSupportVersion(); System.out.println(distribution); } @Test public void testGetVersionInfo() throws Exception { WxMaCodeVersionInfo versionInfo = wxService.getCodeService().getVersionInfo(); System.out.println(versionInfo); } @Test public void testSetSupportVersion() throws Exception { wxService.getCodeService().setSupportVersion("1.2.0"); } @Test public void testUndoCodeAudit() throws Exception { } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAuditServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAuditServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAuditBrandRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAuditCategoryRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditBrandResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditCategoryResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditResultResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.gson.JsonObject; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; import static org.assertj.core.api.Assertions.assertThat; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopAuditServiceImplTest { @Inject private WxMaService wxService; @Test public void testAuditBrand() throws WxErrorException { WxMaShopAuditBrandRequest request = WxMaShopAuditBrandRequest.builder().build(); WxMaShopAuditBrandRequest.AuditReqBean auditReqBean = WxMaShopAuditBrandRequest.AuditReqBean.builder().build(); auditReqBean.setLicense(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))); auditReqBean.setBrandInfo(WxMaShopAuditBrandRequest.AuditReqBean.BrandInfoBean.builder() .brandAuditType(1) .trademarkType("29") .brandManagementType(2) .commodityOriginType(2) .brandWording("346225226351203275") .saleAuthorization(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkRegistrationCertificate(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkChangeCertificate(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkRegistrant("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg") .trademarkRegistrantNu("1249305") .trademarkAuthorizationPeriod("2020-03-25 12:05:25") .trademarkRegistrationApplication(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .trademarkApplicant("张三") .trademarkApplicationTime("2020-03-25 12:05:25") .importedGoodsForm(new ArrayList<>(Arrays.asList("https://img.zhls.qq.com/3/609b98f7e0ff43d59ce6d9cca636c3e0.jpg"))) .build()); request.setAuditReq(auditReqBean); WxMaShopAuditBrandResponse response = wxService.getShopAuditService().auditBrand(request); assertThat(response).isNotNull(); } @Test public void testAuditCategory() throws WxErrorException { WxMaShopAuditCategoryRequest request = WxMaShopAuditCategoryRequest.builder().build(); WxMaShopAuditCategoryRequest.AuditReqBean auditReqBean = WxMaShopAuditCategoryRequest.AuditReqBean.builder().build(); auditReqBean.setLicense(new ArrayList<>(Arrays.asList("www.xxxxx.com"))); auditReqBean.setCategoryInfo(WxMaShopAuditCategoryRequest.AuditReqBean.CategoryInfoBean.builder() .level1(7419) .level2(7439) .level3(7448) .certificate(new ArrayList<>(Arrays.asList("www.xxxxx.com"))) .build()); request.setAuditReq(auditReqBean); WxMaShopAuditCategoryResponse response = wxService.getShopAuditService().auditCategory(request); assertThat(response).isNotNull(); } @Test public void testGetAuditResult() throws WxErrorException { WxMaShopAuditResultResponse response = wxService.getShopAuditService().getAuditResult("RQAAAHIOW-QGAAAAveAUYQ"); assertThat(response).isNotNull(); } @Test public void testGetMiniappCertificate1() throws WxErrorException { JsonObject response = wxService.getShopAuditService().getMiniappCertificate(1); assertThat(response).isNotNull(); } @Test public void testGetMiniappCertificate2() throws WxErrorException { JsonObject response = wxService.getShopAuditService().getMiniappCertificate(2); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.config.WxMaConfig; import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import lombok.SneakyThrows; import me.chanjar.weixin.common.bean.CommonUploadParam; import me.chanjar.weixin.common.bean.WxAccessTokenEntity; import me.chanjar.weixin.common.error.WxError; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxMpErrorMsgEnum; import me.chanjar.weixin.common.util.http.RequestExecutor; import org.apache.commons.lang3.StringUtils; import org.mockito.Mockito; import org.testng.Assert; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.concurrent.atomic.AtomicInteger; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertTrue; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaServiceImplTest { @Inject private WxMaService wxService; @Inject private WxMaServiceOkHttpImpl wxMaServiceOkHttp; public void testRefreshAccessToken() throws WxErrorException { WxMaConfig configStorage = this.wxService.getWxMaConfig(); String before = configStorage.getAccessToken(); this.wxService.getAccessToken(false); String after = configStorage.getAccessToken(); assertNotEquals(before, after); assertTrue(StringUtils.isNotBlank(after)); } private void updateAccessTokenBefore(WxAccessTokenEntity wxAccessTokenEntity) { System.out.println("token:" + wxAccessTokenEntity.toString()); } public void testTokenCallBack() throws WxErrorException { WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); WxMaConfig configStorage = this.wxService.getWxMaConfig(); config.setAppid(configStorage.getAppid()); config.setSecret(configStorage.getSecret()); // //第一种方式 // config.setUpdateAccessTokenBefore(e -> { // System.out.println("token:" + e.toString()); // }); //第二种方式 config.setUpdateAccessTokenBefore(this::updateAccessTokenBefore); this.wxService.setWxMaConfig(config); String before = config.getAccessToken(); this.wxService.getAccessToken(true); String after = config.getAccessToken(); assertNotEquals(before, after); assertTrue(StringUtils.isNotBlank(after)); config.enableUpdateAccessTokenBefore(false); this.wxService.getAccessToken(true); after = config.getAccessToken(); System.out.println(after); } public void testStableRefreshAccessToken() throws WxErrorException { WxMaConfig configStorage = this.wxMaServiceOkHttp.getWxMaConfig(); configStorage.useStableAccessToken(true); String before = configStorage.getAccessToken(); this.wxMaServiceOkHttp.getAccessToken(false); String after = configStorage.getAccessToken(); assertNotEquals(before, after); assertTrue(StringUtils.isNotBlank(after)); } @Test(expectedExceptions = {WxErrorException.class}) public void testGetPaidUnionId() throws WxErrorException { final String unionId = this.wxService.getPaidUnionId("1", null, "3", "4"); assertThat(unionId).isNotEmpty(); } @Test public void testPost() throws WxErrorException { final String postResult = this.wxService.post("https://api.weixin.qq.com/wxa/setdynamicdata", "{\n" + " \"data\": \"{\\\"items\\\": [{\\\"from\\\":{\\\"city_name_cn\\\":\\\"广州市\\\"},\\\"to\\\":{\\\"city_name_cn\\\":\\\"北京市\\\"}}], \\\"attribute\\\": {\\\"count\\\": 1, \\\"totalcount\\\": 100, \\\"id\\\": \\\"1\\\", \\\"seq\\\": 0}}\",\n" + " \"lifespan\": 86400,\n" + " \"query\": \"{\\\"type\\\":100005}\",\n" + " \"scene\": 1\n" + "}"); System.out.println(postResult); } @Test public void testGetRequestHttpClient() { } @Test public void testGetRequestHttpProxy() { } @Test public void testGetRequestType() { } @Test public void testInitHttp() { } @Test public void testGetRequestHttp() { } @Test public void testGetAccessToken() { } @Test public void testJsCode2SessionInfo() { } @Test public void testSetDynamicData() throws WxErrorException { this.wxService.setDynamicData(86400, "1000001", 1, "{\"items\":[{\"stock_name\":\"腾讯控股\", \"stock_code\":\"00700\", \"stock_market\":\"hk\"}], \"attribute\":{\"count\":2, \"totalcount\": 100, \"id\": \"XXX\", \"seq\": 0}}"); } @Test public void testCheckSignature() { } @Test public void testTestGetAccessToken() { } @Test public void testGet() { } @Test public void testExecute() { } @Test public void testExecuteAutoRefreshToken() throws WxErrorException, IOException { //测试access token获取时的重试机制 WxMaServiceImpl service = new WxMaServiceImpl() { @Override public String getAccessToken(boolean forceRefresh) throws WxErrorException { return "模拟一个过期的access token:" + System.currentTimeMillis(); } }; WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); config.setAppid("1"); service.setWxMaConfig(config); RequestExecutor<Object, Object> re = mock(RequestExecutor.class); AtomicInteger counter = new AtomicInteger(); Mockito.when(re.execute(Mockito.anyString(), Mockito.any(), Mockito.any())).thenAnswer((invocation) -> { counter.incrementAndGet(); WxError error = WxError.builder().errorCode(WxMpErrorMsgEnum.CODE_40001.getCode()).errorMsg(WxMpErrorMsgEnum.CODE_40001.getMsg()).build(); throw new WxErrorException(error); }); try { Object execute = service.execute(re, "http://baidu.com", new HashMap<>()); Assert.fail("代码应该不会执行到这里"); } catch (WxErrorException e) { Assert.assertEquals(WxMpErrorMsgEnum.CODE_40001.getCode(), e.getError().getErrorCode()); Assert.assertEquals(2, counter.get()); } } @SneakyThrows @Test public void upload() { CommonUploadParam param = CommonUploadParam.fromFile("media", new File("./static/1.jpg")); String result = wxService.upload("https://api.weixin.qq.com/wxa/sec/uploadauthmaterial", param); System.out.println(result); } @Test public void testGetWxMaConfig() { } @Test public void testSetWxMaConfig() { } @Test public void testSetRetrySleepMillis() { } @Test public void testSetMaxRetryTimes() { } @Test public void testGetMsgService() { } @Test public void testGetMediaService() { } @Test public void testGetUserService() { } @Test public void testGetQrcodeService() { } @Test public void testGetTemplateService() { } @Test public void testGetSubscribeService() { } @Test public void testGetAnalysisService() { } @Test public void testGetCodeService() { } @Test public void testGetJsapiService() { } @Test public void testGetSettingService() { } @Test public void testGetShareService() { } @Test public void testGetRunService() { } @Test public void testGetSecCheckService() { } @Test public void testGetPluginService() { } @Test public void testGetExpressService() { } @Test public void testGetCloudService() { } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaUserServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaUserServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.test.TestConfig; import com.google.common.collect.ImmutableMap; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; /** * 测试用户相关的接口 * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaUserServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetSessionKey() throws Exception { assertNotNull(this.wxService.getUserService().getSessionInfo("aaa")); } @Test public void testGetUserInfo() { WxMaUserInfo userInfo = this.wxService.getUserService().getUserInfo("tiihtNczf5v6AKRyjwEUhQ==", "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew==", "r7BXXKkLb8qrSNn05n0qiA=="); assertNotNull(userInfo); System.out.println(userInfo.toString()); } @Test public void testCheckUserInfo() { assertTrue(this.wxService.getUserService().checkUserInfo("HyVFkGl5F5OQWJZZaNzBBg==", "{\"nickName\":\"Band\",\"gender\":1,\"language\":\"zh_CN\",\"city\":\"Guangzhou\",\"province\":\"Guangdong\",\"country\":\"CN\",\"avatarUrl\":\"http://wx.qlogo.cn/mmopen/vi_32/1vZvI39NWFQ9XM4LtQpFrQJ1xlgZxx3w7bQxKARol6503Iuswjjn6nIGBiaycAjAtpujxyzYsrztuuICqIM5ibXQ/0\"}", "75e81ceda165f4ffa64f4068af58c64b8f54b88c")); } @Test public void testGetPhoneNoInfo() { WxMaPhoneNumberInfo phoneNoInfo = this.wxService.getUserService().getPhoneNoInfo("tiihtNczf5v6AKRyjwEUhQ==", "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew==", "r7BXXKkLb8qrSNn05n0qiA=="); assertNotNull(phoneNoInfo); System.out.println(phoneNoInfo.toString()); } @Test public void testGetPhoneInfo() throws WxErrorException { WxMaPhoneNumberInfo phoneNoInfo = this.wxService.getUserService().getPhoneNumber("tiihtNczf5v6AKRyjwEUhQ=="); assertNotNull(phoneNoInfo); System.out.println(phoneNoInfo.toString()); } @Test public void testGetSessionInfo() { } /** * TODO 测试数据有问题,需要替换为正确的数据 */ @Test public void testSetUserStorage() throws WxErrorException { this.wxService.getUserService().setUserStorage(ImmutableMap.of("1","2"), "r7BXXKkLb8qrSNn05n0qiA",((TestConfig)this.wxService.getWxMaConfig()).getOpenid()); } @Test public void testGetAccessToken() throws Exception{ assertNotNull(wxService.getAccessToken(true)); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShareServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShareServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaGroupEnterInfo; import cn.binarywang.wx.miniapp.bean.WxMaShareInfo; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.testng.Assert.assertNotNull; /** * 测试分享相关的接口 * * @author zhfish */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShareServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetSessionKey() throws Exception { assertNotNull(this.wxService.getUserService().getSessionInfo("aaa")); } /** * TODO 测试数据有问题,需要替换为正确的数据 */ @Test public void testGetShareInfo() { WxMaShareInfo shareInfo = this.wxService.getShareService().getShareInfo("tiihtNczf5v6AKRyjwEUhQ==", "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew==", "r7BXXKkLb8qrSNn05n0qiA=="); assertNotNull(shareInfo); System.out.println(shareInfo.toString()); } /** * TODO 测试数据有问题,需要替换为正确的数据 */ @Test public void testGetGroupEnterInfo() { WxMaGroupEnterInfo groupEnterInfo = this.wxService.getShareService().getGroupEnterInfo("tiihtNczf5v6AKRyjwEUhQ==", "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew==", "r7BXXKkLb8qrSNn05n0qiA=="); assertNotNull(groupEnterInfo); System.out.println(groupEnterInfo.toString()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.live.WxMaCreateRoomResult; import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo; import cn.binarywang.wx.miniapp.bean.live.WxMaLiveSharedCode; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import java.util.Arrays; import java.util.Calendar; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertNotNull; /** * 测试直播相关的接口 * * @author <a href="https://github.com/yjwang3300300">yjwang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaLiveServiceImplTest { @Inject private WxMaService wxService; @Test public void createRoom() throws Exception { //上传临时素材 WxMediaUploadResult mediaUpload = this.wxService.getMediaService().uploadMedia("image", new File("E:\\1.png")); WxMaLiveRoomInfo roomInfo = new WxMaLiveRoomInfo(); roomInfo.setName("订阅通知直播间"); roomInfo.setCoverImg(mediaUpload.getMediaId()); Calendar c = Calendar.getInstance(); c.set(2023, Calendar.FEBRUARY, 10, 8, 0); roomInfo.setStartTime(c.getTimeInMillis() / 1000); c.set(2023, Calendar.FEBRUARY, 10, 12, 0); roomInfo.setEndTime(c.getTimeInMillis() / 1000); roomInfo.setAnchorName("鹏军_专业小程序开发"); roomInfo.setAnchorWechat("pengjun939961241"); roomInfo.setShareImg(mediaUpload.getMediaId()); roomInfo.setFeedsImg(mediaUpload.getMediaId()); roomInfo.setType(1); roomInfo.setScreenType(1); roomInfo.setCloseLike(0); roomInfo.setCloseGoods(0); roomInfo.setCloseComment(0); WxMaCreateRoomResult result = this.wxService.getLiveService().createRoom(roomInfo); assertNotNull(result); assertThat(result.getRoomId()).isNotNull(); } @Test public void deletRoom() throws Exception { this.wxService.getLiveService().deleteRoom(29); } @Test public void editRoom() throws Exception { //上传临时素材 // WxMediaUploadResult mediaUpload = this.wxService.getMediaService().uploadMedia("image", new File("E:\\1.png")); WxMaLiveRoomInfo roomInfo = new WxMaLiveRoomInfo(); roomInfo.setId(39); roomInfo.setName("修改订阅通知直播间"); roomInfo.setCoverImg("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuBLBYlP2FjpIL2AHoiayH8HXeZRibtXDMesHn5aevEaM4etUVwfnX1HHqrXBDY3KPgT8MIlqbtqX8Q/0"); Calendar c = Calendar.getInstance(); c.set(2021, Calendar.SEPTEMBER, 10, 8, 0); roomInfo.setStartTime(c.getTimeInMillis() / 1000); c.set(2021, Calendar.SEPTEMBER, 10, 12, 0); roomInfo.setEndTime(c.getTimeInMillis() / 1000); roomInfo.setAnchorName("鹏军_专业小程序开发"); roomInfo.setAnchorWechat("pengjun939961241"); roomInfo.setShareImg("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuBLBYlP2FjpIL2AHoiayH8HXeZRibtXDMesHn5aevEaM4etUVwfnX1HHqrXBDY3KPgT8MIlqbtqX8Q/0"); roomInfo.setType(1); roomInfo.setScreenType(1); roomInfo.setCloseLike(0); roomInfo.setCloseGoods(0); roomInfo.setCloseComment(0); boolean editRoom = this.wxService.getLiveService().editRoom(roomInfo); System.out.println(editRoom); } @Test public void getPushUrl() throws Exception { String result = this.wxService.getLiveService().getPushUrl(39); System.out.println(result); } @Test public void getSharedCode() throws Exception { WxMaLiveSharedCode result = this.wxService.getLiveService().getSharedCode(39, null); System.out.println(result); } @Test public void getLiveInfo() throws Exception { WxMaLiveResult list = this.wxService.getLiveService().getLiveInfo(0, 10); assertNotNull(list); System.out.println(list.toString()); } @Test public void getLiveReplay() throws Exception { // [12, 11, 10, 9, 8, 7, 6, 5, 3, 2] WxMaLiveResult list = this.wxService.getLiveService().getLiveReplay(3, 0, 10); assertNotNull(list); System.out.println(list.toString()); } @Test public void getLiveinfos() throws Exception { List<WxMaLiveResult.RoomInfo> list = this.wxService.getLiveService().getLiveInfos(); assertNotNull(list); System.out.println(list.toString()); } @Test public void addGoodsToRoom() throws Exception { boolean result = this.wxService.getLiveService().addGoodsToRoom(5, Arrays.asList(8, 7, 5, 4, 10)); System.out.println(result); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSettingServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSettingServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaDomainAction; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.testng.Assert.assertNotNull; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-27 15:38 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaSettingServiceImplTest { @Inject private WxMaService wxService; @Test public void testModifyDomain() throws Exception { WxMaDomainAction domainAction = wxService.getSettingService().modifyDomain(WxMaDomainAction .builder() .action("get") .build()); System.out.println(domainAction); assertNotNull(domainAction); domainAction.setAction("set"); WxMaDomainAction result = wxService.getSettingService().modifyDomain(domainAction); System.out.println(result); } @Test public void testBindTester() throws Exception { wxService.getSettingService().bindTester("WeChatId"); } @Test public void testUnbindTester() throws Exception { wxService.getSettingService().unbindTester("WeChatId"); } @Test public void testSetWebViewDomain() throws Exception { WxMaDomainAction domainAction = wxService.getSettingService().setWebViewDomain(WxMaDomainAction .builder() .action("get") .build()); System.out.println(domainAction); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCatServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopCatServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCatGetResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopCatServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetCat() throws WxErrorException { WxMaShopCatGetResponse response = this.wxService.getShopCatService().getCat(); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaAnalysisServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaAnalysisServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaAnalysisService; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.analysis.WxMaRetainInfo; import cn.binarywang.wx.miniapp.bean.analysis.WxMaSummaryTrend; import cn.binarywang.wx.miniapp.bean.analysis.WxMaUserPortrait; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitDistribution; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitPage; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitTrend; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.Calendar; import java.util.Date; import java.util.List; import static org.testng.Assert.*; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ @Guice(modules = ApiTestModule.class) public class WxMaAnalysisServiceImplTest { @Inject private WxMaService wxMaService; @Test public void testGetDailySummaryTrend() throws Exception { final WxMaAnalysisService service = wxMaService.getAnalysisService(); Date twoDaysAgo = DateUtils.addDays(new Date(), -2); List<WxMaSummaryTrend> trends = service.getDailySummaryTrend(twoDaysAgo, twoDaysAgo); assertEquals(1, trends.size()); System.out.println(trends); } @Test public void testGetDailyVisitTrend() throws Exception { final WxMaAnalysisService service = wxMaService.getAnalysisService(); Date twoDaysAgo = DateUtils.addDays(new Date(), -2); List<WxMaVisitTrend> trends = service.getDailyVisitTrend(twoDaysAgo, twoDaysAgo); assertEquals(1, trends.size()); System.out.println(trends); } @Test public void testGetWeeklyVisitTrend() throws Exception { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); Date now = new Date(); Date lastSunday = calendar.getTime(); if (DateUtils.isSameDay(lastSunday, now)) { lastSunday = DateUtils.addDays(lastSunday, -7); } Date lastMonday = DateUtils.addDays(lastSunday, -6); final WxMaAnalysisService service = wxMaService.getAnalysisService(); List<WxMaVisitTrend> trends = service.getWeeklyVisitTrend(lastMonday, lastSunday); assertEquals(1, trends.size()); System.out.println(trends); } @Test public void testGetMonthlyVisitTrend() throws Exception { Date now = new Date(); Date firstDayOfThisMonth = DateUtils.setDays(now, 1); Date lastDayOfLastMonth = DateUtils.addDays(firstDayOfThisMonth, -1); Date firstDayOfLastMonth = DateUtils.addMonths(firstDayOfThisMonth, -1); final WxMaAnalysisService service = wxMaService.getAnalysisService(); List<WxMaVisitTrend> trends = service.getMonthlyVisitTrend(firstDayOfLastMonth, lastDayOfLastMonth); assertEquals(1, trends.size()); System.out.println(trends); } @Test public void testGetVisitDistribution() throws Exception { final WxMaAnalysisService service = wxMaService.getAnalysisService(); Date twoDaysAgo = DateUtils.addDays(new Date(), -2); WxMaVisitDistribution distribution = service.getVisitDistribution(twoDaysAgo, twoDaysAgo); assertNotNull(distribution); String date = DateFormatUtils.format(twoDaysAgo, "yyyyMMdd"); assertEquals(date, distribution.getRefDate()); assertTrue(distribution.getList().containsKey("access_source_session_cnt")); assertTrue(distribution.getList().containsKey("access_staytime_info")); assertTrue(distribution.getList().containsKey("access_depth_info")); System.out.println(distribution); } @Test public void testGetDailyRetainInfo() throws Exception { final WxMaAnalysisService service = wxMaService.getAnalysisService(); Date twoDaysAgo = DateUtils.addDays(new Date(), -2); WxMaRetainInfo retainInfo = service.getDailyRetainInfo(twoDaysAgo, twoDaysAgo); assertNotNull(retainInfo); System.out.println(retainInfo); } @Test public void testGetWeeklyRetainInfo() throws Exception { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); Date now = new Date(); Date lastSunday = calendar.getTime(); if (DateUtils.isSameDay(lastSunday, now)) { lastSunday = DateUtils.addDays(lastSunday, -7); } Date lastMonday = DateUtils.addDays(lastSunday, -6); final WxMaAnalysisService service = wxMaService.getAnalysisService(); WxMaRetainInfo retainInfo = service.getWeeklyRetainInfo(lastMonday, lastSunday); assertNotNull(retainInfo); System.out.println(retainInfo); } @Test public void testGetMonthlyRetainInfo() throws Exception { Date now = new Date(); Date firstDayOfThisMonth = DateUtils.setDays(now, 1); Date lastDayOfLastMonth = DateUtils.addDays(firstDayOfThisMonth, -1); Date firstDayOfLastMonth = DateUtils.addMonths(firstDayOfThisMonth, -1); final WxMaAnalysisService service = wxMaService.getAnalysisService(); WxMaRetainInfo retainInfo = service.getMonthlyRetainInfo(firstDayOfLastMonth, lastDayOfLastMonth); assertNotNull(retainInfo); System.out.println(retainInfo); } @Test public void testGetVisitPage() throws Exception { final WxMaAnalysisService service = wxMaService.getAnalysisService(); Date twoDaysAgo = DateUtils.addDays(new Date(), -2); List<WxMaVisitPage> visitPages = service.getVisitPage(twoDaysAgo, twoDaysAgo); assertNotNull(visitPages); System.out.println(visitPages); System.out.println(visitPages.get(0).getPagePath()); System.out.println(visitPages.get(0).getPageVisitPv()); } @Test public void testGetUserPortrait() throws Exception { Date twoDaysAgo = DateUtils.addDays(new Date(), -2); Date eightDaysAgo = DateUtils.addDays(new Date(), -8); final WxMaAnalysisService service = wxMaService.getAnalysisService(); WxMaUserPortrait portrait = service.getUserPortrait(eightDaysAgo, twoDaysAgo); assertNotNull(portrait); System.out.println(portrait); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaExpressServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaExpressServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaExpressService; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.express.*; import cn.binarywang.wx.miniapp.bean.express.request.*; import cn.binarywang.wx.miniapp.bean.express.result.WxMaExpressOrderInfoResult; import cn.binarywang.wx.miniapp.constant.WxMaConstants; import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.apache.commons.lang3.StringUtils; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; @Guice(modules = ApiTestModule.class) public class WxMaExpressServiceImplTest { @Inject private WxMaService wxMaService; @Test public void testGetAllDelivery() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); List<WxMaExpressDelivery> list = service.getAllDelivery(); System.out.println(WxMaGsonBuilder.create().toJson(list)); } @Test public void testGetAllAccount() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); List<WxMaExpressAccount> list = service.getAllAccount(); System.out.println(WxMaGsonBuilder.create().toJson(list)); } @Test public void testBindAccount() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressBindAccountRequest request = WxMaExpressBindAccountRequest.builder() .deliveryId("YUNDA") .bizId("******") .password("*********") .remarkContent("####") .type(WxMaConstants.BindAccountType.BIND) .build(); service.bindAccount(request); } @Test public void testGetQuota() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressBindAccountRequest request = WxMaExpressBindAccountRequest.builder() .deliveryId("YUNDA") .bizId("******") .build(); Integer quotaNum = service.getQuota(request); System.out.println(quotaNum); } @Test public void testUpdatePrinter() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressPrinterUpdateRequest request = WxMaExpressPrinterUpdateRequest.builder() .openid("*************") .updateType(WxMaConstants.BindAccountType.UNBIND) .build(); service.updatePrinter(request); } @Test public void testGetPrinter() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressPrinter printer = service.getPrinter(); System.out.println(WxMaGsonBuilder.create().toJson(printer)); } @Test public void testAddOrder() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressOrderPerson sender = new WxMaExpressOrderPerson(); sender.setName("张三"); sender.setMobile("177****9809"); sender.setProvince("北京市"); sender.setCity("朝阳区"); sender.setArea("朝阳区"); sender.setAddress("西坝河****C-102"); WxMaExpressOrderPerson receiver = new WxMaExpressOrderPerson(); receiver.setName("李四"); receiver.setMobile("180****8772"); receiver.setProvince("北京市"); receiver.setCity("朝阳区"); receiver.setArea("朝阳区"); receiver.setAddress("西坝河北里****101"); WxMaExpressOrderCargo cargo = new WxMaExpressOrderCargo(); List<WxMaExpressOrderCargoDetail> detailList = new ArrayList<>(); List<String> shopNames = new ArrayList<>(); Integer goodsCount = 0; for (int i = 0; i < 4; i++) { WxMaExpressOrderCargoDetail detail = new WxMaExpressOrderCargoDetail(); String shopName = "商品_"+i; detail.setName(shopName); detail.setCount(1); detailList.add(detail); shopNames.add(shopName); goodsCount ++; } cargo.setCount(detailList.size()); cargo.setWeight(1.2); cargo.setSpaceHeight(10.0); cargo.setSpaceLength(20.0); cargo.setSpaceWidth(15.0); cargo.setDetailList(detailList); WxMaExpressOrderShop shop = new WxMaExpressOrderShop(); shop.setWxaPath("/index/index?from=waybill&id=01234567890123456789"); shop.setGoodsName(StringUtils.join(shopNames,"&")); shop.setGoodsCount(goodsCount); shop.setImgUrl("https://mmbiz.qpic.cn/mmbiz_png/OiaFLUqewuIDNQnTiaCInIG8ibdosYHhQHPbXJUrqYSNIcBL60vo4LIjlcoNG1QPkeH5GWWEB41Ny895CokeAah8A/640"); WxMaExpressDelivery.ServiceType serviceType = new WxMaExpressDelivery.ServiceType(); serviceType.setServiceName("test_service_name"); serviceType.setServiceType(1); WxMaExpressAddOrderRequest request = WxMaExpressAddOrderRequest.builder() .addSource(WxMaConstants.OrderAddSource.MINI_PROGRAM) .orderId("test201911271429004") .openid("oAg_-0PDUPuLbQw9V9kXE9OkU-Vo") .deliveryId("TEST") .bizId("test_biz_id") .customRemark("") .expectTime(0L) .sender(sender) .receiver(receiver) .cargo(cargo) .shop(shop) .insured(WxMaExpressOrderInsured.builder().build()) .service(serviceType) .build(); WxMaExpressOrderInfoResult result = service.addOrder(request); System.out.println(WxMaGsonBuilder.create().toJson(result)); } @Test public void testBatchGetOrder() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); List<WxMaExpressGetOrderRequest> requests = new ArrayList<>(); List<String> orderIds = new ArrayList<>(); orderIds.add("test201911271429000"); List<String> waybillIds = new ArrayList<>(); waybillIds.add("test201911271429000_1574836404_waybill_id"); for (int i = 0; i < orderIds.size(); i++) { WxMaExpressGetOrderRequest request = WxMaExpressGetOrderRequest.builder() .orderId(orderIds.get(i)) .deliveryId("TEST") .waybillId(waybillIds.get(i)) .build(); requests.add(request); } List<WxMaExpressOrderInfoResult> results = service.batchGetOrder(requests); System.out.println(WxMaGsonBuilder.create().toJson(results)); } @Test public void testCancelOrder() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressGetOrderRequest request = WxMaExpressGetOrderRequest.builder() .orderId("test201911271429000") .deliveryId("TEST") .waybillId("test201911271429000_1574836404_waybill_id") .openid("oAg_-0PDUPuLbQw9V9kXE9OkU-Vo") .build(); service.cancelOrder(request); } @Test public void testGetOrder() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressGetOrderRequest request = WxMaExpressGetOrderRequest.builder() .orderId("test201911271429000") .deliveryId("TEST") .waybillId("test201911271429000_1574836404_waybill_id") .openid("oAg_-0PDUPuLbQw9V9kXE9OkU-Vo") .build(); WxMaExpressOrderInfoResult result = service.getOrder(request); System.out.println(WxMaGsonBuilder.create().toJson(result)); } @Test public void testGetPath() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressGetOrderRequest request = WxMaExpressGetOrderRequest.builder() .orderId("test201911271429000") .deliveryId("TEST") .waybillId("test201911271429000_1574836404_waybill_id") .openid("oAg_-0PDUPuLbQw9V9kXE9OkU-Vo") .build(); WxMaExpressPath path = service.getPath(request); System.out.println(WxMaGsonBuilder.create().toJson(path)); } @Test public void testTestUpdateOrder() throws WxErrorException { final WxMaExpressService service = wxMaService.getExpressService(); WxMaExpressTestUpdateOrderRequest request = WxMaExpressTestUpdateOrderRequest.builder() .orderId("test201911271429000") .waybillId("test201911271429000_1574836404_waybill_id") .actionTime(1574850455L) .actionType(300002) .actionMsg("开始派送") .build(); service.testUpdateOrder(request); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaPromotionServiceTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaPromotionServiceTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.promoter.request.*; import cn.binarywang.wx.miniapp.bean.promoter.response.*; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Test; import java.util.Collections; import static org.assertj.core.api.Assertions.assertThat; public class WxMaPromotionServiceTest { @Inject private WxMaService wxService; @Test public void testAddRole() throws WxErrorException { WxMaPromotionAddRoleRequest request = WxMaPromotionAddRoleRequest.builder() .name("推广员1号名字") .desc("推广员1号描述") .build(); WxMaPromotionAddRoleResponse response = wxService.getWxMaPromotionService().addRole(request); assertThat(response).isNotNull(); } @Test public void testGetRole() throws WxErrorException { WxMaPromotionGetRoleRequest request = WxMaPromotionGetRoleRequest.builder() .roleId(1L) .build(); WxMaPromotionGetRoleResponse response = wxService.getWxMaPromotionService().getRole(request); assertThat(response).isNotNull(); } @Test public void testUpdateRole() throws WxErrorException { WxMaPromoterUpdateRoleRequest request = WxMaPromoterUpdateRoleRequest.builder() .roleId(1L) .name("推广员1号名字") .desc("推广员1号描述") .build(); WxMaPromotionUpdateRoleResponse response = wxService.getWxMaPromotionService().updateRole(request); assertThat(response).isNotNull(); } @Test public void testAddPromoter() throws WxErrorException { WxMaPromotionAddPromoterRequest.Promoter promoter = WxMaPromotionAddPromoterRequest.Promoter.builder() .phone("15600000000") .openid("") .extraInfo("{}") .retailId("1") .roleId(1L) .name("15600000000") .build(); WxMaPromotionAddPromoterRequest request = WxMaPromotionAddPromoterRequest.builder() .promoterList(Collections.singletonList(promoter)) .build(); WxMaPromotionAddPromoterResponse response = wxService.getWxMaPromotionService().addPromoter(request); assertThat(response).isNotNull(); } @Test public void testGetPromoter() throws WxErrorException { WxMaPromotionGetPromoterRequest request = WxMaPromotionGetPromoterRequest.builder() .openid("") .roleId(1L) .retailId("") .beginTime(1715938250L) .endTime(1715938250L) .startId("") .needUnionid(null) .authStatus(null) .declStatus("1") .build(); WxMaPromotionGetPromoterResponse response = wxService.getWxMaPromotionService().getPromoter(request); assertThat(response).isNotNull(); } @Test public void testUpdatePromoter() throws WxErrorException { WxMaPromotionUpdatePromoterRequest request = WxMaPromotionUpdatePromoterRequest.builder() .id("") .roleId(1L) .retailId("") .extraInfo("{}") .name("15600000000") .phone("15600000000") .declStatus("1") .build(); WxMaPromotionUpdatePromoterResponse response = wxService.getWxMaPromotionService().updatePromoter(request); assertThat(response).isNotNull(); } @Test public void testGetInvitationMaterial() throws WxErrorException { WxMaPromotionGetInvitationMaterialRequest request = WxMaPromotionGetInvitationMaterialRequest.builder() .roleId(1L) .invitationType(0L) .build(); WxMaPromotionGetInvitationMaterialResponse response = wxService.getWxMaPromotionService().getInvitationMaterial(request); assertThat(response).isNotNull(); } @Test public void testSendMsg() throws WxErrorException { WxMaPromotionSendMsgRequest request = WxMaPromotionSendMsgRequest.builder() .msgType(1) .content("{}") .appid("") .path("") .listType(0L) .roleId(null) .retailId(null) .id(null) .build(); WxMaPromotionSendMsgResponse response = wxService.getWxMaPromotionService().sendMsg(request); assertThat(response).isNotNull(); } @Test public void testSingleSendMsg() throws WxErrorException { WxMaPromotionSingleSendMsgRequest request = WxMaPromotionSingleSendMsgRequest.builder() .msgType(1) .content("{}") .appid("") .path("") .openid("") .build(); WxMaPromotionSingleSendMsgResponse response = wxService.getWxMaPromotionService().singleSendMsg(request); assertThat(response).isNotNull(); } @Test public void testGetMsg() throws WxErrorException { WxMaPromotionGetMsgRequest request = WxMaPromotionGetMsgRequest.builder() .msgId("") .build(); WxMaPromotionGetMsgResponse response = wxService.getWxMaPromotionService().getMsg(request); assertThat(response).isNotNull(); } @Test public void testGetMsgClickData() throws WxErrorException { WxMaPromotionGetMsgClickDataRequest request = WxMaPromotionGetMsgClickDataRequest.builder() .sendDate("2024-05-17") .dimonsion(0L) .msgType(1) .msgId("") .beginSendTime(1715938250L) .endSendTime(1715938250L) .build(); WxMaPromotionGetMsgClickDataResponse response = wxService.getWxMaPromotionService().getMsgClickData(request); assertThat(response).isNotNull(); } @Test public void testGetShareMaterial() throws WxErrorException { WxMaPromotionGetShareMaterialRequest request = WxMaPromotionGetShareMaterialRequest.builder() .path("") .openid("") .extraInfo("{}") .title("") .shareType(0L) .envVersion("") .build(); WxMaPromotionGetShareMaterialResponse response = wxService.getWxMaPromotionService().getShareMaterial(request); assertThat(response).isNotNull(); } @Test public void testGetRelation() throws WxErrorException { WxMaPromotionGetRelationRequest request = WxMaPromotionGetRelationRequest.builder() .openid("") .beginTime(1715938250L) .endTime(1715938250L) .scene(0L) .path("") .startId("") .needUnionid(0L) .build(); WxMaPromotionGetRelationResponse response = wxService.getWxMaPromotionService().getRelation(request); assertThat(response).isNotNull(); } @Test public void testGetOrder() throws WxErrorException { WxMaPromotionGetOrderRequest request = WxMaPromotionGetOrderRequest.builder() .openid("") .mchId("") .tradeNo("") .outTradeNo("") .status(0L) .startId("") .needUnionid(0L) .date(1715938250L) .build(); WxMaPromotionGetOrderResponse response = wxService.getWxMaPromotionService().getOrder(request); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaOcrServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaOcrServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.test.TestConstants; import me.chanjar.weixin.common.bean.ocr.*; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.util.fs.FileUtils; import org.testng.annotations.Guice; import org.testng.annotations.Test; import javax.inject.Inject; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.UUID; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2020-07-05 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaOcrServiceImplTest { @Inject private WxMaService service; @Test public void testIdCard() throws WxErrorException { final WxOcrIdCardResult result = this.service.getOcrService().idCard( "https://res.wx.qq.com/op_res/E_oqdHqP4ETOJsT46sQnXz1HbeHOpqDQTuhkYeaLaJTf-JKld7de3091dwxCQwa6"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testIdCard2() throws Exception { InputStream inputStream = this.getImageStream("https://res.wx.qq.com/op_res/E_oqdHqP4ETOJsT46sQnXz1HbeHOpqDQTuhkYeaLaJTf-JKld7de3091dwxCQwa6"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrIdCardResult result = this.service.getOcrService().idCard(tempFile); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBankCard() throws WxErrorException { final WxOcrBankCardResult result = this.service.getOcrService().bankCard("https://res.wx.qq.com/op_res/eP7PObYbBJj-_19EbGBL4PWe_zQ1NwET5NXSugjEWc-4ayns4Q-HFJrp-AOog8ih"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBankCard2() throws Exception { InputStream inputStream = this.getImageStream("https://res.wx.qq.com/op_res/eP7PObYbBJj-_19EbGBL4PWe_zQ1NwET5NXSugjEWc-4ayns4Q-HFJrp-AOog8ih"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrBankCardResult result = this.service.getOcrService().bankCard(tempFile); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDriving() throws WxErrorException { final WxOcrDrivingResult result = this.service.getOcrService().driving("https://res.wx.qq.com/op_res/T051P5uWvh9gSJ9j78tWib53WiNi2pHSSZhoO8wnY3Av-djpsA4kA9whbtt6_Tb6"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDriving2() throws Exception { InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrDrivingResult result = this.service.getOcrService().driving(tempFile); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDrivingLicense() throws WxErrorException { final WxOcrDrivingLicenseResult result = this.service.getOcrService().drivingLicense("https://res.wx.qq.com/op_res/kD4YXjYVAW1eaQqn9uTA0rrOFoZRvVINitNDSGo5gJ7SzTCezNq_ZDDmU1I08kGn"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDrivingLicense2() throws Exception { InputStream inputStream = this.getImageStream("https://res.wx.qq.com/op_res/kD4YXjYVAW1eaQqn9uTA0rrOFoZRvVINitNDSGo5gJ7SzTCezNq_ZDDmU1I08kGn"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrDrivingLicenseResult result = this.service.getOcrService().drivingLicense(tempFile); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBizLicense() throws WxErrorException { final WxOcrBizLicenseResult result = this.service.getOcrService().bizLicense("https://res.wx.qq.com/op_res/apCy0YbnEdjYsa_cjW6x3FlpCc20uQ-2BYE7aXnFsrB-ALHZNgdKXhzIUcrRnDoL"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBizLicense2() throws Exception { InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrBizLicenseResult result = this.service.getOcrService().bizLicense(tempFile); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testComm() throws WxErrorException { final WxOcrCommResult result = this.service.getOcrService().comm("https://res.wx.qq.com/op_res/apCy0YbnEdjYsa_cjW6x3FlpCc20uQ-2BYE7aXnFsrB-ALHZNgdKXhzIUcrRnDoL"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testComm2() throws Exception { InputStream inputStream = ClassLoader.getSystemResourceAsStream("mm.jpeg"); File tempFile = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), TestConstants.FILE_JPG); final WxOcrCommResult result = this.service.getOcrService().comm(tempFile); assertThat(result).isNotNull(); System.out.println(result); } private InputStream getImageStream(String url) { try { HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); connection.setReadTimeout(5000); connection.setConnectTimeout(5000); connection.setRequestMethod("GET"); if (HttpURLConnection.HTTP_OK == connection.getResponseCode()) { return connection.getInputStream(); } } catch (IOException e) { System.out.println("获取网络图片出现异常,图片路径为:" + url); } return null; } public static class MockTest { private final WxMaService wxService = mock(WxMaService.class); @Test public void testIdCard() throws Exception { String returnJson = "{\"type\":\"Back\",\"name\":\"张三\",\"id\":\"110101199909090099\",\"valid_date\":\"20110101-20210201\"}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl wxMpOcrService = new WxMaOcrServiceImpl(wxService); final WxOcrIdCardResult result = wxMpOcrService.idCard("abc"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBankCard() throws Exception { String returnJson = "{\"number\":\"24234234345234\"}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl ocrService = new WxMaOcrServiceImpl(wxService); final WxOcrBankCardResult result = ocrService.bankCard("abc"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDriving() throws Exception { String returnJson = "{\n" + " \"errcode\": 0,\n" + " \"errmsg\": \"ok\",\n" + " \"plate_num\": \"粤xxxxx\", //车牌号码\n" + " \"vehicle_type\": \"小型普通客车\", //车辆类型\n" + " \"owner\": \"东莞市xxxxx机械厂\", //所有人\n" + " \"addr\": \"广东省东莞市xxxxx号\", //住址\n" + " \"use_character\": \"非营运\", //使用性质\n" + " \"model\": \"江淮牌HFCxxxxxxx\", //品牌型号\n" + " \"vin\": \"LJ166xxxxxxxx51\", //车辆识别代号\n" + " \"engine_num\": \"J3xxxxx3\", //发动机号码\n" + " \"register_date\": \"2018-07-06\", //注册日期\n" + " \"issue_date\": \"2018-07-01\", //发证日期\n" + " \"plate_num_b\": \"粤xxxxx\", //车牌号码\n" + " \"record\": \"441xxxxxx3\", //号牌\n" + " \"passengers_num\": \"7人\", //核定载人数\n" + " \"total_quality\": \"2700kg\", //总质量\n" + " \"prepare_quality\": \"1995kg\", //整备质量\n" + " \"overall_size\": \"4582x1795x1458mm\", //外廓尺寸\n" + " \"card_position_front\": {//卡片正面位置(检测到卡片正面才会返回)\n" + " \"pos\": {\n" + " \"left_top\": {\n" + " \"x\": 119, \n" + " \"y\": 2925\n" + " }, \n" + " \"right_top\": {\n" + " \"x\": 1435, \n" + " \"y\": 2887\n" + " }, \n" + " \"right_bottom\": {\n" + " \"x\": 1435, \n" + " \"y\": 3793\n" + " }, \n" + " \"left_bottom\": {\n" + " \"x\": 119, \n" + " \"y\": 3831\n" + " }\n" + " }\n" + " }, \n" + " \"card_position_back\": {//卡片反面位置(检测到卡片反面才会返回)\n" + " \"pos\": {\n" + " \"left_top\": {\n" + " \"x\": 1523, \n" + " \"y\": 2849\n" + " }, \n" + " \"right_top\": {\n" + " \"x\": 2898, \n" + " \"y\": 2887\n" + " }, \n" + " \"right_bottom\": {\n" + " \"x\": 2927, \n" + " \"y\": 3831\n" + " }, \n" + " \"left_bottom\": {\n" + " \"x\": 1523, \n" + " \"y\": 3831\n" + " }\n" + " }\n" + " }, \n" + " \"img_size\": {//图片大小\n" + " \"w\": 3120, \n" + " \"h\": 4208\n" + " }\n" + "}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl ocrService = new WxMaOcrServiceImpl(wxService); final WxOcrDrivingResult result = ocrService.driving("abc"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testDrivingLicense() throws Exception { String returnJson = "{\n" + " \"errcode\": 0,\n" + " \"errmsg\": \"ok\",\n" + " \"id_num\": \"660601xxxxxxxx1234\", //证号\n" + " \"name\": \"张三\", //姓名\n" + " \"sex\": \"男\", //性别\n" + " \"nationality\": \"中国\", //国籍\n" + " \"address\": \"广东省东莞市xxxxx号\", //住址\n" + " \"birth_date\": \"1990-12-21\", //出生日期\n" + " \"issue_date\": \"2012-12-21\", //初次领证日期\n" + " \"car_class\": \"C1\", //准驾车型\n" + " \"valid_from\": \"2018-07-06\", //有效期限起始日\n" + " \"valid_to\": \"2020-07-01\", //有效期限终止日\n" + " \"official_seal\": \"xx市公安局公安交通管理局\" //印章文字\n" + "}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl wxMpOcrService = new WxMaOcrServiceImpl(wxService); final WxOcrDrivingLicenseResult result = wxMpOcrService.drivingLicense("abc"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testBizLicense() throws Exception { String returnJson = "{\n" + " \"errcode\": 0, \n" + " \"errmsg\": \"ok\", \n" + " \"reg_num\": \"123123\",//注册号\n" + " \"serial\": \"123123\",//编号\n" + " \"legal_representative\": \"张三\", //法定代表人姓名\n" + " \"enterprise_name\": \"XX饮食店\", //企业名称\n" + " \"type_of_organization\": \"个人经营\", //组成形式\n" + " \"address\": \"XX市XX区XX路XX号\", //经营场所/企业住所\n" + " \"type_of_enterprise\": \"xxx\", //公司类型\n" + " \"business_scope\": \"中型餐馆(不含凉菜、不含裱花蛋糕,不含生食海产品)。\", //经营范围\n" + " \"registered_capital\": \"200万\", //注册资本\n" + " \"paid_in_capital\": \"200万\", //实收资本\n" + " \"valid_period\": \"2019年1月1日\", //营业期限\n" + " \"registered_date\": \"2018年1月1日\", //注册日期/成立日期\n" + " \"cert_position\": { //营业执照位置\n" + " \"pos\": {\n" + " \"left_top\": {\n" + " \"x\": 155, \n" + " \"y\": 191\n" + " }, \n" + " \"right_top\": {\n" + " \"x\": 725, \n" + " \"y\": 157\n" + " }, \n" + " \"right_bottom\": {\n" + " \"x\": 743, \n" + " \"y\": 512\n" + " }, \n" + " \"left_bottom\": {\n" + " \"x\": 164, \n" + " \"y\": 525\n" + " }\n" + " }\n" + " }, \n" + " \"img_size\": { //图片大小\n" + " \"w\": 966, \n" + " \"h\": 728\n" + " }\n" + "}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl ocrService = new WxMaOcrServiceImpl(wxService); final WxOcrBizLicenseResult result = ocrService.bizLicense("abc"); assertThat(result).isNotNull(); System.out.println(result); } @Test public void testComm() throws Exception { String returnJson = "{\n" + " \"errcode\": 0, \n" + " \"errmsg\": \"ok\", \n" + " \"items\": [ //识别结果\n" + " {\n" + " \"text\": \"腾讯\", \n" + " \"pos\": {\n" + " \"left_top\": {\n" + " \"x\": 575, \n" + " \"y\": 519\n" + " }, \n" + " \"right_top\": {\n" + " \"x\": 744, \n" + " \"y\": 519\n" + " }, \n" + " \"right_bottom\": {\n" + " \"x\": 744, \n" + " \"y\": 532\n" + " }, \n" + " \"left_bottom\": {\n" + " \"x\": 573, \n" + " \"y\": 532\n" + " }\n" + " }\n" + " }, \n" + " {\n" + " \"text\": \"微信团队\", \n" + " \"pos\": {\n" + " \"left_top\": {\n" + " \"x\": 670, \n" + " \"y\": 516\n" + " }, \n" + " \"right_top\": {\n" + " \"x\": 762, \n" + " \"y\": 517\n" + " }, \n" + " \"right_bottom\": {\n" + " \"x\": 762, \n" + " \"y\": 532\n" + " }, \n" + " \"left_bottom\": {\n" + " \"x\": 670, \n" + " \"y\": 531\n" + " }\n" + " }\n" + " }\n" + " ], \n" + " \"img_size\": { //图片大小\n" + " \"w\": 1280, \n" + " \"h\": 720\n" + " }\n" + "}"; when(wxService.get(anyString(), anyString())).thenReturn(returnJson); final WxMaOcrServiceImpl ocrService = new WxMaOcrServiceImpl(wxService); final WxOcrCommResult result = ocrService.comm("abc"); assertThat(result).isNotNull(); System.out.println(result); } } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaReimburseInvoiceServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaReimburseInvoiceServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.invoice.reimburse.*; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.gson.GsonBuilder; import com.google.inject.Inject; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; import static org.testng.Assert.*; @Slf4j @Test @Guice(modules = ApiTestModule.class) public class WxMaReimburseInvoiceServiceImplTest { @Inject private WxMaService wxMaService; @Test public void testGetInvoiceInfo() throws WxErrorException { InvoiceInfoRequest request = InvoiceInfoRequest.builder() .cardId("**********************") .encryptCode("**********************") .build(); InvoiceInfoResponse response = this.wxMaService.getReimburseInvoiceService().getInvoiceInfo(request); log.info("response: {}", new GsonBuilder().create().toJson(response)); } @Test public void testGetInvoiceBatch() throws WxErrorException { List<InvoiceInfoRequest> invoices = new ArrayList<>(); InvoiceInfoRequest r = InvoiceInfoRequest.builder() .cardId("**********************") .encryptCode("********************************************") .build(); invoices.add(r); r = InvoiceInfoRequest.builder() .cardId("**********************") .encryptCode("********************************************") .build(); invoices.add(r); InvoiceBatchRequest request = InvoiceBatchRequest.builder().itemList(invoices).build(); List<InvoiceInfoResponse> responses = this.wxMaService.getReimburseInvoiceService().getInvoiceBatch(request); log.info("responses: {}",new GsonBuilder().create().toJson(responses)); } @Test public void testUpdateInvoiceStatus() throws WxErrorException { UpdateInvoiceStatusRequest request = UpdateInvoiceStatusRequest.builder() .cardId("**********************") .encryptCode("********************************************") .reimburseStatus("INVOICE_REIMBURSE_INIT") .build(); this.wxMaService.getReimburseInvoiceService().updateInvoiceStatus(request); } @Test public void testUpdateStatusBatch() throws WxErrorException { List<InvoiceInfoRequest> invoices = new ArrayList<>(); InvoiceInfoRequest r = InvoiceInfoRequest.builder() .cardId("**************") .encryptCode("**************") .build(); invoices.add(r); UpdateStatusBatchRequest request = UpdateStatusBatchRequest.builder() .invoiceList(invoices) .openid("**************") .reimburseStatus("INVOICE_REIMBURSE_LOCK") .build(); this.wxMaService.getReimburseInvoiceService().updateStatusBatch(request); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaCloudServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.cloud.*; import cn.binarywang.wx.miniapp.bean.cloud.request.WxCloudSendSmsV2Request; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import com.google.gson.JsonArray; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.BeforeTest; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.math.BigDecimal; import java.util.*; import static org.assertj.core.api.Assertions.assertThat; /** * 测试类. * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2020-01-22 */ @Guice(modules = ApiTestModule.class) public class WxMaCloudServiceImplTest { private static final String COLLECTION = "geo"; @Inject private WxMaService wxMaService; @BeforeTest public void before() { /** * 用以解决:javax.net.ssl.SSLHandshakeException: PKIX path building failed * 参考:https://www.cnblogs.com/cloudapps/p/5022544.html */ String mpCert = ClassLoader.getSystemResource("wx-mp-jssecacerts").getPath(); String maCert = ClassLoader.getSystemResource("wx-ma-jssecacerts").getPath(); System.setProperty("javax.net.ssl.trustStore", mpCert + "," + maCert); String property = System.getProperty("javax.net.ssl.trustStore"); System.out.println("javax.net.ssl.trustStore=" + property); } @Test public void testInvokeCloudFunction() throws WxErrorException { final String result = this.wxMaService.getCloudService().invokeCloudFunction("login", "{}"); assertThat(result).isNotNull(); } @Test public void testAddList() throws WxErrorException { List<Map> stuList = new ArrayList<>(); Map<String, Object> product1 = new HashMap<>(); product1.put("description", "item1"); product1.put("price", BigDecimal.valueOf(1.2)); product1.put("due", new Date()); /** * 等价于new db.Geo.Point(113, 23) * 参见:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/geo/Geo.Point.html */ Map<String, Object> point = new HashMap<>(); point.put("type", "Point"); point.put("coordinates", new Integer[]{113, 23}); Map<String, Object> product2 = new HashMap<>(); product2.put("tags", new String[]{"cloud", "database"}); product2.put("location", point); product2.put("done", false); stuList.add(product1); stuList.add(product2); List<String> idList = this.wxMaService.getCloudService().add(COLLECTION, stuList); System.out.println(idList.size()); assertThat(idList).isNotEmpty(); } @Test public void testAddObject() throws WxErrorException { /** * 等价于new db.Geo.Point(113, 23) * 参见:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/database/geo/Geo.Point.html */ Map<String, Object> point = new HashMap<>(); point.put("type", "Point"); point.put("coordinates", new Integer[]{113, 23}); Map<String, Object> product = new HashMap<>(); product.put("description", "item1"); product.put("price", BigDecimal.valueOf(1.2)); product.put("due", new Date()); product.put("tags", new String[]{"cloud", "database"}); product.put("location", point); product.put("done", false); String id = this.wxMaService.getCloudService().add(COLLECTION, product); System.out.println(id); assertThat(id).isNotBlank(); } @Test public void testDatabaseAdd() throws WxErrorException { JsonArray array = this.wxMaService.getCloudService().databaseAdd("db.collection(\"geo\").add({\n" + " data: [{\n" + " description: \"item1\",\n" + " due:\n" + " new Date(\"2019-09-09\"),\n" + " tags: [\n" + " \"cloud\",\n" + " \"database\"\n" + " ],\n" + " location:\n" + " new db.Geo.Point(113, 23),\n" + " done:false\n" + " },\n" + " {\n" + " description: \"item2\",\n" + " due:\n" + " new Date(\"2019-09-09\"),\n" + " tags: [\n" + " \"cloud\",\n" + " \"database\"\n" + " ],\n" + " location:\n" + " new db.Geo.Point(113, 23),\n" + " done:false\n" + " }\n" + " ]\n" + " })"); System.out.println(array); assertThat(array).isNotEmpty(); } @Test public void testDelete() throws WxErrorException { StringBuilder whereParamSb = new StringBuilder(); whereParamSb.append("{") // 等于 .append("_id: _.eq('79a2c43f5e7e9e8e001a120e494d51b8'),") // in .append("age: _.in([0, 1, 2, 3]),") // 小于 .append("due: _.lt('Mar 29, 2020 8:47:07 AM'),") // 存在属性 .append("price: _.exists(true)") .append("}"); final int result = this.wxMaService.getCloudService().delete( COLLECTION, whereParamSb.toString()); assertThat(result).isEqualTo(0); } @Test public void testDatabaseDelete() throws WxErrorException { final int result = this.wxMaService.getCloudService().databaseDelete( "db.collection(\"geo\").doc(\"056120a7-c89e-4616-95bf-dfc9a11daa3b\").remove()"); assertThat(result).isEqualTo(0); } @Test public void testUpdate() throws WxErrorException { StringBuilder whereParamSb = new StringBuilder(); whereParamSb.append("{") // in .append("age: _.in([0, 1, 2, 3]),") // 小于 .append("due: _.lt('Mar 29, 2020 8:47:07 AM'),") // 存在属性 .append("price: _.exists(true)") .append("}"); StringBuilder updateSb = new StringBuilder(); updateSb.append("{age: _.inc(1)}"); final WxCloudDatabaseUpdateResult result = this.wxMaService.getCloudService().update(COLLECTION, whereParamSb.toString(), updateSb.toString()); assertThat(result).isNotNull(); assertThat(result.getMatched()).isGreaterThan(0); assertThat(result.getId()).isEmpty(); assertThat(result.getModified()).isGreaterThan(0); } @Test public void testDatabaseUpdate() throws WxErrorException { final WxCloudDatabaseUpdateResult result = this.wxMaService.getCloudService().databaseUpdate( "db.collection(\"geo\").where({description:\"item1\"}).update({data:{age: _.inc(1)}})"); assertThat(result).isNotNull(); assertThat(result.getMatched()).isGreaterThan(0); assertThat(result.getId()).isEmpty(); assertThat(result.getModified()).isGreaterThan(0); } @Test public void testQuery() throws WxErrorException { StringBuilder whereParamSb = new StringBuilder(); whereParamSb.append("{") // in .append("age: _.in([0, 1, 2, 3]),") // 小于 .append("due: _.lt('Mar 29, 2020 8:47:07 AM'),") // 存在属性 .append("price: _.exists(true)") .append("}"); // // Hutool创建有序map,返回LinkedHashMap // Map<String, Integer> map2 = MapUtil.newHashMap(true); // map2.put("_id", "asc"); // map2.put("price", "desc"); // 有序map ImmutableSortedMap<String, String> orderBy = new ImmutableSortedMap .Builder<String, String>(Ordering.natural()) .put("_id", "asc") .put("price", "desc") .build(); final WxCloudDatabaseQueryResult result = this.wxMaService.getCloudService().query(COLLECTION, whereParamSb.toString(), orderBy, 20, 20); assertThat(result).isNotNull(); assertThat(result.getPager()).isNotNull(); assertThat(result.getPager().getLimit()).isEqualTo(10); assertThat(result.getPager().getOffset()).isEqualTo(1); assertThat(result.getPager().getTotal()).isGreaterThan(0); assertThat(result.getData().length).isGreaterThan(0); } @Test public void testDatabaseQuery() throws WxErrorException { final WxCloudDatabaseQueryResult result = this.wxMaService.getCloudService().databaseQuery( "db.collection(\"geo\").where({done:false}).limit(10).skip(1).get()"); assertThat(result).isNotNull(); assertThat(result.getPager()).isNotNull(); assertThat(result.getPager().getLimit()).isEqualTo(10); assertThat(result.getPager().getOffset()).isEqualTo(1); assertThat(result.getPager().getTotal()).isGreaterThan(0); assertThat(result.getData().length).isGreaterThan(0); } @Test public void testDatabaseAggregate() throws WxErrorException { final JsonArray result = this.wxMaService.getCloudService().databaseAggregate( "db.collection(\"geo\").aggregate().match({tags:\"cloud\"}).limit(10).end()"); assertThat(result).isNotNull(); } @Test public void testCount() throws WxErrorException { StringBuilder whereParamSb = new StringBuilder(); whereParamSb.append("{") // in .append("age: _.in([0, 1, 2, 3]),") // 小于 .append("due: _.lt('Mar 29, 2020 8:47:07 AM'),") // 存在属性 .append("price: _.exists(true)") .append("}"); final Long result = this.wxMaService.getCloudService().count(COLLECTION, whereParamSb.toString()); assertThat(result).isGreaterThan(0); } @Test public void testDatabaseCount() throws WxErrorException { final Long result = this.wxMaService.getCloudService().databaseCount( "db.collection(\"geo\").where({done:false}).count()"); assertThat(result).isGreaterThan(0); } @Test public void testUpdateIndex() throws WxErrorException { this.wxMaService.getCloudService().updateIndex(COLLECTION, Lists.newArrayList(new WxCloudDatabaseCreateIndexRequest() .setName("drop_index") .setUnique(true) .setKeys(Lists.newArrayList(new WxCloudDatabaseCreateIndexRequest.IndexKey().setDirection("2dsphere").setName("test")) )), Lists.newArrayList("add_index2")); } @Test public void testDatabaseMigrateImport() throws WxErrorException { final Long result = this.wxMaService.getCloudService().databaseMigrateImport(COLLECTION, "test.json", 1, true, 1); assertThat(result).isGreaterThan(0); } @Test public void testDatabaseMigrateExport() throws WxErrorException { final Long result = this.wxMaService.getCloudService().databaseMigrateExport("test.json", 1, "const Point = db.Geo.Point;db.collection('geo').where({age: _.gt(1)}).limit(10).skip(1).orderBy('age','asc')" + ".orderBy('name', 'desc')" + ".field({ name: true }).get()"); assertThat(result).isGreaterThan(0); } @Test public void testDatabaseMigrateQueryInfo() throws WxErrorException { final WxCloudCloudDatabaseMigrateQueryInfoResult result = this.wxMaService.getCloudService() .databaseMigrateQueryInfo(476629L); assertThat(result).isNotNull(); System.out.println(result.getFileUrl()); } @Test public void testUploadFile() throws WxErrorException { final WxCloudUploadFileResult result = this.wxMaService.getCloudService().uploadFile("E:\\MyDocs\\Desktop" + "\\test.json"); assertThat(result).isNotNull(); assertThat(result.getAuthorization()).isNotNull(); assertThat(result.getToken()).isNotNull(); assertThat(result.getUrl()).isNotNull(); assertThat(result.getFileId()).isNotNull(); assertThat(result.getCosFileId()).isNotNull(); } @Test public void testBatchDownloadFile() throws WxErrorException { final WxCloudBatchDownloadFileResult result = this.wxMaService.getCloudService().batchDownloadFile( new String[]{"cloud://rcn.7263-rcn-1258788140/Snipaste_2019-11-13_00-21-27.png", "cloud://rcn" + ".7263-rcn-1258788140/avatar.jpg"}, new long[]{7200, 6800}); assertThat(result).isNotNull(); assertThat(result.getFileList()).isNotNull(); assertThat(result.getFileList().size()).isGreaterThan(0); assertThat(result.getFileList().get(0).getDownloadUrl()).isNotNull(); assertThat(result.getFileList().get(0).getErrMsg()).isEqualTo("ok"); assertThat(result.getFileList().get(0).getStatus()).isEqualTo(0); assertThat(result.getFileList().get(0).getFileId()).isNotNull(); } @Test public void testBatchDeleteFile() throws WxErrorException { final WxCloudBatchDeleteFileResult result = this.wxMaService.getCloudService().batchDeleteFile( new String[]{"cloud://rcn.7263-rcn-1258788140/test.json"}); assertThat(result).isNotNull(); assertThat(result.getFileList()).isNotNull(); assertThat(result.getFileList().size()).isGreaterThan(0); assertThat(result.getFileList().get(0).getErrMsg()).isEqualTo("ok"); assertThat(result.getFileList().get(0).getStatus()).isEqualTo(0); assertThat(result.getFileList().get(0).getFileId()).isNotNull(); } @Test public void testGetQcloudToken() throws WxErrorException { final WxCloudGetQcloudTokenResult result = this.wxMaService.getCloudService().getQcloudToken(1800); assertThat(result).isNotNull(); assertThat(result.getSecretId()).isNotNull(); assertThat(result.getSecretKey()).isNotNull(); assertThat(result.getToken()).isNotNull(); assertThat(result.getExpiredTime()).isNotNull(); } @Test public void testDatabaseCollectionAdd() throws WxErrorException { this.wxMaService.getCloudService().databaseCollectionAdd("test_add_collection"); } @Test public void testDatabaseCollectionDelete() throws WxErrorException { this.wxMaService.getCloudService().databaseCollectionAdd("test_delete_collection"); this.wxMaService.getCloudService().databaseCollectionDelete("test_delete_collection"); } @Test public void testDatabaseCollectionGet() throws WxErrorException { final WxCloudDatabaseCollectionGetResult result = this.wxMaService.getCloudService().databaseCollectionGet( null, null); assertThat(result).isNotNull(); assertThat(result.getPager()).isNotNull(); assertThat(result.getPager().getLimit()).isEqualTo(10); assertThat(result.getPager().getOffset()).isEqualTo(0); assertThat(result.getPager().getTotal()).isGreaterThan(0); assertThat(result.getCollections().length).isGreaterThan(0); assertThat(result.getCollections()[0].getCount()).isGreaterThan(0); assertThat(result.getCollections()[0].getName()).isNotNull(); assertThat(result.getCollections()[0].getSize()).isGreaterThan(0); assertThat(result.getCollections()[0].getIndexCount()).isGreaterThan(0); assertThat(result.getCollections()[0].getIndexSize()).isGreaterThan(0); } @Test public void testSendSmsV2() throws WxErrorException { WxCloudSendSmsV2Request request = WxCloudSendSmsV2Request.builder() .urlLink("https://wxaurl.cn/xxxxxx") .templateId("844110") .templateParamList(Arrays.asList(new String[]{"能力上新"})) .phoneNumberList(Arrays.asList("+8612345678910")) .build(); final WxCloudSendSmsV2Result result = this.wxMaService.getCloudService().sendSmsV2(request); assertThat(result).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaDeviceSubscribeServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaDeviceSubscribeServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.device.*; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.common.collect.Lists; import com.google.gson.JsonObject; import com.google.inject.Inject; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.util.json.GsonParser; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.Collections; import java.util.List; /** * 小程序设备订阅消息相关 测试类 * * @author <a href="https://github.com/leejuncheng">JCLee</a> * @since 2021-12-16 17:13:35 */ @Slf4j @Test @Guice(modules = ApiTestModule.class) public class WxMaDeviceSubscribeServiceImplTest { @Inject protected WxMaService wxService; @Test public void testGetSnTicket() throws WxErrorException { WxMaDeviceTicketRequest wxMaDeviceTicketRequest = new WxMaDeviceTicketRequest(); wxMaDeviceTicketRequest.setModelId("11111"); wxMaDeviceTicketRequest.setSn("11111"); String snTicket = this.wxService.getDeviceSubscribeService().getSnTicket(wxMaDeviceTicketRequest); System.out.println(snTicket); } @Test public void sendDeviceSubscribeMsg() throws WxErrorException { WxMaDeviceSubscribeMessageRequest wxMaDeviceSubscribeMessageRequest = new WxMaDeviceSubscribeMessageRequest(); wxMaDeviceSubscribeMessageRequest.setToOpenidList(Lists.newArrayList("1", "2")); wxMaDeviceSubscribeMessageRequest.setPage("pages/index/index"); wxMaDeviceSubscribeMessageRequest.setTemplateId("11111111"); wxMaDeviceSubscribeMessageRequest.setSn("111111"); JsonObject data = GsonParser.parse("{\n" + "\t\t\"thing2\": {\n" + "\t\t\t\"value\": \"阳台\"\n" + "\t\t},\n" + "\t\t\"time1\": {\n" + "\t\t\t\"value\": \"2021-09-30 13:32:44\"\n" + "\t\t},\n" + "\t\t\"thing3\": {\n" + "\t\t\t\"value\": \"洗衣已完成\"\n" + "\t\t}\n" + "\t}"); wxMaDeviceSubscribeMessageRequest.setData(data); this.wxService.getDeviceSubscribeService().sendDeviceSubscribeMsg(wxMaDeviceSubscribeMessageRequest); } @Test public void testCreateIotGroupId() throws WxErrorException { WxMaCreateIotGroupIdRequest request = new WxMaCreateIotGroupIdRequest(); request.setModelId("11111"); request.setGroupName("测试设备组"); String groupId = this.wxService.getDeviceSubscribeService().createIotGroupId(request); System.out.println(groupId); } @Test public void testGetIotGroupInfo() throws WxErrorException { WxMaGetIotGroupInfoRequest request = new WxMaGetIotGroupInfoRequest(); request.setGroupId("12313123"); WxMaIotGroupDeviceInfoResponse response = this.wxService.getDeviceSubscribeService().getIotGroupInfo(request); log.info("testGetIotGroupInfo = {}", response); } @Test public void testAddIotGroupDevice() throws WxErrorException { WxMaDeviceTicketRequest deviceTicketRequest = new WxMaDeviceTicketRequest(); deviceTicketRequest.setSn("2222222"); deviceTicketRequest.setModelId("sdfeweee"); WxMaIotGroupDeviceRequest request = new WxMaIotGroupDeviceRequest(); request.setGroupId("12313123"); request.setDeviceList(Collections.singletonList(deviceTicketRequest)); request.setForceAdd(true); List<WxMaDeviceTicketRequest> response = this.wxService.getDeviceSubscribeService().addIotGroupDevice(request); log.info("testAddIotGroupDevice = {}", response); } @Test public void testRemoveIotGroupDevice() throws WxErrorException { WxMaDeviceTicketRequest deviceTicketRequest = new WxMaDeviceTicketRequest(); deviceTicketRequest.setSn("2222222"); deviceTicketRequest.setModelId("sdfeweee"); WxMaIotGroupDeviceRequest request = new WxMaIotGroupDeviceRequest(); request.setGroupId("12313123"); request.setDeviceList(Collections.singletonList(deviceTicketRequest)); List<WxMaDeviceTicketRequest> response = this.wxService.getDeviceSubscribeService().removeIotGroupDevice(request); log.info("testRemoveIotGroupDevice = {}", response); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopDeliveryServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopDeliveryServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliveryRecieveRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopDeliverySendRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopDeliveryGetCompanyListResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; import static org.testng.Assert.assertNotNull; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopDeliveryServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetCompanyList() throws WxErrorException { WxMaShopDeliveryGetCompanyListResponse response = wxService.getShopDeliveryService().getCompanyList(); assertNotNull(response); } @Test public void testSend() throws WxErrorException { WxMaShopDeliverySendRequest.DeliveryListBean deliveryListBean = WxMaShopDeliverySendRequest.DeliveryListBean.builder() .deliveryId("ZTO") .waybillId("73164691843558") .build(); WxMaShopDeliverySendRequest request = WxMaShopDeliverySendRequest.builder() .outOrderId("318070290792415232") .openid("odIi15CuQ0IQviqsnUMy6CKNetrM") .finishAllDelivery(1) .deliveryList(new ArrayList<>(Arrays.asList(deliveryListBean))) .build(); WxMaShopBaseResponse response = wxService.getShopDeliveryService().send(request); assertNotNull(response); } @Test public void testReceive() throws WxErrorException { WxMaShopDeliveryRecieveRequest request = WxMaShopDeliveryRecieveRequest.builder() .openid("oTVP50O53a7jgmawAmxKukNlq3XI") .orderId(123456L) .outOrderId("xxxxx") .build(); WxMaShopBaseResponse response = wxService.getShopDeliveryService().receive(request); assertNotNull(response); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaImmediateDeliveryServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.delivery.AbnormalConfirmRequest; import cn.binarywang.wx.miniapp.bean.delivery.AbnormalConfirmResponse; import cn.binarywang.wx.miniapp.bean.delivery.AddOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.AddOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.BindAccountResponse; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.CancelOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.GetOrderResponse; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderRequest; import cn.binarywang.wx.miniapp.bean.delivery.MockUpdateOrderResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.common.collect.Lists; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.math.BigDecimal; /** * 微信小程序即时配送服务测试. * * @author Luo * @version 1.0 * created on 2021-10-14 11:48 */ @Guice(modules = ApiTestModule.class) public class WxMaImmediateDeliveryServiceImplTest { /** * 对应配送公司的appKey. */ private static final String SHOP_ID = "***"; /** * 对应配送公司appSecret. */ private static final String APP_SECRET = "****"; /** * 商家门店编号. */ private static final String SHOP_NO = "***"; /** * 快递公司Id. */ private static final String DELIVERY_ID = "SFTC"; @Inject private WxMaService wxMaService; /** * 测试拉取已绑定账号接口. * * @throws WxErrorException 异常 */ @Test public void testGetBindAccount() throws WxErrorException { BindAccountResponse response = wxMaService.getWxMaImmediateDeliveryService().getBindAccount(); System.out.println("response = " + response); } /** * 测试下配送单接口. * * @throws WxErrorException 异常 */ @Test public void testAddOrder() throws WxErrorException { AddOrderRequest request = new AddOrderRequest(); // 下单用户的openid request.setOpenid("*****"); // 微信平台字段,对应配送公司的appkey request.setShopId(SHOP_ID); // 对应配送公司appSecret request.setAppSecret(APP_SECRET); // 商家门店编号,在配送公司登记,如果只有一个门店,美团闪送必填, 值为店铺id // 商家对不同门店进行的编号,需要在配送公司系统有过登记,比如商家自己门店系统中有100个门店,编号是1-100,在顺丰同城的系统中有登记过这100个门店,且在顺丰同城登记的编号也是1-100,那么下单的时候传shop_no // =1,就是编号为1 的门店下的配送单 request.setShopNo(SHOP_NO); // 配送公司Id request.setDeliveryId(DELIVERY_ID); // 唯一标识订单的 ID,由商户生成, 不超过 128 字节 String shopOrderId = String.valueOf(System.currentTimeMillis()); request.setShopOrderId(shopOrderId); // 订单信息 AddOrderRequest.OrderInfo orderInfo = new AddOrderRequest.OrderInfo(); orderInfo.setOrderTime(System.currentTimeMillis() / 1000L); request.setOrderInfo(orderInfo); // 发件人信息 AddOrderRequest.Sender sender = new AddOrderRequest.Sender(); sender.setCity("上海市").setAddress("***").setAddressDetail("****"); sender.setName("***").setPhone("166****8829"); sender.setLng(new BigDecimal("121.281379")).setLat(new BigDecimal("31.049363")); request.setSender(sender); // 收件人信息 AddOrderRequest.Receiver receiver = new AddOrderRequest.Receiver().setCoordinateType(1); receiver.setCity("北京市").setAddress("海淀区").setAddressDetail("北京市海淀区学清嘉创大厦A座15层"); receiver.setName("顺丰同城").setPhone("166****8829"); receiver.setLng(new BigDecimal("116.359442")).setLat(new BigDecimal("40.020407")); request.setReceiver(receiver); // 商品信息 AddOrderRequest.Cargo cargo = new AddOrderRequest.Cargo(); cargo.setCargoFirstClass("电商").setCargoSecondClass("线上商城"); cargo.setGoodsHeight(BigDecimal.valueOf(1)).setGoodsLength(BigDecimal.valueOf(3)); cargo.setGoodsValue(BigDecimal.valueOf(5)).setGoodsWeight(BigDecimal.valueOf(1)).setGoodsWidth(BigDecimal.valueOf(2)); // 商品列表 AddOrderRequest.Cargo.GoodsDetail goodsDetail = new AddOrderRequest.Cargo.GoodsDetail(); AddOrderRequest.Cargo.GoodsDetail.Goods goods1 = new AddOrderRequest.Cargo.GoodsDetail.Goods(); goods1.setGoodCount(1).setGoodName("水果").setGoodPrice(new BigDecimal(10)); AddOrderRequest.Cargo.GoodsDetail.Goods goods2 = new AddOrderRequest.Cargo.GoodsDetail.Goods(); goods2.setGoodCount(2).setGoodName("蔬菜").setGoodPrice(new BigDecimal(20)); goodsDetail.setGoods(Lists.newArrayList(goods1, goods2)); cargo.setGoodsDetail(goodsDetail); request.setCargo(cargo); // 店铺信息 AddOrderRequest.Shop shop = new AddOrderRequest.Shop(); int sum = request.getCargo().getGoodsDetail().getGoods().stream().mapToInt(AddOrderRequest.Cargo.GoodsDetail.Goods::getGoodCount).sum(); shop.setGoodsCount(sum).setGoodsName("商品"); shop.setImgUrl("https://").setWxaPath("pages/index/index"); request.setShop(shop); AddOrderResponse response = wxMaService.getWxMaImmediateDeliveryService().addOrder(request); System.out.println("response = " + response); } /** * 测试拉取配送单信息接口. * * @throws WxErrorException 异常 */ @Test public void testGetOrder() throws WxErrorException { GetOrderRequest request = new GetOrderRequest(); request.setShopId(SHOP_ID).setShopNo(SHOP_NO).setAppSecret(APP_SECRET); request.setShopOrderId("1561399675737608193"); GetOrderResponse response = wxMaService.getWxMaImmediateDeliveryService().getOrder(request); System.out.println("response = " + response); } /** * 测试取消配送单信息接口. * * @throws WxErrorException 异常 */ @Test public void testCancelOrder() throws WxErrorException { CancelOrderRequest request = new CancelOrderRequest(); request.setShopId(SHOP_ID).setShopNo(SHOP_NO).setAppSecret(APP_SECRET); request.setDeliveryId(DELIVERY_ID); request.setCancelReasonId(1); request.setShopOrderId("1560365275348471809"); request.setWaybillId("3427365636312065025"); CancelOrderResponse response = wxMaService.getWxMaImmediateDeliveryService().cancelOrder(request); System.out.println("response = " + response); } /** * 测试异常件退回商家商家确认收货接口. * * @throws WxErrorException 异常 */ @Test public void testAbnormalConfirm() throws WxErrorException { AbnormalConfirmRequest request = new AbnormalConfirmRequest(); request.setShopId(SHOP_ID).setShopNo(SHOP_NO).setAppSecret(APP_SECRET); request.setDeliveryId(DELIVERY_ID); request.setShopOrderId("1561399675737608193"); request.setWaybillId("3427882855372591617"); request.setRemark("测试签收异常订单"); AbnormalConfirmResponse response = wxMaService.getWxMaImmediateDeliveryService().abnormalConfirm(request); System.out.println("response = " + response); } /** * 测试模拟配送公司更新配送单状态接口. * * @throws WxErrorException 异常 */ @Test public void testMockUpdateOrder() throws WxErrorException { // 请求参数 MockUpdateOrderRequest request = new MockUpdateOrderRequest(); request.setActionTime(System.currentTimeMillis() / 1000L); request.setOrderStatus(102); request.setShopOrderId(""); MockUpdateOrderResponse response = wxMaService.getWxMaImmediateDeliveryService().mockUpdateOrder(request); System.out.println("response = " + response); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSecurityServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaSecurityServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.safety.request.WxMaUserSafetyRiskRankRequest; import cn.binarywang.wx.miniapp.bean.safety.response.WxMaUserSafetyRiskRankResponse; import cn.binarywang.wx.miniapp.bean.security.WxMaMsgSecCheckCheckRequest; import cn.binarywang.wx.miniapp.bean.security.WxMaMsgSecCheckCheckResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.DataProvider; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertTrue; import static org.testng.AssertJUnit.assertNotNull; /** * <pre> * * Created by Binary Wang on 2018/11/24. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaSecurityServiceImplTest { @Inject private WxMaService wxService; @Test public void testCheckImage() throws WxErrorException { boolean result = this.wxService.getSecurityService() .checkImage(new File(ClassLoader.getSystemResource("tmp.png").getFile())); assertTrue(result); } @DataProvider public Object[][] secData() { return new Object[][]{ {"特3456书yuuo莞6543李zxcz蒜7782法fgnv级", false}, {"完2347全dfji试3726测asad感3847知qwez到", false}, {"提现&下载&棋牌游戏&网页", false}, {"hello world!", true} }; } @Test(dataProvider = "secData") public void testCheckMessage(String msg, boolean result) throws WxErrorException { assertThat(this.wxService.getSecurityService() .checkMessage(msg)) .isEqualTo(result); } @Test(dataProvider = "secData") public void testCheckMessage2(String msg, boolean result) throws WxErrorException { WxMaMsgSecCheckCheckRequest request = WxMaMsgSecCheckCheckRequest.builder() .content(msg) .scene(1) .version("2") .openid("xxx") .build(); WxMaMsgSecCheckCheckResponse response = this.wxService.getSecurityService().checkMessage(request); assertThat(response).isNotNull(); } @Test public void testGetUserRiskRank() throws WxErrorException { WxMaUserSafetyRiskRankRequest wxMaUserSafetyRiskRankRequest = WxMaUserSafetyRiskRankRequest.builder() .appid("") .openid("") .scene(1) .isTest(true) .build(); WxMaUserSafetyRiskRankResponse wxMaUserSafetyRiskRankResponse = this.wxService.getSecurityService().getUserRiskRank(wxMaUserSafetyRiskRankRequest); assertNotNull(wxMaUserSafetyRiskRankResponse); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaInternetServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaInternetServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.internet.WxMaInternetResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; /** * 服务端网络相关接口测试 * * @author <a href="https://github.com/chutian0124">chutian0124</a> * created on 2021-09-06 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaInternetServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetUserEncryptKey2() throws Exception { String openid = "ogu-84hVFTbTt-myGisQESoDJ6BM"; String sessionKey = "9ny8n3t0KULoi0deF7T9pw=="; WxMaInternetResponse response = this.wxService.getInternetService().getUserEncryptKey(openid, sessionKey); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveMemberServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.gson.JsonArray; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; /** * 测试. * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2021-02-15 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaLiveMemberServiceImplTest { @Inject private WxMaService wxService; @Test public void testAddRole() throws WxErrorException { final String result = this.wxService.getLiveMemberService().addRole("abc", 1); System.out.println(result); } @Test public void testDeleteRole() throws WxErrorException { final String result = this.wxService.getLiveMemberService().deleteRole("abc", 1); System.out.println(result); } @Test public void testListByRole() throws WxErrorException { final JsonArray result = this.wxService.getLiveMemberService().listByRole(null, null, null, null); System.out.println(result); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaPluginServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaPluginServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaPluginListResult; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.testng.Assert.assertNotNull; @Test @Guice(modules = ApiTestModule.class) public class WxMaPluginServiceImplTest { @Inject private WxMaService wxService; @Test public void testApplyPlugin() throws Exception { this.wxService.getPluginService().applyPlugin("wx4418e3e031e551be", null); } @Test public void testGetPluginList() throws Exception { WxMaPluginListResult result = this.wxService.getPluginService().getPluginList(); assertNotNull(result); System.out.println(result.toString()); } @Test public void testUnbindPlugin() throws Exception { this.wxService.getPluginService().unbindPlugin("wx4418e3e031e551be"); } @Test public void testUpdatePlugin() throws Exception { this.wxService.getPluginService().updatePlugin("wx4418e3e031e551be", "2.0.2"); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaMsgServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.bean.*; import cn.binarywang.wx.miniapp.constant.WxMaConstants; import org.testng.annotations.*; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.test.TestConfig; import com.google.common.collect.Lists; import com.google.gson.JsonObject; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import static org.assertj.core.api.Assertions.assertThat; /** * 测试消息相关接口 * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaMsgServiceImplTest { @Inject private WxMaService wxService; @Test public void testSendKefuMsg() throws WxErrorException { TestConfig config = (TestConfig) this.wxService.getWxMaConfig(); WxMaKefuMessage message = WxMaKefuMessage.newTextBuilder() .toUser(config.getOpenid()) .content("欢迎欢迎,热烈欢迎\n换行测试\n超链接:<a href=\"http://www.baidu.com\">Hello World</a>") .build(); this.wxService.getMsgService().sendKefuMsg(message); } @Test public void testSendSubscribeMsg() throws WxErrorException { TestConfig config = (TestConfig) this.wxService.getWxMaConfig(); WxMaSubscribeMessage message = new WxMaSubscribeMessage(); message.setTemplateId(config.getTemplateId()); message.setToUser(config.getOpenid()); message.setLang(WxMaConstants.MiniProgramLang.ZH_CN); message.setMiniprogramState(WxMaConstants.MiniProgramState.FORMAL); message.addData(new WxMaSubscribeMessage.MsgData("thing1", "苹果到货啦")); message.addData(new WxMaSubscribeMessage.MsgData("amount3", "¥5")); message.addData(new WxMaSubscribeMessage.MsgData("thing5", "记得领取哦")); this.wxService.getMsgService().sendSubscribeMsg(message); } @Test public void testSendUniformMsg() throws WxErrorException { TestConfig config = (TestConfig) this.wxService.getWxMaConfig(); WxMaUniformMessage message = WxMaUniformMessage.builder() .isMpTemplateMsg(false) .toUser(config.getOpenid()) .page("page/page/index") .templateId("TEMPLATE_ID") .formId("FORMID") .emphasisKeyword("keyword1.DATA") .build(); message.addData(new WxMaTemplateData("keyword1", "339208499")) .addData(new WxMaTemplateData("keyword2", "2015年01月05日 12:30")) .addData(new WxMaTemplateData("keyword3", "腾讯微信总部")) .addData(new WxMaTemplateData("keyword4", "广州市海珠区新港中路397号")); this.wxService.getMsgService().sendUniformMsg(message); } @Test public void testCreateUpdatableMessageActivityId() throws WxErrorException { final JsonObject jsonObject = this.wxService.getMsgService().createUpdatableMessageActivityId(); assertThat(jsonObject).isNotNull(); assertThat(jsonObject.get("activity_id")).isNotNull(); System.out.println(jsonObject.get("activity_id")); assertThat(jsonObject.get("expiration_time")).isNotNull(); } @Test public void testSetUpdatableMsg() throws WxErrorException { this.wxService.getMsgService().setUpdatableMsg(new WxMaUpdatableMsg() .setActivityId("1048_4f61uDloWPZl9pAs1dGx07vDiHKZ7FwJ0suohS1iMH5z8zhFktYk4nRqqBY~") .setTargetState(1) .setTemplateInfo(new WxMaUpdatableMsg.TemplateInfo() .setParameterList(Lists.newArrayList(new WxMaUpdatableMsg.Parameter().setName("member_count").setValue("1"))))); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLiveGoodsServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.live.WxMaLiveGoodInfo; import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import java.math.BigDecimal; import java.util.Arrays; import static org.testng.Assert.assertNotNull; /** * 测试直播商品管理相关的接口 * * @author <a href="https://github.com/lipengjun92">lipengjun (939961241@qq.com)</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaLiveGoodsServiceImplTest { @Inject private WxMaService wxService; @Test public void addGoods() throws Exception { //上传临时素材 WxMediaUploadResult mediaUpload = this.wxService.getMediaService() .uploadMedia("image", new File("./static/temp.jpg")); WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo(); goods.setCoverImgUrl(mediaUpload.getMediaId()); goods.setName("宫廷奢华真丝四件套"); goods.setPrice(BigDecimal.valueOf(1599)); goods.setPrice2(BigDecimal.ZERO); goods.setPriceType(1); goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad"); WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().addGoods(goods); assertNotNull(liveResult); System.out.println(liveResult); } @Test public void resetAudit() throws Exception { boolean result = this.wxService.getLiveGoodsService().resetAudit(715138516, 9); System.out.println(result); } @Test public void auditGoods() throws Exception { String result = this.wxService.getLiveGoodsService().auditGoods(9); System.out.println(result); } @Test public void deleteGoods() throws Exception { boolean result = this.wxService.getLiveGoodsService().deleteGoods(9); System.out.println(result); } @Test public void updateGoods() throws Exception { WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo(); goods.setGoodsId(8); goods.setName("宫廷奢华真丝四件套"); goods.setCoverImgUrl("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuUQE0WPVfqdnLV61JDhluXOac7PiaoZeticFpcR7wvicC0aXUC2VXkl7r1gN0QSKosv2satn6oCFeiaQ/0"); goods.setPrice(BigDecimal.valueOf(2299)); goods.setPrice2(BigDecimal.ZERO); goods.setPriceType(1); goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad"); boolean maLiveInfo = this.wxService.getLiveGoodsService().updateGoods(goods); System.out.println(maLiveInfo); } @Test public void getGoodsWareHouse() throws Exception { WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getGoodsWareHouse(Arrays.asList(1, 2)); assertNotNull(liveResult); System.out.println(liveResult); } @Test public void getApprovedGoods() throws Exception { WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getApprovedGoods(0, 4, 2); assertNotNull(liveResult); System.out.println(liveResult); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaMediaServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaMediaServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import java.io.IOException; import java.io.InputStream; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertTrue; /** * 临时素材接口的测试 * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaMediaServiceImplTest { @Inject protected WxMaService wxService; private String mediaId; @Test public void testUploadMedia() throws WxErrorException, IOException { String mediaType = "image"; String fileType = "png"; String fileName = "tmp.png"; try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)) { WxMediaUploadResult res = this.wxService.getMediaService().uploadMedia(mediaType, fileType, inputStream); assertNotNull(res.getType()); assertNotNull(res.getCreatedAt()); assertTrue(res.getMediaId() != null || res.getThumbMediaId() != null); this.mediaId = res.getMediaId(); System.out.println(res); } } @Test(dependsOnMethods = {"testUploadMedia"}) public void testGetMedia() throws WxErrorException { File file = this.wxService.getMediaService().getMedia(this.mediaId); assertNotNull(file); System.out.println(file.getAbsolutePath()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopImgServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopImgServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadCustomizeResult; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import static org.assertj.core.api.Assertions.assertThat; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopImgServiceImplTest { @Inject private WxMaService wxService; @Test public void testUploadImg() throws WxErrorException { File file = new File("/Users/liming/Desktop/test.jpeg"); WxMinishopImageUploadCustomizeResult result = wxService.getShopImgService().uploadImg(file); assertThat(result).isNotNull(); } @Test public void testUploadImg2() throws WxErrorException { File file = new File("/Users/liming/Desktop/test.jpeg"); WxMinishopImageUploadCustomizeResult result = wxService.getShopImgService().uploadImg(file, "1"); assertThat(result).isNotNull(); } @Test public void testUploadImg3() throws WxErrorException { String imgUrl = "https://www.example.com/demo.jpg"; WxMinishopImageUploadCustomizeResult result = wxService.getShopImgService().uploadImg(imgUrl, "1"); assertThat(result).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAfterSaleServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleAddRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleGetRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAfterSaleUpdateRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopEcAfterSaleGetRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAfterSaleGetResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopEcAfterSaleGetResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.Arrays; import static org.assertj.core.api.Assertions.assertThat; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopAfterSaleServiceImplTest { @Inject private WxMaService wxService; @Test public void testAdd() throws WxErrorException { WxMaShopAfterSaleAddRequest.ProductInfosBean productInfosBean = WxMaShopAfterSaleAddRequest.ProductInfosBean.builder() .outProductId("19030") .outSkuId("123266") .productCnt(1) .build(); WxMaShopAfterSaleAddRequest request = WxMaShopAfterSaleAddRequest.builder() .outOrderId("318070290792415232X") .outAftersaleId("318092069606883328X") .openid("odIi15CuQ0IQviqsnUMy6CKNetrMX") .type(1) .status(1) .finishAllAftersale(0) .path("/pages/aftersale.html?out_aftersale_id=318092069606883328X") .refund(100L) .productInfo(productInfosBean) .build(); WxMaShopBaseResponse response = wxService.getShopAfterSaleService().add(request); assertThat(response).isNotNull(); } @Test public void testGet() throws WxErrorException { WxMaShopAfterSaleGetRequest request = WxMaShopAfterSaleGetRequest.builder() .openid("oTVP50O53a7jgmawAmxKukNlq3XI") .orderId(32434234L) .outOrderId("xxxxx") .build(); WxMaShopAfterSaleGetResponse response = wxService.getShopAfterSaleService().get(request); assertThat(response).isNotNull(); } @Test public void testUpdate() throws WxErrorException { WxMaShopAfterSaleUpdateRequest request = WxMaShopAfterSaleUpdateRequest.builder() .outOrderId("xxxxx") .openid("oTVP50O53a7jgmawAmxKukNlq3XI") .outAftersaleId("xxxxxx") .status(1) .finishAllAftersale(0) .build(); WxMaShopBaseResponse response = wxService.getShopAfterSaleService().update(request); assertThat(response).isNotNull(); } @Test public void testEcGet() throws WxErrorException { WxMaShopEcAfterSaleGetRequest request = WxMaShopEcAfterSaleGetRequest.builder() .aftersaleId(123L) .outAftersaleId("aso_123124341") .build(); WxMaShopEcAfterSaleGetResponse response = wxService.getShopAfterSaleService().get(request); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaVodServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaVodServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.vod.*; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.List; import static org.testng.Assert.assertNotNull; @Test @Guice(modules = ApiTestModule.class) public class WxMaVodServiceImplTest { @Inject private WxMaService wxService; @Test public void testListMedia() throws Exception { WxMaVodListMediaRequest request = WxMaVodListMediaRequest.builder() .dramaId(100000) .offset(0) .limit(100) .build(); List<WxMaVodMediaInfo> response = this.wxService.getWxMaVodService().listMedia(request); assertNotNull(response); } @Test public void testListDrama() throws Exception { WxMaVodListDramaRequest request = WxMaVodListDramaRequest.builder() .offset(0) .limit(100) .build(); List<WxMaVodDramaInfo> response = this.wxService.getWxMaVodService().listDrama(request); assertNotNull(response); } @Test public void testGetMediaLink() throws Exception { WxMaVodGetMediaLinkRequest request = WxMaVodGetMediaLinkRequest.builder() .mediaId(10000) .build(); WxMaVodMediaPlaybackInfo response = this.wxService.getWxMaVodService().getMediaLink(request); assertNotNull(response); } @Test public void testGetMedia() throws Exception { WxMaVodGetMediaRequest request = WxMaVodGetMediaRequest.builder() .mediaId(0) .build(); WxMaVodMediaInfo response = this.wxService.getWxMaVodService().getMedia(request); assertNotNull(response); } @Test public void testDeleteMedia() throws Exception { WxMaVodDeleteMediaRequest request = WxMaVodDeleteMediaRequest.builder() .mediaId(0) .build(); boolean response = this.wxService.getWxMaVodService().deleteMedia(request); assertNotNull(response); } @Test public void testGetDrama() throws Exception { WxMaVodGetDramaRequest request = WxMaVodGetDramaRequest.builder() .dramaId(0) .build(); WxMaVodDramaInfo response = this.wxService.getWxMaVodService().getDrama(request); assertNotNull(response); } @Test public void testAuditDrama() throws Exception { WxMaVodAuditDramaRequest request = WxMaVodAuditDramaRequest.builder() .dramaId(0) .name("name") .build(); Integer response = this.wxService.getWxMaVodService().auditDrama(request); assertNotNull(response); } @Test public void testGetTask() throws Exception { WxMaVodGetTaskRequest request = WxMaVodGetTaskRequest.builder() .taskId(0) .build(); WxMaVodGetTaskResponse response = this.wxService.getWxMaVodService().getTask(request); assertNotNull(response); } @Test public void testPullUpload() throws Exception { WxMaVodPullUploadRequest request = WxMaVodPullUploadRequest.builder() .coverUrl("") .mediaUrl("") .mediaName("我的中国梦 - 第1集") .sourceContext("") .build(); WxMaVodPullUploadResponse response = this.wxService.getWxMaVodService().pullUpload(request); assertNotNull(response); } @Test public void testGetCdnUsageData() throws Exception { WxMaVodGetCdnUsageRequest request = WxMaVodGetCdnUsageRequest.builder() .startTime(0L) .endTime(0L) .dataInterval(1440) .build(); WxMaVodGetCdnUsageResponse response = this.wxService.getWxMaVodService().getCdnUsageData(request); assertNotNull(response); } @Test public void testGetCdnLogs() throws Exception { WxMaVodGetCdnLogRequest request = WxMaVodGetCdnLogRequest.builder() .startTime(0L).endTime(0L) .offset(0).limit(100) .build(); WxMaVodGetCdnLogResponse response = this.wxService.getWxMaVodService().getCdnLogs(request); assertNotNull(response); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaQrcodeServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaQrcodeServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.io.File; import static org.assertj.core.api.Assertions.assertThat; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaQrcodeServiceImplTest { @Inject private WxMaService wxService; @Test public void testCreateQrcode() throws Exception { final File qrCode = this.wxService.getQrcodeService().createQrcode("111", 122); assertThat(qrCode).isNotNull(); } @Test public void testCreateWxaCode() throws Exception { final File wxCode = this.wxService.getQrcodeService().createWxaCode("111", 122); assertThat(wxCode).isNotNull(); } @Test public void testCreateWxaCodeUnlimit() throws Exception { final File wxCode = this.wxService.getQrcodeService().createWxaCodeUnlimit("111", null); assertThat(wxCode).isNotNull(); } @Test public void testCreateQrcodeBytes() throws WxErrorException { final byte[] qrCode = this.wxService.getQrcodeService().createQrcodeBytes("111", 122); assertThat(qrCode).isNotNull(); } @Test public void testCreateWxaCodeBytes() throws WxErrorException { final byte[] wxCode = this.wxService.getQrcodeService().createWxaCodeBytes("111", null, 122, true, null, false); assertThat(wxCode).isNotNull(); } @Test public void testCreateWxaCodeUnlimitBytes() throws WxErrorException { final byte[] wxCode = this.wxService.getQrcodeService().createWxaCodeUnlimitBytes("111", "pages/unknown", false, "trial", 122, true, null, false); assertThat(wxCode).isNotNull(); } @Test public void testCreateQrcodeByFile() throws WxErrorException { final File qrCode = this.wxService.getQrcodeService().createQrcode("111", "/opt/logs"); assertThat(qrCode).isNotNull(); } @Test public void testCreateWxaCodeByFile() throws WxErrorException { final File wxCode = this.wxService.getQrcodeService().createWxaCode("111", "/opt/logs"); assertThat(wxCode).isNotNull(); } @Test public void testCreateQrcodeUnlimitByFile() throws WxErrorException { final File wxCode = this.wxService.getQrcodeService().createWxaCodeUnlimit("111", null, "/opt/logs"); assertThat(wxCode).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaIntracityServiceImpleTest.java
package cn.binarywang.wx.miniapp.api.impl; import static org.testng.AssertJUnit.*; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.intractiy.*; import cn.binarywang.wx.miniapp.bean.openapi.WxMiniGetApiQuotaResult; import cn.binarywang.wx.miniapp.constant.WxMaApiUrlConstants; import cn.binarywang.wx.miniapp.test.ApiTestModule; import cn.binarywang.wx.miniapp.test.TestConfig; import com.google.gson.JsonObject; import com.google.inject.Inject; import java.util.ArrayList; import java.util.List; import me.chanjar.weixin.common.bean.ToJson; import me.chanjar.weixin.common.error.WxErrorException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Guice; import org.testng.annotations.Test; @Test @Guice(modules = ApiTestModule.class) public class WxMaIntracityServiceImpleTest { private static final Logger logger = LoggerFactory.getLogger(WxMaIntracityServiceImpleTest.class); @Inject private WxMaService wxService; @Test public void testApiSignature() throws Exception { WxMiniGetApiQuotaResult result = wxService .getWxMaOpenApiService() .getApiQuota( WxMaApiUrlConstants.Intracity.APPLY_URL.substring( "https://api.weixin.qq.com".length())); logger.info("apply 额度剩余 :{}", result.getQuota()); } @Test public void testApiGetPostNullData() throws Exception { try { wxService.get(WxMaApiUrlConstants.Analysis.GET_USER_PORTRAIT_URL, null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 get(url, null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } // 走加密路径url try { wxService.post(WxMaApiUrlConstants.OpenApi.CLEAR_QUOTA, (Object) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, Object null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.OpenApi.CLEAR_QUOTA, (String) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, String null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.OpenApi.CLEAR_QUOTA, (JsonObject) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, JsonObject null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.OpenApi.CLEAR_QUOTA, (ToJson) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, ToJson null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } // 不走加密路径URL try { wxService.post(WxMaApiUrlConstants.Intracity.APPLY_URL, (Object) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, Object null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.Intracity.APPLY_URL, (String) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, String null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.Intracity.APPLY_URL, (JsonObject) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, JsonObject null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } try { wxService.post(WxMaApiUrlConstants.Intracity.APPLY_URL, (ToJson) null); } catch (NullPointerException npe) { logger.error("NullPointerException", npe); fail("遇到空指针 post(url, ToJson null)"); } catch (WxErrorException wxErrorException) { // 这个是正常的,因为这里的调用没按照接口规则 } } @Test public void testApply() throws Exception { logger.debug("testApply"); try { wxService.getIntracityService().apply(); } catch (WxErrorException wxEx) { if (wxEx.getError().getErrorCode() == 45009) { // 调用分钟频率受限 } else { throw wxEx; } } } @Test public void testStoreRelatedApis() throws Exception { WxMaStore store = new WxMaStore(); store.setStoreName("南京东路店"); store.setOutStoreId("njdl-001"); WxMaStore.AddressInfo addr = new WxMaStore.AddressInfo(); addr.setProvince("上海市"); addr.setCity("上海市"); addr.setArea("黄浦区"); addr.setStreet(""); addr.setHouse("南京东路690号"); addr.setLat(31.235318); addr.setLng(121.477284); addr.setPhone("021-23456789"); store.setAddressInfo(addr); String wxStoreId; List<WxMaStore> result = wxService.getIntracityService().queryStoreByOutStoreId(store.getOutStoreId()); if (result.isEmpty()) { wxStoreId = wxService.getIntracityService().createStore(store); logger.debug("create store result:{}", wxStoreId); } else { wxStoreId = result.get(0).getWxStoreId(); } store.setWxStoreId(wxStoreId); addr.setPhone("021-23450000"); store.setStoreName(null); wxService.getIntracityService().updateStore(store); List<WxMaStore> stores = wxService.getIntracityService().listAllStores(); logger.info("listAllStores 查询到 {} 个门店 {}", stores.size(), stores); if (stores.size() > 0) { WxMaStore s = wxService.getIntracityService().queryStoreByWxStoreId(stores.get(0).getWxStoreId()); assertNotNull(s); List<WxMaStore> list = wxService.getIntracityService().queryStoreByOutStoreId(stores.get(0).getOutStoreId()); logger.info("queryStoreByOutStoreId 查询到 {} 个门店 {}", list.size(), list); } } @Test public void testStoreChargeRelated() throws Exception { List<WxMaStore> stores = wxService.getIntracityService().listAllStores(); if (stores.isEmpty()) { logger.warn("没有门店,无法测试"); return; } WxMaStore store = stores.get(0); WxMaGetPayModeResponse resp = wxService.getIntracityService().getPayMode(); logger.debug("查询付费主体 {}", resp); PayMode currentPayMode = resp.getPayMode(); // 只能用当前付费模式充值;否则微信接口会返回 错误代码:934025, 错误信息:pay_mode not match WxMaStoreChargeRequest request = new WxMaStoreChargeRequest(); request.setPayMode(currentPayMode); request.setWxStoreId(store.getWxStoreId()); request.setServiceTransId("DADA"); request.setAmount(5000); String payUrl = wxService.getIntracityService().storeCharge(request); logger.debug("充值URL:{}", payUrl); // 查询余额 WxMaStoreBalance balance = wxService.getIntracityService().balanceQuery(store.getWxStoreId(), null, PayMode.STORE); logger.debug("余额 {}", balance); // 退款 WxMaStoreRefundRequest rr = new WxMaStoreRefundRequest(); rr.setPayMode(PayMode.STORE); rr.setWxStoreId(store.getWxStoreId()); rr.setServiceTransId("DADA"); int refundAmount = wxService.getIntracityService().storeRefund(rr); logger.debug("退款:{}", refundAmount); // 查询流水 WxMaQueryFlowRequest qfr = new WxMaQueryFlowRequest(); qfr.setWxStoreId(store.getWxStoreId()); WxMaStoreFlowResponse flowResponse = wxService.getIntracityService().queryFlow(qfr); logger.debug("查询流水 {}", flowResponse); } @Test public void testPayMode() throws Exception { WxMaGetPayModeResponse resp = wxService.getIntracityService().getPayMode(); logger.debug("查询付费主体 {}", resp); PayMode newMode = resp.getPayMode() == PayMode.APP ? PayMode.STORE : PayMode.APP; logger.debug("set pay mode to {}", newMode); wxService.getIntracityService().setPayMode(newMode); WxMaGetPayModeResponse resp2 = wxService.getIntracityService().getPayMode(); logger.debug("查询付费主体 {}", resp2); } @Test public void testGetCity() throws Exception { List<WxMaTransCity> list = wxService.getIntracityService().getCity(null); logger.debug("支持的城市 {}", list); List<WxMaTransCity> list2 = wxService.getIntracityService().getCity("SFTC"); logger.debug("SFTC支持的城市有{}个", list2.get(0).getCityList().size()); } @Test public void testOrderRelatived() throws Exception { List<WxMaStore> stores = wxService.getIntracityService().listAllStores(); if (stores.isEmpty()) { logger.warn("没有门店,无法测试"); return; } String wxStoreId = stores.get(0).getWxStoreId(); { WxMaPreAddOrderRequest request = new WxMaPreAddOrderRequest(); request.setWxStoreId(wxStoreId); request.setUseSandbox(1); request.setUserName("顺丰同城"); request.setUserPhone("13800000138"); request.setUserAddress("北京市海淀区学清嘉创大厦A座15层"); request.setUserLat(40.01496); request.setUserLng(116.353093); WxMaPreAddOrderRequest.Cargo cargo = new WxMaPreAddOrderRequest.Cargo(); cargo.setCargoName("蛋糕"); cargo.setCargoType(13); cargo.setCargoNum(1); cargo.setCargoPrice(10000); cargo.setCargoWeight(1000); request.setCargo(cargo); WxMaPreAddOrderResponse response = wxService.getIntracityService().preAddOrder(request); logger.debug("查询运费返回 {}, 预估运费{}元", response, response.getEstFee() / 100.0); } String wxOrderId = null; { TestConfig config = (TestConfig) this.wxService.getWxMaConfig(); WxMaAddOrderRequest request = new WxMaAddOrderRequest(); request.setWxStoreId(wxStoreId); request.setStoreOrderId("store-order-" + System.currentTimeMillis()); request.setOrderSeq("0001"); request.setUserOpenid(config.getOpenid()); request.setUseSandbox(1); request.setUserName("顺丰同城"); request.setUserPhone("13800000138"); request.setUserAddress("北京市海淀区学清嘉创大厦A座15层"); request.setUserLat(40.01496); request.setUserLng(116.353093); request.setOrderDetailPath("/pages/user-center/order/detail/detail?id=xxx"); WxMaAddOrderRequest.Cargo cargo = new WxMaAddOrderRequest.Cargo(); cargo.setCargoName("蛋糕"); cargo.setCargoType(13); cargo.setCargoNum(1); cargo.setCargoPrice(10000); cargo.setCargoWeight(1000); WxMaAddOrderRequest.ItemDetail detail = new WxMaAddOrderRequest.ItemDetail(); detail.setItemName("蛋糕A"); detail.setItemPicUrl("https://www.somehost.com/aaa.jpg"); detail.setCount(1); List<WxMaAddOrderRequest.ItemDetail> itemList = new ArrayList<>(); itemList.add(detail); cargo.setItemList(itemList); request.setCargo(cargo); WxMaAddOrderResponse response = wxService.getIntracityService().addOrder(request); wxOrderId = response.getWxOrderId(); logger.debug("创建订单返回 {}, wxOrderId:{}", response, wxOrderId); } WxMaOrder order = wxService.getIntracityService().queryOrderByWxOrderId(wxOrderId); logger.debug("查询订单返回 {}, storeOrderId:{} ", order, order.getStoreOrderId()); WxMaOrder order2 = wxService .getIntracityService() .queryOrderByStoreOrderId(wxStoreId, order.getStoreOrderId()); logger.debug("查询订单返回 {}, ", order); assertEquals(order2.getWxOrderId(), wxOrderId); WxMaCancelOrderResponse cancelOrderResp = wxService.getIntracityService().cancelOrderByWxOrderId(wxOrderId, 1, "不再需要"); logger.debug("取消订单返回 {}, 扣费:{} ", cancelOrderResp, cancelOrderResp.getDeductfee()); try { wxService .getIntracityService() .cancelOrderByStoreOrderId(wxStoreId, order.getStoreOrderId(), 1, "不再需要"); fail("重复取消未抛异常,疑似第一次取消未成功"); } catch (WxErrorException wxErrorException) { // 订单已经被取消了,重复取消会报错,这里才正常 } } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaKefuServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaKefuServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaKefuService; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfList; import cn.binarywang.wx.miniapp.bean.kefu.request.WxMaKfAccountRequest; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.Assert; import org.testng.annotations.Test; import static org.mockito.ArgumentMatchers.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; /** * 小程序客服管理服务测试. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaKefuServiceImplTest { @Test public void testKfList() throws WxErrorException { WxMaService service = mock(WxMaService.class); when(service.get(anyString(), any())).thenReturn("{\"kf_list\":[]}"); WxMaKefuService kefuService = new WxMaKefuServiceImpl(service); WxMaKfList result = kefuService.kfList(); Assert.assertNotNull(result); Assert.assertNotNull(result.getKfList()); Assert.assertEquals(result.getKfList().size(), 0); } @Test public void testKfAccountAdd() throws WxErrorException { WxMaService service = mock(WxMaService.class); when(service.post(anyString(), anyString())).thenReturn("{\"errcode\":0}"); WxMaKefuService kefuService = new WxMaKefuServiceImpl(service); WxMaKfAccountRequest request = WxMaKfAccountRequest.builder() .kfAccount("test@kfaccount") .kfNick("测试客服") .kfPwd("password") .build(); boolean result = kefuService.kfAccountAdd(request); Assert.assertTrue(result); } @Test public void testKfSessionCreate() throws WxErrorException { WxMaService service = mock(WxMaService.class); when(service.post(anyString(), anyString())).thenReturn("{\"errcode\":0}"); WxMaKefuService kefuService = new WxMaKefuServiceImpl(service); boolean result = kefuService.kfSessionCreate("test_openid", "test@kfaccount"); Assert.assertTrue(result); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaJsapiServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaJsapiServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.config.WxMaConfig; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.bean.WxJsapiSignature; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; /** * <pre> * Created by BinaryWang on 2018/8/5. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class WxMaJsapiServiceImplTest { @Inject private WxMaService wxService; @Inject private WxMaConfig wxMaConfig; @Test public void testGetJsapiTicket() throws WxErrorException { assertThat(this.wxService.getJsapiService().getJsapiTicket()).isNotBlank(); } @Test public void testGetJsapiTicket1() throws WxErrorException { assertThat(this.wxService.getJsapiService().getJsapiTicket(true)).isNotBlank(); } @Test public void testCreateJsapiSignature() throws WxErrorException { final WxJsapiSignature jsapiSignature = this.wxService.getJsapiService().createJsapiSignature("http://www.qq.com"); System.out.println(jsapiSignature); assertThat(jsapiSignature).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAccountServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopAccountServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAccountUpdateInfoRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopRegisterApplySceneRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopRegisterFinishAccessInfoRequest; import cn.binarywang.wx.miniapp.bean.shop.response.*; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.annotations.Guice; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; /** * @author liming1019 */ @Test @Guice(modules = ApiTestModule.class) public class WxMaShopAccountServiceImplTest { @Inject private WxMaService wxService; @Test public void testGetCategoryList() throws WxErrorException { WxMaShopAccountGetCategoryListResponse response = this.wxService.getShopAccountService().getCategoryList(); assertThat(response).isNotNull(); } @Test public void testGetBrandList() throws WxErrorException { WxMaShopAccountGetBrandListResponse response = this.wxService.getShopAccountService().getBrandList(); assertThat(response).isNotNull(); } @Test public void testUpdateInfo() throws WxErrorException { WxMaShopAccountUpdateInfoRequest request = new WxMaShopAccountUpdateInfoRequest(); request.setServiceAgentPhone("020-888888"); request.setServiceAgentPath("https://www.web.com"); WxMaShopBaseResponse response = this.wxService.getShopAccountService().updateInfo(request); assertThat(response).isNotNull(); } @Test public void testGetInfo() throws WxErrorException { WxMaShopAccountGetInfoResponse response = this.wxService.getShopAccountService().getInfo(); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaXPayServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaXPayServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; import cn.binarywang.wx.miniapp.bean.xpay.*; import cn.binarywang.wx.miniapp.constant.WxMaConstants; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import static org.testng.Assert.assertNotNull; @Test @Guice(modules = ApiTestModule.class) public class WxMaXPayServiceImplTest { @Inject private WxMaService wxService; @Test public void testQueryUserBalance() throws Exception { WxMaXPayQueryUserBalanceRequest request = WxMaXPayQueryUserBalanceRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .userIp("127.0.0.1") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayQueryUserBalanceResponse response = this.wxService.getWxMaXPayService().queryUserBalance(request, sigParams); assertNotNull(response); } @Test public void testCurrencyPay() throws Exception { WxMaXPayCurrencyPayRequest request = WxMaXPayCurrencyPayRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .userIp("127.0.0.1") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayCurrencyPayResponse response = this.wxService.getWxMaXPayService().currencyPay(request, sigParams); assertNotNull(response); } @Test public void testQueryOrder() throws Exception { WxMaXPayQueryOrderRequest request = WxMaXPayQueryOrderRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .orderId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayQueryOrderResponse response = this.wxService.getWxMaXPayService().queryOrder(request, sigParams); assertNotNull(response); } @Test public void testCancelCurrencyPay() throws Exception { WxMaXPayCancelCurrencyPayRequest request = WxMaXPayCancelCurrencyPayRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .userIp("127.0.0.1") .orderId("") .payOrderId("") .amount(1000L) .deviceType(WxMaConstants.XPayDeviceType.ANDROID) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayCancelCurrencyPayResponse response = this.wxService.getWxMaXPayService().cancelCurrencyPay(request, sigParams); assertNotNull(response); } @Test public void testNotifyProvideGoods() throws Exception { WxMaXPayNotifyProvideGoodsRequest request = WxMaXPayNotifyProvideGoodsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .orderId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); boolean response = this.wxService.getWxMaXPayService().notifyProvideGoods(request, sigParams); assertNotNull(response); } @Test public void testPresentCurrency() throws Exception { WxMaXPayPresentCurrencyRequest request = WxMaXPayPresentCurrencyRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .orderId("").deviceType(WxMaConstants.XPayDeviceType.ANDROID) .amount(100L) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayPresentCurrencyResponse response = this.wxService.getWxMaXPayService().presentCurrency(request, sigParams); assertNotNull(response); } @Test public void testDownloadBill() throws Exception { WxMaXPayDownloadBillRequest request = WxMaXPayDownloadBillRequest.builder() .beginDs(20230801) .endDs(20230810) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayDownloadBillResponse response = this.wxService.getWxMaXPayService().downloadBill(request, sigParams); assertNotNull(response); } @Test public void testRefundOrder() throws Exception { WxMaXPayRefundOrderRequest request = WxMaXPayRefundOrderRequest.builder() .openid("") .env(WxMaConstants.XPayEnv.PRODUCT) .orderId("") .refundOrderId("") .leftFee(100L) .refundFee(10L) .bizMeta("").refundReason("").reqFrom("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayRefundOrderResponse response = this.wxService.getWxMaXPayService().refundOrder(request, sigParams); assertNotNull(response); } @Test public void testCreateWithdrawOrder() throws Exception { WxMaXPayCreateWithdrawOrderRequest request = WxMaXPayCreateWithdrawOrderRequest.builder() .withdrawNo("") .env(WxMaConstants.XPayEnv.PRODUCT) .withdrawAmount("0.01") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayCreateWithdrawOrderResponse response = this.wxService.getWxMaXPayService().createWithdrawOrder(request, sigParams); assertNotNull(response); } @Test public void testQueryWithdrawOrder() throws Exception { WxMaXPayQueryWithdrawOrderRequest request = WxMaXPayQueryWithdrawOrderRequest.builder() .withdrawNo("") .env(WxMaConstants.XPayEnv.PRODUCT) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayQueryWithdrawOrderResponse response = this.wxService.getWxMaXPayService().queryWithdrawOrder(request, sigParams); assertNotNull(response); } @Test public void testStartUploadGoods() throws Exception { WxMaXPayStartUploadGoodsRequest request = WxMaXPayStartUploadGoodsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .uploadItem(new ArrayList<>()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); boolean response = this.wxService.getWxMaXPayService().startUploadGoods(request, sigParams); assertNotNull(response); } @Test public void testQueryUploadGoods() throws Exception { WxMaXPayQueryUploadGoodsRequest request = WxMaXPayQueryUploadGoodsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayQueryUploadGoodsResponse response = this.wxService.getWxMaXPayService().queryUploadGoods(request, sigParams); assertNotNull(response); } @Test public void testStartPublishGoods() throws Exception { WxMaXPayStartPublishGoodsRequest request = WxMaXPayStartPublishGoodsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .publishItem(new ArrayList<>()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); boolean response = this.wxService.getWxMaXPayService().startPublishGoods(request, sigParams); assertNotNull(response); } @Test public void testQueryPublishGoods() throws Exception { WxMaXPayQueryPublishGoodsRequest request = WxMaXPayQueryPublishGoodsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setSessionKey(""); sigParams.setAppKey(""); WxMaXPayQueryPublishGoodsResponse response = this.wxService.getWxMaXPayService().queryPublishGoods(request, sigParams); assertNotNull(response); } @Test public void testQueryBizBalance() throws Exception { WxMaXPayQueryBizBalanceRequest request = WxMaXPayQueryBizBalanceRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayQueryBizBalanceResponse response = this.wxService.getWxMaXPayService().queryBizBalance(request, sigParams); assertNotNull(response); } @Test public void testQueryTransferAccount() throws Exception { WxMaXPayQueryTransferAccountRequest request = WxMaXPayQueryTransferAccountRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayQueryTransferAccountResponse response = this.wxService.getWxMaXPayService().queryTransferAccount(request, sigParams); assertNotNull(response); } @Test public void testQueryAdverFunds() throws Exception { WxMaXPayQueryAdverFundsRequest request = WxMaXPayQueryAdverFundsRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .page(0) .pageSize(10) .filter(new WxMaXPayQueryAdverFundsRequest.Filter()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayQueryAdverFundsResponse response = this.wxService.getWxMaXPayService().queryAdverFunds(request, sigParams); assertNotNull(response); } @Test public void testCreateFundsBill() throws Exception { WxMaXPayCreateFundsBillRequest request = WxMaXPayCreateFundsBillRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .transferAmount(0) .transferAccountUid(0L) .transferAccountName("") .transferAccountAgencyId(0) .requestId("") .settleBegin(0L) .settleEnd(0L) .authorizeAdvertise(0) .fundType(0) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayCreateFundsBillResponse response = this.wxService.getWxMaXPayService().createFundsBill(request, sigParams); assertNotNull(response); } @Test public void testBindTransferAccount() throws Exception { WxMaXPayBindTransferAccountRequest request = WxMaXPayBindTransferAccountRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .transferAccountOrgName("") .transferAccountUid(0L) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaBaseResponse response = this.wxService.getWxMaXPayService().bindTransferAccount(request, sigParams); assertNotNull(response); } @Test public void testQueryFundsBill() throws Exception { WxMaXPayQueryFundsBillRequest request = WxMaXPayQueryFundsBillRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .page(0) .pageSize(10) .filter(new WxMaXPayQueryFundsBillRequest.Filter()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayQueryFundsBillResponse response = this.wxService.getWxMaXPayService().queryFundsBill(request, sigParams); assertNotNull(response); } @Test public void testQueryRecoverBill() throws Exception { WxMaXPayQueryRecoverBillRequest request = WxMaXPayQueryRecoverBillRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .page(0) .pageSize(10) .filter(new WxMaXPayQueryRecoverBillRequest.Filter()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayQueryRecoverBillResponse response = this.wxService.getWxMaXPayService().queryRecoverBill(request, sigParams); assertNotNull(response); } @Test public void testGetComplaintList() throws Exception { WxMaXPayGetComplaintListRequest request = WxMaXPayGetComplaintListRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .beginDate("") .endDate("") .offset(0) .limit(10) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayGetComplaintListResponse response = this.wxService.getWxMaXPayService().getComplaintList(request, sigParams); assertNotNull(response); } @Test public void testGetComplaintDetail() throws Exception { WxMaXPayGetComplaintDetailRequest request = WxMaXPayGetComplaintDetailRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .complaintId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayGetComplaintDetailResponse response = this.wxService.getWxMaXPayService().getComplaintDetail(request, sigParams); assertNotNull(response); } @Test public void testGetNegotiationHistory() throws Exception { WxMaXPayGetNegotiationHistoryRequest request = WxMaXPayGetNegotiationHistoryRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .limit(10) .offset(0) .complaintId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayGetNegotiationHistoryResponse response = this.wxService.getWxMaXPayService().getNegotiationHistory(request, sigParams); assertNotNull(response); } @Test public void testResponseComplaint() throws Exception { WxMaXPayResponseComplaintRequest request = WxMaXPayResponseComplaintRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .complaintId("") .responseContent("") .responseImages(new ArrayList<>()) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaBaseResponse response = this.wxService.getWxMaXPayService().responseComplaint(request, sigParams); assertNotNull(response); } @Test public void testCompleteComplaint() throws Exception { WxMaXPayCompleteComplaintRequest request = WxMaXPayCompleteComplaintRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .complaintId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaBaseResponse response = this.wxService.getWxMaXPayService().completeComplaint(request, sigParams); assertNotNull(response); } @Test public void testUploadVpFile() throws Exception { WxMaXPayUploadVpFileRequest request = WxMaXPayUploadVpFileRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .base64Img("") .fileName("") .imgUrl("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayUploadVpFileResponse response = this.wxService.getWxMaXPayService().uploadVpFile(request, sigParams); assertNotNull(response); } @Test public void testGetUploadFileSign() throws Exception { WxMaXPayGetUploadFileSignRequest request = WxMaXPayGetUploadFileSignRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .wxpayUrl("") .complaintId("") .convertCos(true) .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey(""); WxMaXPayGetUploadFileSignResponse response = this.wxService.getWxMaXPayService().getUploadFileSign(request, sigParams); assertNotNull(response); } @Test public void testDownloadAdverfundsOrder() throws Exception { WxMaXPayDownloadAdverfundsOrderRequest request = WxMaXPayDownloadAdverfundsOrderRequest.builder() .env(WxMaConstants.XPayEnv.PRODUCT) .fundId("") .build(); WxMaXPaySigParams sigParams = new WxMaXPaySigParams(); sigParams.setAppKey("123"); WxMaXPayDownloadAdverfundsOrderResponse response = this.wxService.getWxMaXPayService().downloadAdverfundsOrder(request, sigParams); assertNotNull(response); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLinkServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaLinkServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shortlink.GenerateShortLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.request.QueryUrlLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.response.QueryUrlLinkResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.common.error.WxErrorException; import org.testng.Assert; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.time.LocalDateTime; import java.time.ZoneId; @Test @Guice(modules = ApiTestModule.class) @Slf4j public class WxMaLinkServiceImplTest { @Inject private WxMaService wxMaService; @Test public void testGenerateUrlLink() throws WxErrorException { String url = this.wxMaService.getLinkService().generateUrlLink(GenerateUrlLinkRequest.builder() .path("pages/tabBar/home/home") .expireTime(LocalDateTime.now().plusDays(5).atZone(ZoneId.systemDefault()).toEpochSecond()) //增加有效期,此行可注释 .build()); System.out.println(url); } @Test public void testGenerateShortLink() throws WxErrorException { final String generate = this.wxMaService.getLinkService() .generateShortLink(GenerateShortLinkRequest.builder(). pageUrl("pages/productView/editPhone/editPhone?id=31832") .pageTitle("productView") .isPermanent(false).build()); System.out.println("generate:"); System.out.println(generate); } /** * 多版本链接生成测试 * 开发时,仅支持IOS设备打开体验版及开发版 */ @Test public void testGenerateMultiEnvUrlLink() throws WxErrorException { String url = this.wxMaService.getLinkService().generateUrlLink(GenerateUrlLinkRequest.builder() .path("") .envVersion("trial") .build()); log.info("generate url link = {}", url); } @Test public void testQueryUrlLink() throws WxErrorException { String path = "pages/index"; String urlLink = this.wxMaService.getLinkService().generateUrlLink(GenerateUrlLinkRequest.builder() .path(path) .expireTime(LocalDateTime.now().plusDays(5).atZone(ZoneId.systemDefault()).toEpochSecond()) //增加有效期,此行可注释 .build()); System.out.println("urlLink: " + urlLink); QueryUrlLinkResponse queryUrlLinkResponse = this.wxMaService.getLinkService() .queryUrlLink(QueryUrlLinkRequest.builder().urlLink(urlLink).build()); System.out.println("linkInfo: " + queryUrlLinkResponse.toString()); Assert.assertEquals(path, queryUrlLinkResponse.getUrlLinkInfo().getPath()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopPayServiceImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/api/impl/WxMaShopPayServiceImplTest.java
package cn.binarywang.wx.miniapp.api.impl; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopPayCreateOrderRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayCreateOrderResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopPayGetOrderResponse; import cn.binarywang.wx.miniapp.test.ApiTestModule; import com.google.inject.Inject; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.Arrays; import static org.assertj.core.api.Assertions.assertThat; @Test @Guice(modules = ApiTestModule.class) public class WxMaShopPayServiceImplTest { @Inject private WxMaService wxService; @Test public void testCreateOrder() throws Exception { WxMaShopPayCreateOrderRequest request = WxMaShopPayCreateOrderRequest.builder() .openid("") .combineTradeNo("") .expireTime(1234L) .subOrders(Arrays.asList(WxMaShopPayCreateOrderRequest.SubOrdersDTO.builder() .mchid("") .amount(0) .tradeNo("") .description("") .build() )) .build(); WxMaShopPayCreateOrderResponse response = wxService.getWxMaShopPayService().createOrder(request); assertThat(response).isNotNull(); } @Test public void testGetOrder() throws Exception { WxMaShopPayGetOrderResponse response = wxService.getWxMaShopPayService().getOrder("457243057210572800"); assertThat(response).isNotNull(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaRunStepInfoTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaRunStepInfoTest.java
package cn.binarywang.wx.miniapp.bean; import java.util.List; import org.testng.annotations.*; import static org.assertj.core.api.Assertions.assertThat; /** * <pre> * * Created by Binary Wang on 2018/11/4. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaRunStepInfoTest { @Test public void testFromJson() { // 数据来源:https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html String json = "{\n" + " \"stepInfoList\": [\n" + " {\n" + " \"timestamp\": 1445866601,\n" + " \"step\": 100\n" + " },\n" + " {\n" + " \"timestamp\": 1445876601,\n" + " \"step\": 120\n" + " }\n" + " ]\n" + "}"; final List<WxMaRunStepInfo> stepInfoList = WxMaRunStepInfo.fromJson(json); assertThat(stepInfoList).isNotEmpty(); assertThat(stepInfoList.get(0).getStep()).isEqualTo(100); assertThat(stepInfoList.get(0).getTimestamp()).isEqualTo(1445866601); assertThat(stepInfoList.get(1).getStep()).isEqualTo(120); assertThat(stepInfoList.get(1).getTimestamp()).isEqualTo(1445876601); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaKefuMessageTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaKefuMessageTest.java
package cn.binarywang.wx.miniapp.bean; import org.testng.annotations.*; import static org.assertj.core.api.Assertions.assertThat; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test public class WxMaKefuMessageTest { public void testTextBuilder() { WxMaKefuMessage reply = WxMaKefuMessage.newTextBuilder() .toUser("OPENID") .content("sfsfdsdf") .build(); assertThat(reply.toJson()) .isEqualTo("{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}"); } public void testImageBuilder() { WxMaKefuMessage reply = WxMaKefuMessage.newImageBuilder() .toUser("OPENID") . mediaId("MEDIA_ID") .build(); assertThat(reply.toJson()) .isEqualTo( "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}"); } public void testLinkBuilder() { WxMaKefuMessage reply = WxMaKefuMessage.newLinkBuilder() .toUser("OPENID") .url("url") .description("description") .title("title") .thumbUrl("thumbUrl") .build(); assertThat(reply.toJson()) .isEqualTo( "{\"touser\":\"OPENID\",\"msgtype\":\"link\"," + "\"link\":{\"title\":\"title\",\"description\":\"description\",\"url\":\"url\",\"thumb_url\":\"thumbUrl\"}}"); } public void testMaPageBuilder() { WxMaKefuMessage reply = WxMaKefuMessage.newMaPageBuilder() .toUser("OPENID") .title("title") .pagePath("pagePath") .thumbMediaId("thumbMediaId") .build(); assertThat(reply.toJson()) .isEqualTo( "{\"touser\":\"OPENID\",\"msgtype\":\"miniprogrampage\"," + "\"miniprogrampage\":{\"title\":\"title\",\"pagepath\":\"pagePath\",\"thumb_media_id\":\"thumbMediaId\"}}"); } public void testURLEscaped() { WxMaKefuMessage reply = WxMaKefuMessage.newLinkBuilder() .toUser("OPENID") .url("https://mp.weixin.qq.com/s?__biz=MzI0MDA2OTY5NQ==") .description("description") .title("title") .thumbUrl("thumbUrl") .build(); assertThat(reply.toJson()) .isEqualTo( "{\"touser\":\"OPENID\",\"msgtype\":\"link\"," + "\"link\":{\"title\":\"title\",\"description\":\"description\",\"url\":\"https://mp.weixin.qq.com/s?__biz=MzI0MDA2OTY5NQ==\",\"thumb_url\":\"thumbUrl\"}}"); } public void testTextBuilderWithAiMsgContext() { WxMaKefuMessage reply = WxMaKefuMessage.newTextBuilder() .toUser("OPENID") .content("回复内容") .aiMsgContextMsgId("MSG_ID_123") .build(); assertThat(reply.toJson()) .isEqualTo("{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"回复内容\"},\"aimsgcontext\":{\"msgid\":\"MSG_ID_123\"}}"); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/WxMaMessageTest.java
package cn.binarywang.wx.miniapp.bean; import me.chanjar.weixin.common.api.WxConsts; import org.testng.annotations.Test; import java.util.List; import java.util.Map; import static org.assertj.core.api.Assertions.as; import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test public class WxMaMessageTest { public void testFromXml() { String xml = "<xml>\n" + " <ToUserName><![CDATA[toUser]]></ToUserName>\n" + " <FromUserName><![CDATA[fromUser]]></FromUserName>\n" + " <CreateTime>1482048670</CreateTime>\n" + " <MsgType><![CDATA[text]]></MsgType>\n" + " <Content><![CDATA[this is a test]]></Content>\n" + " <MsgId>1234567890123456</MsgId>\n" + " <PicUrl><![CDATA[this is a url]]></PicUrl>\n" + " <MediaId><![CDATA[media_id]]></MediaId>\n" + " <Title><![CDATA[Title]]></Title>\n" + " <AppId><![CDATA[AppId]]></AppId>\n" + " <PagePath><![CDATA[PagePath]]></PagePath>\n" + " <ThumbUrl><![CDATA[ThumbUrl]]></ThumbUrl>\n" + " <ThumbMediaId><![CDATA[ThumbMediaId]]></ThumbMediaId>\n" + " <Event><![CDATA[user_enter_tempsession]]></Event>\n" + " <SessionFrom><![CDATA[sessionFrom]]></SessionFrom>\n" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); assertEquals(wxMessage.getToUser(), "toUser"); assertEquals(wxMessage.getFromUser(), "fromUser"); assertEquals(wxMessage.getCreateTime(), new Integer(1482048670)); assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.TEXT); assertEquals(wxMessage.getContent(), "this is a test"); assertEquals(wxMessage.getMsgId(), new Long(1234567890123456L)); assertEquals(wxMessage.getPicUrl(), "this is a url"); assertEquals(wxMessage.getMediaId(), "media_id"); assertEquals(wxMessage.getTitle(), "Title"); assertEquals(wxMessage.getPagePath(), "PagePath"); assertEquals(wxMessage.getThumbUrl(), "ThumbUrl"); assertEquals(wxMessage.getThumbMediaId(), "ThumbMediaId"); assertEquals(wxMessage.getAppId(), "AppId"); assertEquals(wxMessage.getEvent(), "user_enter_tempsession"); assertEquals(wxMessage.getSessionFrom(), "sessionFrom"); } public void testSubscribeMsgPopupEvent() { // xml 格式 String xml = "<xml>" + "<ToUserName><![CDATA[gh_123456789abc]]></ToUserName>\n" + "<FromUserName><![CDATA[otFpruAK8D-E6EfStSYonYSBZ8_4]]></FromUserName>\n" + "<CreateTime>1610969440</CreateTime>\n" + "<MsgType><![CDATA[event]]></MsgType>\n" + "<Event><![CDATA[subscribe_msg_popup_event]]></Event>\n" + "<SubscribeMsgPopupEvent>\n" + " <List>\n" + " <TemplateId><![CDATA[VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc]]></TemplateId>\n" + " <SubscribeStatusString><![CDATA[accept]]></SubscribeStatusString>\n" + " <PopupScene>0</PopupScene>\n" + " </List>\n" + "</SubscribeMsgPopupEvent>" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); checkSubscribeMsgPopupEvent(wxMessage); // 订阅单个模板 json格式 (对象) String json = "{\n" + " \"ToUserName\": \"gh_123456789abc\",\n" + " \"FromUserName\": \"otFpruAK8D-E6EfStSYonYSBZ8_4\",\n" + " \"CreateTime\": \"1610969440\",\n" + " \"MsgType\": \"event\",\n" + " \"Event\": \"subscribe_msg_popup_event\",\n" + " \"List\": {\n" + " \"TemplateId\": \"VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc\",\n" + " \"SubscribeStatusString\": \"accept\",\n" + " \"PopupScene\": \"0\"\n" + " }\n" + " }"; wxMessage = WxMaMessage.fromJson(json); checkSubscribeMsgPopupEvent(wxMessage); // 订阅多条模板的 json格式(数组) json = "{\n" + " \"ToUserName\": \"gh_123456789abc\",\n" + " \"FromUserName\": \"otFpruAK8D-E6EfStSYonYSBZ8_4\",\n" + " \"CreateTime\": \"1610969440\",\n" + " \"MsgType\": \"event\",\n" + " \"Event\": \"subscribe_msg_popup_event\",\n" + " \"List\": [{\n" + " \"TemplateId\": \"VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc\",\n" + " \"SubscribeStatusString\": \"accept\",\n" + " \"PopupScene\": \"0\"\n" + " }]\n" + " }"; wxMessage = WxMaMessage.fromJson(json); checkSubscribeMsgPopupEvent(wxMessage); } private void checkSubscribeMsgPopupEvent(WxMaMessage wxMessage) { assertEquals(wxMessage.getToUser(), "gh_123456789abc"); assertEquals(wxMessage.getFromUser(), "otFpruAK8D-E6EfStSYonYSBZ8_4"); assertEquals(wxMessage.getCreateTime(), new Integer(1610969440)); assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.EVENT); assertEquals(wxMessage.getEvent(), "subscribe_msg_popup_event"); assertEquals(wxMessage.getSubscribeMsgPopupEvent().getList().size(), 1); WxMaSubscribeMsgEvent.PopupEvent event = wxMessage.getSubscribeMsgPopupEvent().getList().get(0); assertEquals(event.getTemplateId(), "VRR0UEO9VJOLs0MHlU0OilqX6MVFDwH3_3gz3Oc0NIc"); assertEquals(event.getSubscribeStatusString(), "accept"); assertEquals(event.getPopupScene(), "0"); } public void testSubscribeMsgChangeEvent() { // xml 格式 String xml = "<xml>\n" + " <ToUserName><![CDATA[gh_123456789abc]]></ToUserName>\n" + " <FromUserName><![CDATA[o7esq5OI1Uej6Xixw1lA2H7XDVbc]]></FromUserName>\n" + " <CreateTime>1610968440</CreateTime>\n" + " <MsgType><![CDATA[event]]></MsgType>\n" + " <Event><![CDATA[subscribe_msg_change_event]]></Event>\n" + " <SubscribeMsgChangeEvent>\n" + " <List>" + " <TemplateId><![CDATA[BEwX0BOT3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8]]></TemplateId>\n" + " <SubscribeStatusString><![CDATA[reject]]></SubscribeStatusString>\n" + " </List>\n" + " </SubscribeMsgChangeEvent>\n" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); checkSubscribeMsgChangeEvent(wxMessage); // json格式 (对象) String json = "{\n" + " \"ToUserName\": \"gh_123456789abc\",\n" + " \"FromUserName\": \"o7esq5OI1Uej6Xixw1lA2H7XDVbc\",\n" + " \"CreateTime\": \"1610968440\",\n" + " \"MsgType\": \"event\",\n" + " \"Event\": \"subscribe_msg_change_event\",\n" + " \"List\": {\n" + " \"TemplateId\":\"BEwX0BOT3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8\",\n" + " \"SubscribeStatusString\": \"reject\"\n" + " }\n" + "}\n"; wxMessage = WxMaMessage.fromJson(json); checkSubscribeMsgChangeEvent(wxMessage); // json格式(数组) json = "{\n" + " \"ToUserName\": \"gh_123456789abc\",\n" + " \"FromUserName\": \"o7esq5OI1Uej6Xixw1lA2H7XDVbc\",\n" + " \"CreateTime\": \"1610968440\",\n" + " \"MsgType\": \"event\",\n" + " \"Event\": \"subscribe_msg_change_event\",\n" + " \"List\": [ {\n" + " \"TemplateId\":\"BEwX0BOT3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8\",\n" + " \"SubscribeStatusString\": \"reject\"\n" + " }]" + "}"; wxMessage = WxMaMessage.fromJson(json); checkSubscribeMsgChangeEvent(wxMessage); } private void checkSubscribeMsgChangeEvent(WxMaMessage wxMessage) { assertEquals(wxMessage.getToUser(), "gh_123456789abc"); assertEquals(wxMessage.getFromUser(), "o7esq5OI1Uej6Xixw1lA2H7XDVbc"); assertEquals(wxMessage.getCreateTime(), new Integer(1610968440)); assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.EVENT); assertEquals(wxMessage.getEvent(), "subscribe_msg_change_event"); assertEquals(wxMessage.getSubscribeMsgChangeEvent().getList().size(), 1); WxMaSubscribeMsgEvent.ChangeEvent event = wxMessage.getSubscribeMsgChangeEvent().getList().get(0); assertEquals(event.getTemplateId(), "BEwX0BOT3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8"); assertEquals(event.getSubscribeStatusString(), "reject"); } public void testSubscribeMsgSentEvent() { // xml 格式 String xml = "<xml>\n" + " <ToUserName><![CDATA[gh_123456789abc]]></ToUserName>\n" + " <FromUserName><![CDATA[o7esq5PHRGBQYmeNyfG064wEFVpQ]]></FromUserName>\n" + " <CreateTime>1620963428</CreateTime>\n" + " <MsgType><![CDATA[event]]></MsgType>\n" + " <Event><![CDATA[subscribe_msg_sent_event]]></Event>\n" + " <SubscribeMsgSentEvent>\n" + " <List>" + " <TemplateId><![CDATA[BEwX0BO-T3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8]]></TemplateId>\n" + " <MsgID>1864323726461255680</MsgID>\n" + " <ErrorCode>0</ErrorCode>\n" + " <ErrorStatus><![CDATA[success]]></ErrorStatus>\n" + " </List>\n" + " </SubscribeMsgSentEvent>\n" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); checkSubscribeMsgSentEvent(wxMessage); // json格式 (对象) String json = "{\n" + " \"ToUserName\": \"gh_123456789abc\",\n" + " \"FromUserName\": \"o7esq5PHRGBQYmeNyfG064wEFVpQ\",\n" + " \"CreateTime\": \"1620963428\",\n" + " \"MsgType\": \"event\",\n" + " \"Event\": \"subscribe_msg_sent_event\",\n" + " \"List\": {\n" + " \"TemplateId\": \"BEwX0BO-T3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8\",\n" + " \"MsgID\": \"1864323726461255680\",\n" + " \"ErrorCode\": \"0\",\n" + " \"ErrorStatus\": \"success\"\n" + " }\n" + "}"; wxMessage = WxMaMessage.fromJson(json); checkSubscribeMsgSentEvent(wxMessage); } private void checkSubscribeMsgSentEvent(WxMaMessage wxMessage) { assertEquals(wxMessage.getToUser(), "gh_123456789abc"); assertEquals(wxMessage.getFromUser(), "o7esq5PHRGBQYmeNyfG064wEFVpQ"); assertEquals(wxMessage.getCreateTime(), new Integer(1620963428)); assertEquals(wxMessage.getMsgType(), WxConsts.XmlMsgType.EVENT); assertEquals(wxMessage.getEvent(), "subscribe_msg_sent_event"); assertNotNull(wxMessage.getSubscribeMsgSentEvent()); WxMaSubscribeMsgEvent.SentEvent event = wxMessage.getSubscribeMsgSentEvent().getList(); assertEquals(event.getTemplateId(), "BEwX0BO-T3MqK3Uc5oTU3CGBqzjpndk2jzUf7VfExd8"); assertEquals(event.getMsgId(), "1864323726461255680"); assertEquals(event.getErrorCode(), "0"); assertEquals(event.getErrorStatus(), "success"); } @Test public void testFromXmlForAllFieldsMap() { String xml = "<xml>\n" + " <ToUserName><![CDATA[gh_3953b390c11d]]></ToUserName>\n" + " <FromUserName><![CDATA[ofYMP5JFT4SD7EX1LQv3IWrciBSo]]></FromUserName>\n" + " <CreateTime>1642658087</CreateTime>\n" + " <MsgType><![CDATA[event]]></MsgType>\n" + " <Event><![CDATA[add_express_path]]></Event>\n" + " <DeliveryID><![CDATA[TEST]]></DeliveryID>\n" + " <WayBillId><![CDATA[01234567894_waybill_id]]></WayBillId>\n" + " <Version>16</Version>\n" + " <Count>2</Count>\n" + " <Actions>\n" + " <ActionTime>1642605533</ActionTime>\n" + " <ActionType>300001</ActionType>\n" + " <ActionMsg><![CDATA[揽件阶段-揽件成功]]></ActionMsg>\n" + " <Lat>0</Lat>\n" + " <Lng>0</Lng>\n" + " </Actions>\n" + " <Actions>\n" + " <ActionTime>1642605533</ActionTime>\n" + " <ActionType>100001</ActionType>\n" + " <ActionMsg><![CDATA[揽件阶段-揽件成功]]></ActionMsg>\n" + " <Lat>0</Lat>\n" + " <Lng>0</Lng>\n" + " </Actions>\n" + " <OrderId><![CDATA[01234567894]]></OrderId>\n" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); Map<String, Object> allFieldsMap = wxMessage.getAllFieldsMap(); assertThat(allFieldsMap).isNotEmpty() .containsEntry("ToUserName", "gh_3953b390c11d") .containsEntry("FromUserName", "ofYMP5JFT4SD7EX1LQv3IWrciBSo") .containsEntry("CreateTime", "1642658087") .containsEntry("MsgType", "event") .containsEntry("Event", "add_express_path") .containsEntry("DeliveryID", "TEST") .containsEntry("WayBillId", "01234567894_waybill_id") .containsEntry("Version", "16") .containsEntry("Count", "2") .containsEntry("OrderId", "01234567894"); List<Map<String, Object>> actions = (List<Map<String, Object>>) allFieldsMap.get("Actions"); assertThat(actions).isNotEmpty().hasSize(2); assertThat(actions.get(0)) .containsEntry("ActionTime", "1642605533") .containsEntry("ActionType", "300001") .containsEntry("ActionMsg", "揽件阶段-揽件成功") .containsEntry("Lat", "0") .containsEntry("Lng", "0"); assertThat(actions.get(1)) .containsEntry("ActionTime", "1642605533") .containsEntry("ActionType", "100001") .containsEntry("ActionMsg", "揽件阶段-揽件成功") .containsEntry("Lat", "0") .containsEntry("Lng", "0"); } /** * 自定义交易组件付款通知事件测试用例 * msgType等于event且event等于WxConsts.EventType.OPEN_PRODUCT_ORDER_PAY */ @Test public void testFromXmlForOpenProductOrderPayEvent(){ String xml = "<xml> \n" + " <ToUserName>gh_abcdefg</ToUserName> \n" + " <FromUserName>oABCD</FromUserName> \n" + " <CreateTime>1642658087</CreateTime> \n" + " <MsgType>event</MsgType> \n" + " <Event>open_product_order_pay</Event>\n" + " <order_info>\n" + " <out_order_id>123456</out_order_id>\n" + " <order_id>1234567</order_id>\n" + " <transaction_id>42000000123123</transaction_id>\n" + " <pay_time>2021-12-30 22:31:00</pay_time>\n" + " <amount>10</amount>\n" + " <sp_openid>oNMZ-5C0SPGHUiKsTwnOXpSHzFvw</sp_openid>\n" + " </order_info>\n" + "</xml>"; WxMaMessage wxMessage = WxMaMessage.fromXml(xml); assertThat(wxMessage.getMsgType()).isEqualTo("event"); assertThat(wxMessage.getEvent()).isEqualTo(WxConsts.EventType.OPEN_PRODUCT_ORDER_PAY); Map<String, Object> allFieldsMap = wxMessage.getAllFieldsMap(); Map<String, Object> orderInfo = (Map<String, Object>) allFieldsMap.get("order_info"); assertThat(orderInfo).isNotEmpty(); assertThat(orderInfo) .containsEntry("out_order_id","123456") .containsEntry("order_id","1234567") .containsEntry("transaction_id","42000000123123") .containsEntry("pay_time","2021-12-30 22:31:00") .containsEntry("amount","10") .containsEntry("sp_openid","oNMZ-5C0SPGHUiKsTwnOXpSHzFvw"); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeSubmitAuditRequestTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeSubmitAuditRequestTest.java
package cn.binarywang.wx.miniapp.bean.code; import me.chanjar.weixin.common.util.json.GsonParser; import org.testng.annotations.Test; import java.util.Arrays; import static org.assertj.core.api.Assertions.assertThat; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 19:55 */ public class WxMaCodeSubmitAuditRequestTest { @Test public void testToJson() { WxMaCodeSubmitAuditRequest request = WxMaCodeSubmitAuditRequest.builder() .itemList(Arrays.asList( WxMaCodeSubmitAuditItem.builder() .address("index") .tag("学习 生活") .firstClass("文娱") .firstId(1L) .secondClass("资讯") .secondId(2L) .title("首页") .build(), WxMaCodeSubmitAuditItem.builder() .address("page/logs/logs") .tag("学习 工作") .firstClass("教育") .firstId(3L) .secondClass("学历教育") .secondId(4L) .thirdClass("高等") .thirdId(5L) .title("日志") .build() )) .feedbackInfo("blablabla") .feedbackStuff("xx|yy|zz") .previewInfo(new WxMaCodeSubmitAuditPreviewInfo().setVideoIdList(Arrays.asList("xxxx")) .setPicIdList(Arrays.asList("xxxx", "yyyy", "zzzz"))) .versionDesc("blablabla") .ugcDeclare(new WxMaCodeSubmitAuditUgcDeclare() .setAuditDesc("blablabla") .setHasAuditTeam(1) .setMethod(new Integer[]{1}) .setScene(new Integer[]{1, 2}) ).build(); String expectedJson = "{\n" + "\t\"item_list\": [\n" + "\t{\n" + "\t\t\"address\":\"index\",\n" + "\t\t\"tag\":\"学习 生活\",\n" + "\t\t\"first_class\": \"文娱\",\n" + "\t\t\"second_class\": \"资讯\",\n" + "\t\t\"first_id\":1,\n" + "\t\t\"second_id\":2,\n" + "\t\t\"title\": \"首页\"\n" + "\t},\n" + "\t{\n" + "\t\t\"address\":\"page/logs/logs\",\n" + "\t\t\"tag\":\"学习 工作\",\n" + "\t\t\"first_class\": \"教育\",\n" + "\t\t\"second_class\": \"学历教育\",\n" + "\t\t\"third_class\": \"高等\",\n" + "\t\t\"first_id\":3,\n" + "\t\t\"second_id\":4,\n" + "\t\t\"third_id\":5,\n" + "\t\t\"title\": \"日志\"\n" + "\t}\n" + "\t],\n" + "\t\"feedback_info\": \"blablabla\",\n" + " \"feedback_stuff\": \"xx|yy|zz\",\n" + " \"preview_info\" : {\n" + " \"video_id_list\": [\"xxxx\"],\n" + " \"pic_id_list\": [\"xxxx\", \"yyyy\", \"zzzz\" ]\n" + " },\n" + " \"version_desc\":\"blablabla\",\n" + " \"ugc_declare\": {\n" + " \"scene\": [\n" + " 1,\n" + " 2\n" + " ],\n" + " \"method\": [\n" + " 1\n" + " ],\n" + " \"has_audit_team\": 1,\n" + " \"audit_desc\": \"blablabla\"\n" + " }\n" + "}\n" + ""; assertThat(request.toJson().replace("\n", "")).isEqualTo(GsonParser.parse(expectedJson).toString()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeVersionDistributionTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeVersionDistributionTest.java
package cn.binarywang.wx.miniapp.bean.code; import org.testng.annotations.Test; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 19:58 */ public class WxMaCodeVersionDistributionTest { @Test public void testFromJson() { String json = "{\"errcode\":0,\"errmsg\":\"ok\",\"now_version\":\"1.2.0\",\"uv_info\":{\"items\":[{\"version\":\"0.0.0\",\"percentage\":0},{\"version\":\"1.0.0\",\"percentage\":0},{\"version\":\"1.0.1\",\"percentage\":0},{\"version\":\"1.1.0\",\"percentage\":0},{\"version\":\"1.1.1\",\"percentage\":0},{\"version\":\"1.2.0\",\"percentage\":0},{\"version\":\"1.2.1\",\"percentage\":0},{\"version\":\"1.2.2\",\"percentage\":0},{\"version\":\"1.2.3\",\"percentage\":0},{\"version\":\"1.2.4\",\"percentage\":0},{\"version\":\"1.2.5\",\"percentage\":0},{\"version\":\"1.2.6\",\"percentage\":0},{\"version\":\"1.3.0\",\"percentage\":0},{\"version\":\"1.4.0\",\"percentage\":0},{\"version\":\"1.4.1\",\"percentage\":0},{\"version\":\"1.4.2\",\"percentage\":0},{\"version\":\"1.4.3\",\"percentage\":0},{\"version\":\"1.4.4\",\"percentage\":0},{\"version\":\"1.5.0\",\"percentage\":0},{\"version\":\"1.5.1\",\"percentage\":0},{\"version\":\"1.5.2\",\"percentage\":0},{\"version\":\"1.5.3\",\"percentage\":0},{\"version\":\"1.5.4\",\"percentage\":0},{\"version\":\"1.5.5\",\"percentage\":0},{\"version\":\"1.5.6\",\"percentage\":0},{\"version\":\"1.5.7\",\"percentage\":0},{\"version\":\"1.5.8\",\"percentage\":0},{\"version\":\"1.6.0\",\"percentage\":0.0132},{\"version\":\"1.6.1\",\"percentage\":0.0132},{\"version\":\"1.6.2\",\"percentage\":0.0132},{\"version\":\"1.6.3\",\"percentage\":0.0132},{\"version\":\"1.6.4\",\"percentage\":0.0132},{\"version\":\"1.6.5\",\"percentage\":0.0132},{\"version\":\"1.6.6\",\"percentage\":0.0132},{\"version\":\"1.6.7\",\"percentage\":0.1711},{\"version\":\"1.6.8\",\"percentage\":0.1711},{\"version\":\"1.7.0\",\"percentage\":0.1842},{\"version\":\"1.7.1\",\"percentage\":0.25},{\"version\":\"1.7.2\",\"percentage\":0.5263},{\"version\":\"1.7.3\",\"percentage\":0.5263},{\"version\":\"1.7.4\",\"percentage\":0.6711}]}}\n"; System.out.println(WxMaCodeVersionDistribution.fromJson(json)); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeCommitRequestTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/code/WxMaCodeCommitRequestTest.java
package cn.binarywang.wx.miniapp.bean.code; import com.google.gson.JsonParser; import org.testng.annotations.Test; import static org.testng.Assert.assertEquals; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 19:54 */ public class WxMaCodeCommitRequestTest { @Test public void testToJson() { WxMaCodeCommitRequest commitRequest = WxMaCodeCommitRequest.builder() .templateId(1L) .userVersion("v0.1.0") .userDesc("init") .extConfig(WxMaCodeExtConfig.builder() .extAppid("app123") .extEnable(true) .build()) .build(); assertEquals(commitRequest.toJson(), "{\"template_id\":1,\"user_version\":\"v0.1.0\",\"user_desc\":\"init\"," + "\"ext_json\":\"{\\\"extEnable\\\":true,\\\"extAppid\\\":\\\"app123\\\"}\"}"); } @Test public void testToJsonWithRequiredPrivateInfos() { WxMaCodeCommitRequest commitRequest = WxMaCodeCommitRequest.builder() .templateId(95L) .userVersion("V1.0") .userDesc("test") .extConfig(WxMaCodeExtConfig.builder() .requiredPrivateInfos(new String[]{ "onLocationChange", "startLocationUpdate" }) .build()) .build(); assertEquals(commitRequest.toJson(), JsonParser.parseString("{\n" + " \"template_id\": \"95\",\n" + " \"ext_json\": \"{\\\"requiredPrivateInfos\\\":[\\\"onLocationChange\\\",\\\"startLocationUpdate\\\"]}\",\n" + " \"user_version\": \"V1.0\",\n" + " \"user_desc\": \"test\"\n" + "}").toString()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaVisitDistributionTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaVisitDistributionTest.java
package cn.binarywang.wx.miniapp.bean.analysis; import org.testng.annotations.Test; import static org.testng.Assert.*; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaVisitDistributionTest { @Test public void testFromJson() throws Exception { String json = "{\"ref_date\":\"20170313\",\"list\":[{\"index\":\"access_source_session_cnt\",\"item_list\":[{\"key\":10,\"value\":5},{\"key\":8,\"value\":687},{\"key\":7,\"value\":10740},{\"key\":6,\"value\":1961},{\"key\":5,\"value\":677},{\"key\":4,\"value\":653},{\"key\":3,\"value\":1120},{\"key\":2,\"value\":10243},{\"key\":1,\"value\":116578}]},{\"index\":\"access_staytime_info\",\"item_list\":[{\"key\":8,\"value\":16329},{\"key\":7,\"value\":19322},{\"key\":6,\"value\":21832},{\"key\":5,\"value\":19539},{\"key\":4,\"value\":29670},{\"key\":3,\"value\":19667},{\"key\":2,\"value\":11794},{\"key\":1,\"value\":4511}]},{\"index\":\"access_depth_info\",\"item_list\":[{\"key\":5,\"value\":217},{\"key\":4,\"value\":3259},{\"key\":3,\"value\":32445},{\"key\":2,\"value\":63542},{\"key\":1,\"value\":43201}]}]}\n"; WxMaVisitDistribution distribution = WxMaVisitDistribution.fromJson(json); assertNotNull(distribution); assertEquals("20170313", distribution.getRefDate()); assertTrue(distribution.getList().containsKey("access_source_session_cnt")); assertTrue(distribution.getList().containsKey("access_staytime_info")); assertTrue(distribution.getList().containsKey("access_depth_info")); System.out.println(distribution); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaRetainInfoTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaRetainInfoTest.java
package cn.binarywang.wx.miniapp.bean.analysis; import org.testng.annotations.Test; import static org.testng.Assert.*; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaRetainInfoTest { @Test public void testFromJson() throws Exception { String json = "{\"ref_date\":\"20170313\",\"visit_uv_new\":[{\"key\":0,\"value\":5464}],\"visit_uv\":[{\"key\":0,\"value\":55500}]}\n"; WxMaRetainInfo retainInfo = WxMaRetainInfo.fromJson(json); assertNotNull(retainInfo); assertEquals("20170313", retainInfo.getRefDate()); assertTrue(retainInfo.getVisitUv().containsKey(0)); assertTrue(retainInfo.getVisitUvNew().containsKey(0)); System.out.println(retainInfo); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaUserPortraitTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/analysis/WxMaUserPortraitTest.java
package cn.binarywang.wx.miniapp.bean.analysis; import org.testng.annotations.Test; import static org.testng.Assert.assertNotNull; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaUserPortraitTest { @Test public void testFromJson() throws Exception { String json = "{\"ref_date\":\"20170611\",\"visit_uv_new\":{\"province\":[{\"id\":31,\"name\":\"广东省\",\"value\":215}],\"city\":[{\"id\":3102,\"name\":\"广州\",\"value\":78}],\"genders\":[{\"id\":1,\"name\":\"男\",\"value\":2146}],\"platforms\":[{\"id\":1,\"name\":\"iPhone\",\"value\":27642}],\"devices\":[{\"name\":\"OPPO R9\",\"value\":61}],\"ages\":[{\"id\":1,\"name\":\"17岁以下\",\"value\":151}]},\"visit_uv\":{\"province\":[{\"id\":31,\"name\":\"广东省\",\"value\":1341}],\"city\":[{\"id\":3102,\"name\":\"广州\",\"value\":234}],\"genders\":[{\"id\":1,\"name\":\"男\",\"value\":14534}],\"platforms\":[{\"id\":1,\"name\":\"iPhone\",\"value\":21750}],\"devices\":[{\"name\":\"OPPO R9\",\"value\":617}],\"ages\":[{\"id\":1,\"name\":\"17岁以下\",\"value\":3156}]}}\n"; WxMaUserPortrait portrait = WxMaUserPortrait.fromJson(json); System.out.println(portrait); assertNotNull(portrait); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/message/WxMaJsonOutMessageTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/message/WxMaJsonOutMessageTest.java
package cn.binarywang.wx.miniapp.message; import me.chanjar.weixin.common.api.WxConsts; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; public class WxMaJsonOutMessageTest { @Test public void testToJson() { WxMaJsonOutMessage message = WxMaJsonOutMessage.builder() .fromUserName("test_from_user") .toUserName("test_to_user") .msgType(WxConsts.XmlMsgType.TRANSFER_CUSTOMER_SERVICE) .createTime(System.currentTimeMillis() / 1000) .build(); String jsonResult = message.toJson(); assertThat(jsonResult).isNotEmpty(); assertThat(jsonResult).contains("test_from_user"); assertThat(jsonResult).contains("test_to_user"); assertThat(jsonResult).contains(WxConsts.XmlMsgType.TRANSFER_CUSTOMER_SERVICE); System.out.println("JSON Output:"); System.out.println(jsonResult); } @Test public void testEmptyMessage() { WxMaJsonOutMessage message = new WxMaJsonOutMessage(); String jsonResult = message.toJson(); assertThat(jsonResult).isNotEmpty(); System.out.println("Empty message JSON:"); System.out.println(jsonResult); } @Test public void testImplementsInterface() { WxMaJsonOutMessage message = WxMaJsonOutMessage.builder() .fromUserName("test_from_user") .toUserName("test_to_user") .msgType(WxConsts.XmlMsgType.TEXT) .createTime(System.currentTimeMillis() / 1000) .build(); // Test that it implements WxMaOutMessage interface WxMaOutMessage outMessage = message; assertThat(outMessage).isNotNull(); // Test both toJson and toXml methods (for JSON messages, both return JSON format) assertThat(outMessage.toJson()).isNotEmpty(); assertThat(outMessage.toXml()).isNotEmpty(); assertThat(outMessage.toJson()).isEqualTo(outMessage.toXml()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/message/WxMaXmlOutMessageTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/message/WxMaXmlOutMessageTest.java
package cn.binarywang.wx.miniapp.message; import me.chanjar.weixin.common.api.WxConsts; import org.testng.annotations.Test; import static org.assertj.core.api.Assertions.assertThat; public class WxMaXmlOutMessageTest { @Test public void testToXml() { WxMaXmlOutMessage message = WxMaXmlOutMessage.builder() .fromUserName("1") .toUserName("2") .msgType(WxConsts.XmlMsgType.TRANSFER_CUSTOMER_SERVICE) .createTime(System.currentTimeMillis() / 1000) .build(); assertThat(message.toXml()).isNotEmpty(); System.out.println(message.toXml()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedissonConfigImplTest.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/config/impl/WxMaRedissonConfigImplTest.java
package cn.binarywang.wx.miniapp.config.impl; import lombok.SneakyThrows; import org.redisson.Redisson; import org.redisson.api.RedissonClient; import org.redisson.config.Config; import org.redisson.config.TransportMode; import org.testng.Assert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; /** * @author yqx * created on 2020/5/3 */ public class WxMaRedissonConfigImplTest { WxMaDefaultConfigImpl wxMaConfig; @BeforeMethod public void setUp() { Config config = new Config(); config.useSingleServer().setAddress("redis://127.0.0.1:6379") .setDatabase(0); config.setTransportMode(TransportMode.NIO); RedissonClient redisson = Redisson.create(config); wxMaConfig = new WxMaRedissonConfigImpl(redisson); wxMaConfig.setAppid("appid12345678"); wxMaConfig.updateAccessToken("accessToken", 5); //有效期5秒 wxMaConfig.updateJsapiTicket("jsapiTicket", 5); wxMaConfig.updateCardApiTicket("cardApiTicket", 5); } @SneakyThrows @Test public void testGetAccessToken() { String accessToken = wxMaConfig.getAccessToken(); Assert.assertEquals(accessToken, "accessToken"); Assert.assertFalse(wxMaConfig.isAccessTokenExpired()); Thread.sleep(6000);//休眠6s Assert.assertTrue(wxMaConfig.isAccessTokenExpired()); } @SneakyThrows @Test public void testGetJsapiTicket() { String jsapiTicket = wxMaConfig.getJsapiTicket(); Assert.assertEquals(jsapiTicket, "jsapiTicket"); Assert.assertFalse(wxMaConfig.isJsapiTicketExpired()); Thread.sleep(6000);//休眠6s Assert.assertTrue(wxMaConfig.isJsapiTicketExpired()); } @SneakyThrows @Test public void testGetCardApiTicket() { String cardApiTicket = wxMaConfig.getCardApiTicket(); Assert.assertEquals(cardApiTicket, "cardApiTicket"); Assert.assertFalse(wxMaConfig.isCardApiTicketExpired()); Thread.sleep(6000);//休眠6s Assert.assertTrue(wxMaConfig.isCardApiTicketExpired()); } @Test public void testIsAccessTokenExpired() { Assert.assertFalse(wxMaConfig.isAccessTokenExpired()); wxMaConfig.expireAccessToken(); Assert.assertTrue(wxMaConfig.isAccessTokenExpired()); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaKefuServiceDemo.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaKefuServiceDemo.java
package cn.binarywang.wx.miniapp.demo; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfList; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfSession; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfSessionList; import cn.binarywang.wx.miniapp.bean.kefu.request.WxMaKfAccountRequest; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序客服管理功能使用示例. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaKefuServiceDemo { private final WxMaService wxMaService; public WxMaKefuServiceDemo(WxMaService wxMaService) { this.wxMaService = wxMaService; } /** * 演示客服账号管理功能 */ public void demonstrateCustomerServiceManagement() throws WxErrorException { // 1. 获取客服列表 WxMaKfList kfList = wxMaService.getKefuService().kfList(); System.out.println("当前客服数量: " + kfList.getKfList().size()); // 2. 添加新客服账号 WxMaKfAccountRequest addRequest = WxMaKfAccountRequest.builder() .kfAccount("service001@example") .kfNick("客服001") .kfPwd("password123") .build(); boolean addResult = wxMaService.getKefuService().kfAccountAdd(addRequest); System.out.println("添加客服账号结果: " + addResult); // 3. 更新客服账号信息 WxMaKfAccountRequest updateRequest = WxMaKfAccountRequest.builder() .kfAccount("service001@example") .kfNick("高级客服001") .build(); boolean updateResult = wxMaService.getKefuService().kfAccountUpdate(updateRequest); System.out.println("更新客服账号结果: " + updateResult); } /** * 演示客服会话管理功能 */ public void demonstrateSessionManagement() throws WxErrorException { String userOpenid = "user_openid_example"; String kfAccount = "service001@example"; // 1. 创建客服会话 boolean createResult = wxMaService.getKefuService().kfSessionCreate(userOpenid, kfAccount); System.out.println("创建会话结果: " + createResult); // 2. 获取用户会话状态 WxMaKfSession session = wxMaService.getKefuService().kfSessionGet(userOpenid); System.out.println("用户当前会话客服: " + session.getKfAccount()); // 3. 获取客服的会话列表 WxMaKfSessionList sessionList = wxMaService.getKefuService().kfSessionList(kfAccount); System.out.println("客服当前会话数量: " + sessionList.getSessionList().size()); // 4. 关闭客服会话 boolean closeResult = wxMaService.getKefuService().kfSessionClose(userOpenid, kfAccount); System.out.println("关闭会话结果: " + closeResult); } /** * 演示客服账号删除功能 */ public void demonstrateAccountDeletion() throws WxErrorException { String kfAccount = "service001@example"; boolean deleteResult = wxMaService.getKefuService().kfAccountDel(kfAccount); System.out.println("删除客服账号结果: " + deleteResult); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaPortalServlet.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaPortalServlet.java
package cn.binarywang.wx.miniapp.demo; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaMessage; import cn.binarywang.wx.miniapp.config.WxMaConfig; import cn.binarywang.wx.miniapp.constant.WxMaConstants; import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; import cn.binarywang.wx.miniapp.message.WxMaOutMessage; import lombok.AllArgsConstructor; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Objects; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @AllArgsConstructor public class WxMaPortalServlet extends HttpServlet { private static final long serialVersionUID = 1L; private WxMaConfig config; private WxMaService service; private WxMaMessageRouter messageRouter; @Override protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html;charset=utf-8"); response.setStatus(HttpServletResponse.SC_OK); String signature = request.getParameter("signature"); String nonce = request.getParameter("nonce"); String timestamp = request.getParameter("timestamp"); if (!this.service.checkSignature(timestamp, nonce, signature)) { // 消息签名不正确,说明不是公众平台发过来的消息 response.getWriter().println("非法请求"); return; } String echoStr = request.getParameter("echostr"); if (StringUtils.isNotBlank(echoStr)) { // 说明是一个仅仅用来验证的请求,回显echostr response.getWriter().println(echoStr); return; } String encryptType = request.getParameter("encrypt_type"); final boolean isJson = Objects.equals(this.config.getMsgDataFormat(), WxMaConstants.MsgDataFormat.JSON); if (StringUtils.isBlank(encryptType)) { // 明文传输的消息 WxMaMessage inMessage; if (isJson) { inMessage = WxMaMessage.fromJson(IOUtils.toString(request.getInputStream(), StandardCharsets.UTF_8)); } else {//xml inMessage = WxMaMessage.fromXml(request.getInputStream()); } final WxMaOutMessage outMessage = this.messageRouter.route(inMessage); if (outMessage != null) { if (isJson) { response.getWriter().write(outMessage.toJson()); } else { response.getWriter().write(outMessage.toXml()); } return; } response.getWriter().write("success"); return; } if ("aes".equals(encryptType)) { // 是aes加密的消息 String msgSignature = request.getParameter("msg_signature"); WxMaMessage inMessage; if (isJson) { inMessage = WxMaMessage.fromEncryptedJson(request.getInputStream(), this.config); } else {//xml inMessage = WxMaMessage.fromEncryptedXml(request.getInputStream(), this.config, timestamp, nonce, msgSignature); } final WxMaOutMessage outMessage = this.messageRouter.route(inMessage); if (outMessage != null) { if (isJson) { response.getWriter().write(outMessage.toEncryptedJson(this.config)); } else { response.getWriter().write(outMessage.toEncryptedXml(this.config)); } return; } response.getWriter().write("success"); return; } response.getWriter().println("不可识别的加密类型"); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaDemoServer.java
weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/demo/WxMaDemoServer.java
package cn.binarywang.wx.miniapp.demo; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; import cn.binarywang.wx.miniapp.bean.WxMaMessage; import cn.binarywang.wx.miniapp.config.WxMaConfig; import cn.binarywang.wx.miniapp.constant.WxMaConstants; import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; import cn.binarywang.wx.miniapp.message.WxMaOutMessage; import cn.binarywang.wx.miniapp.message.WxMaXmlOutMessage; import cn.binarywang.wx.miniapp.test.TestConfig; import me.chanjar.weixin.common.api.WxConsts; import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.session.WxSessionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.Calendar; import java.util.Map; import java.util.concurrent.locks.ReentrantLock; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaDemoServer { private static final WxMaMessageHandler logHandler = new WxMaMessageHandler() { @Override public WxMaOutMessage handle(WxMaMessage wxMessage, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException { System.out.println("收到消息:" + wxMessage.toString()); service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson()) .toUser(wxMessage.getFromUser()).build()); return null; } }; private static final WxMaMessageHandler textHandler = new WxMaMessageHandler() { @Override public WxMaOutMessage handle(WxMaMessage wxMessage, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException { service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") .toUser(wxMessage.getFromUser()).build()); return null; } }; private static final WxMaMessageHandler picHandler = new WxMaMessageHandler() { @Override public WxMaOutMessage handle(WxMaMessage wxMessage, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException { try { WxMediaUploadResult uploadResult = service.getMediaService() .uploadMedia(WxMaConstants.MediaType.IMAGE, "png", ClassLoader.getSystemResourceAsStream("tmp.png")); service.getMsgService().sendKefuMsg( WxMaKefuMessage .newImageBuilder() .mediaId(uploadResult.getMediaId()) .toUser(wxMessage.getFromUser()) .build()); } catch (WxErrorException e) { e.printStackTrace(); } return null; } }; private static final WxMaMessageHandler qrcodeHandler = new WxMaMessageHandler() { @Override public WxMaOutMessage handle(WxMaMessage wxMessage, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) throws WxErrorException { try { final File file = service.getQrcodeService().createQrcode("123", 430); WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia(WxMaConstants.MediaType.IMAGE, file); service.getMsgService().sendKefuMsg( WxMaKefuMessage .newImageBuilder() .mediaId(uploadResult.getMediaId()) .toUser(wxMessage.getFromUser()) .build()); } catch (WxErrorException e) { e.printStackTrace(); } return null; } }; private static final WxMaMessageHandler customerServiceMessageHandler = new WxMaMessageHandler() { @Override public WxMaOutMessage handle(WxMaMessage message, Map<String, Object> context, WxMaService service, WxSessionManager sessionManager) { return new WxMaXmlOutMessage() .setMsgType(WxConsts.XmlMsgType.TRANSFER_CUSTOMER_SERVICE) .setFromUserName(message.getToUser()) .setCreateTime(Calendar.getInstance().getTimeInMillis() / 1000) .setToUserName(message.getFromUser()); } }; private static WxMaConfig config; private static WxMaService service; private static WxMaMessageRouter router; private static String templateId; public static void main(String[] args) throws Exception { init(); Server server = new Server(8080); ServletHandler servletHandler = new ServletHandler(); server.setHandler(servletHandler); ServletHolder endpointServletHolder = new ServletHolder(new WxMaPortalServlet(config, service, router)); servletHandler.addServletWithMapping(endpointServletHolder, "/*"); server.start(); server.join(); } private static void init() { try (InputStream is1 = ClassLoader.getSystemResourceAsStream("test-config.xml")) { TestConfig config = TestConfig.fromXml(is1); config.setAccessTokenLock(new ReentrantLock()); templateId = config.getTemplateId(); WxMaDemoServer.config = config; service = new WxMaServiceImpl(); service.setWxMaConfig(config); router = new WxMaMessageRouter(service); router.rule().handler(logHandler).next() .rule().async(false).content("文本").handler(textHandler).end() .rule().async(false).content("图片").handler(picHandler).end() .rule().async(false).content("二维码").handler(qrcodeHandler).end() .rule().async(false).content("转发客服").handler(customerServiceMessageHandler).end(); } catch (IOException e) { e.printStackTrace(); } } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/WxMaConfigHolder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/WxMaConfigHolder.java
package cn.binarywang.wx.miniapp.util; /** * 小程序存储值存放类. * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2020-08-16 */ public class WxMaConfigHolder { private static final ThreadLocal<String> THREAD_LOCAL = ThreadLocal.withInitial(() -> "default"); public static String get() { return THREAD_LOCAL.get(); } public static void set(String label) { THREAD_LOCAL.set(label); } /** * 此方法需要用户根据自己程序代码,在适当位置手动触发调用,本SDK里无法判断调用时机 */ public static void remove() { THREAD_LOCAL.remove(); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/xml/XStreamTransformer.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/xml/XStreamTransformer.java
package cn.binarywang.wx.miniapp.util.xml; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import cn.binarywang.wx.miniapp.bean.WxMaMessage; import cn.binarywang.wx.miniapp.message.WxMaXmlOutMessage; import com.thoughtworks.xstream.XStream; import me.chanjar.weixin.common.util.xml.XStreamInitializer; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class XStreamTransformer { private static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = new HashMap<>(); static { registerClass(WxMaMessage.class); registerClass(WxMaXmlOutMessage.class); } /** * xml -> pojo. */ @SuppressWarnings("unchecked") public static <T> T fromXml(Class<T> clazz, String xml) { T object = (T) CLASS_2_XSTREAM_INSTANCE.get(clazz).fromXML(xml); return object; } @SuppressWarnings("unchecked") public static <T> T fromXml(Class<T> clazz, InputStream is) { T object = (T) CLASS_2_XSTREAM_INSTANCE.get(clazz).fromXML(is); return object; } /** * pojo -> xml. */ public static <T> String toXml(Class<T> clazz, T object) { return CLASS_2_XSTREAM_INSTANCE.get(clazz).toXML(object); } /** * 注册扩展消息的解析器. * * @param clz 类型 * @param xStream xml解析器 */ public static void register(Class<?> clz, XStream xStream) { CLASS_2_XSTREAM_INSTANCE.put(clz, xStream); } /** * 注册第三方的该类及其子类. * 便利第三方类使用 XStreamTransformer进行序列化, 以及支持XStream 1.4.18 以上增加安全许可 * @param clz 要注册的类 */ public static void registerExtendClass(Class<?> clz){ XStream xstream = XStreamInitializer.getInstance(); Class<?>[] innerClz = getInnerClasses(clz); xstream.processAnnotations(clz); xstream.processAnnotations(innerClz); xstream.allowTypes(new Class[]{clz}); xstream.allowTypes(innerClz); register(clz, xstream); } /** * 会自动注册该类及其子类. * * @param clz 要注册的类 */ private static void registerClass(Class<?> clz) { XStream xstream = XStreamInitializer.getInstance(); xstream.processAnnotations(clz); xstream.processAnnotations(getInnerClasses(clz)); if (clz.equals(WxMaMessage.class)) { // 操蛋的微信,模板消息推送成功的消息是MsgID,其他消息推送过来是MsgId xstream.aliasField("MsgID", WxMaMessage.class, "msgId"); } register(clz, xstream); } private static Class<?>[] getInnerClasses(Class<?> clz) { Class<?>[] innerClasses = clz.getClasses(); if (innerClasses == null) { return null; } List<Class<?>> result = new ArrayList<>(); result.addAll(Arrays.asList(innerClasses)); for (Class<?> inner : innerClasses) { Class<?>[] innerClz = getInnerClasses(inner); if (innerClz == null) { continue; } result.addAll(Arrays.asList(innerClz)); } return result.toArray(new Class<?>[0]); } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/crypt/WxMaCryptUtils.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/util/crypt/WxMaCryptUtils.java
package cn.binarywang.wx.miniapp.util.crypt; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.AlgorithmParameters; import java.security.Key; import java.security.Security; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import me.chanjar.weixin.common.error.WxRuntimeException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; import org.bouncycastle.jce.provider.BouncyCastleProvider; import cn.binarywang.wx.miniapp.config.WxMaConfig; import me.chanjar.weixin.common.util.crypto.PKCS7Encoder; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaCryptUtils extends me.chanjar.weixin.common.util.crypto.WxCryptUtil { private static final Charset UTF_8 = StandardCharsets.UTF_8; public WxMaCryptUtils(WxMaConfig config) { this.appidOrCorpid = config.getAppid(); this.token = config.getToken(); this.aesKey = java.util.Base64.getDecoder().decode(StringUtils.remove(config.getAesKey(), " ")); } /** * AES解密. * * @param sessionKey session_key * @param encryptedData 消息密文 * @param ivStr iv字符串 */ public static String decrypt(String sessionKey, String encryptedData, String ivStr) { try { AlgorithmParameters params = AlgorithmParameters.getInstance("AES"); params.init(new IvParameterSpec(Base64.decodeBase64(ivStr))); Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(Base64.decodeBase64(sessionKey), "AES"), params); return new String(PKCS7Encoder.decode(cipher.doFinal(Base64.decodeBase64(encryptedData))), UTF_8); } catch (Exception e) { throw new WxRuntimeException("AES解密失败!", e); } } /** * AES解密. * * @param sessionKey session_key * @param encryptedData 消息密文 * @param ivStr iv字符串 */ public static String decryptAnotherWay(String sessionKey, String encryptedData, String ivStr) { byte[] keyBytes = Base64.decodeBase64(sessionKey.getBytes(UTF_8)); int base = 16; if (keyBytes.length % base != 0) { int groups = keyBytes.length / base + (keyBytes.length % base != 0 ? 1 : 0); byte[] temp = new byte[groups * base]; Arrays.fill(temp, (byte) 0); System.arraycopy(keyBytes, 0, temp, 0, keyBytes.length); keyBytes = temp; } Security.addProvider(new BouncyCastleProvider()); Key key = new SecretKeySpec(keyBytes, "AES"); try { Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding", "BC"); cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(Base64.decodeBase64(ivStr.getBytes(UTF_8)))); return new String(cipher.doFinal(Base64.decodeBase64(encryptedData.getBytes(UTF_8))), UTF_8); } catch (Exception e) { throw new WxRuntimeException("AES解密失败!", e); } } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaConstants.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaConstants.java
package cn.binarywang.wx.miniapp.constant; import lombok.experimental.UtilityClass; /** * <pre> * 小程序常量. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @UtilityClass public class WxMaConstants { /** * 默认的env_version值 */ public static final String DEFAULT_ENV_VERSION = "release"; /** * 素材类型. */ @UtilityClass public static class MediaType { /** * 图片. */ public static final String IMAGE = "image"; } /** * 消息格式. */ @UtilityClass public static class MsgDataFormat { public static final String XML = "XML"; public static final String JSON = "JSON"; } /** * 客服消息的消息类型. */ @UtilityClass public static class KefuMsgType { /** * 文本消息. */ public static final String TEXT = "text"; /** * 图片消息. */ public static final String IMAGE = "image"; /** * 图文链接. */ public static final String LINK = "link"; /** * 小程序卡片消息. */ public static final String MA_PAGE = "miniprogrampage"; } /** * 内容安全检测的媒体类型 */ @UtilityClass public static final class SecCheckMediaType { /** * 音频 */ public static final int VOICE = 1; /** * 图片 */ public static final int IMAGE = 2; } /** * 快递账号绑定类型 */ @UtilityClass public static final class BindAccountType { /** * 绑定 */ public static final String BIND = "bind"; /** * 解绑 */ public static final String UNBIND = "unbind"; } /** * 快递下单订单来源 */ @UtilityClass public static final class OrderAddSource { /** * 小程序 */ public static final int MINI_PROGRAM = 0; /** * APP或H5 */ public static final int APP_OR_H5 = 2; } /** * 快递下单保价 */ @UtilityClass public static final class OrderAddInsured { /** * 不保价 */ public static final int INSURED_PROGRAM = 0; /** * 保价 */ public static final int USE_INSURED = 1; /** * 默认保价金额 */ public static final int DEFAULT_INSURED_VALUE = 0; } /** * 小程序订阅消息跳转小程序类型 * <p> * developer为开发版;trial为体验版;formal为正式版;默认为正式版 */ @UtilityClass public static final class MiniProgramState { /** * 开发版 */ public static final String DEVELOPER = "developer"; /** * 体验版 */ public static final String TRIAL = "trial"; /** * 正式版 */ public static final String FORMAL = "formal"; } /** * 进入小程序查看的语言类型 * 支持zh_CN(简体中文)、en_US(英文)、zh_HK(繁体中文)、zh_TW(繁体中文),默认为zh_CN */ @UtilityClass public static final class MiniProgramLang { /** * 简体中文 */ public static final String ZH_CN = "zh_CN"; /** * 英文 */ public static final String EN_US = "en_US"; /** * 繁体中文 */ public static final String ZH_HK = "zh_HK"; /** * 繁体中文 */ public static final String ZH_TW = "zh_TW"; } @UtilityClass public static final class AuditStatus { public static final int INVALID = 0; public static final int ONGOING = 1; public static final int REJECTED = 2; public static final int APPROVED = 3; public static final int RECOMMIT = 4; } @UtilityClass public static final class ExpeditedType { /** * 非加急 */ public static final int NORMAL = 0; /** * 加急 */ public static final int HIGH_PRIORITY = 1; } @UtilityClass public static final class UploadTaskType { public static final int PULL_UPLOAD = 1; } @UtilityClass public static final class UploadTaskStatus { public static final int WAITING = 1; public static final int WORKING = 2; public static final int DONE = 3; public static final int FAILED = 4; } @UtilityClass public static final class UploadResourceType { public static final int MEDIA = 1; public static final int COVER = 2; } @UtilityClass public static final class XPayEnv { public static final int PRODUCT = 0; public static final int SANDBOX = 1; } @UtilityClass public static final class XPayFirstCharge { public static final int NO = 0; public static final int YES = 1; } @UtilityClass public static final class XPayDeviceType { public static final int ANDROID = 1; public static final int IOS = 2; } @UtilityClass public static final class XPayBizType { public static final int SHORT_DRAMA = 1; } @UtilityClass public static final class XPayOrderType { public static final int PAY_ORDER = 0;//0-支付单 public static final int REFUND_ORDER = 1;//1-退款单 } @UtilityClass public static final class XPayOrderStatus { public static final int INIT = 0;//0-订单初始化(未创建成功,不可用于支付) public static final int CREATED = 1;// 1-订单创建成功 public static final int PAID = 2;//2-订单已经支付,待发货 public static final int PROVIDING = 3;// 3-订单发货中 public static final int PROVIDED = 4;// 4-订单已发货 public static final int REFUNDED = 5;// 5-订单已经退款 public static final int CLOSED = 6;// 6-订单已经关闭(不可再使用) public static final int REFUND_FAILED = 7;// 7-订单退款失败 } @UtilityClass public static final class XPayNotifyEvent { public static String COIN_PAY = "xpay_coin_pay_notify"; public static String GOODS_DELIVER = "xpay_goods_deliver_notify"; } @UtilityClass public static final class XPayPaymentMode { public static String COIN = "short_series_coin"; public static String GOODS = "short_series_goods"; } @UtilityClass public static final class XPayPlatform { public static String ANDROID = "android"; } @UtilityClass public static final class XPayCurrencyType { public static String CNY = "CNY"; } @UtilityClass public static final class XPayWxApiSigUri { public static String WXAPI = "requestVirtualPayment"; } @UtilityClass public static final class XPayRefundReqFrom { public static final String FROM_CS = "1";//人工客服退款 public static final String FROM_USER = "2";//用户自己发起 public static final String FROM_MISC = "3";//1-其它 } @UtilityClass public static final class XPayPublishStatus { public static final int PUBLISH_UPLOADING = 0;//0-上传中 public static final int PUBLISH_EXISTED = 1;//1-id已经存在 public static final int PUBLISH_SUCCESSFUL = 2;// 2-发布成功 public static final int PUBLISH_FAILED = 3;//3-发布失败 } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/constant/WxMaApiUrlConstants.java
package cn.binarywang.wx.miniapp.constant; import lombok.experimental.UtilityClass; /** * 小程序接口地址常量. * * @author <a href="https://github.com/binarywang">Binary Wang</a> created on 2021-01-28 */ @UtilityClass public class WxMaApiUrlConstants { /** openApi管理 */ public interface OpenApi { /** 重置API调用次数 */ String CLEAR_QUOTA = "https://api.weixin.qq.com/cgi-bin/clear_quota"; /** 查询API调用额度 */ String GET_API_QUOTA = "https://api.weixin.qq.com/cgi-bin/openapi/quota/get"; /** 查询rid信息 */ String GET_RID_INFO = "https://api.weixin.qq.com/cgi-bin/openapi/rid/get"; /** 使用AppSecret重置 API 调用次数 */ String CLEAR_QUOTA_BY_APP_SECRET = "https://api.weixin.qq.com/cgi-bin/clear_quota/v2?appid=%s&appsecret=%s"; } public interface Analysis { String GET_DAILY_SUMMARY_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailysummarytrend"; String GET_DAILY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyvisittrend"; String GET_WEEKLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyvisittrend"; String GET_MONTHLY_VISIT_TREND_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend"; String GET_VISIT_DISTRIBUTION_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitdistribution"; String GET_DAILY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiddailyretaininfo"; String GET_WEEKLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidweeklyretaininfo"; String GET_MONTHLY_RETAIN_INFO_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyretaininfo"; String GET_VISIT_PAGE_URL = "https://api.weixin.qq.com/datacube/getweanalysisappidvisitpage"; String GET_USER_PORTRAIT_URL = "https://api.weixin.qq.com/datacube/getweanalysisappiduserportrait"; } public interface Cloud { String INVOKE_CLOUD_FUNCTION_URL = "https://api.weixin.qq.com/tcb/invokecloudfunction?env=%s&name=%s"; String DATABASE_COLLECTION_GET_URL = "https://api.weixin.qq.com/tcb/databasecollectionget"; String DATABASE_COLLECTION_DELETE_URL = "https://api.weixin.qq.com/tcb/databasecollectiondelete"; String DATABASE_COLLECTION_ADD_URL = "https://api.weixin.qq.com/tcb/databasecollectionadd"; String GET_QCLOUD_TOKEN_URL = "https://api.weixin.qq.com/tcb/getqcloudtoken"; String BATCH_DELETE_FILE_URL = "https://api.weixin.qq.com/tcb/batchdeletefile"; String BATCH_DOWNLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/batchdownloadfile"; String UPLOAD_FILE_URL = "https://api.weixin.qq.com/tcb/uploadfile"; String DATABASE_MIGRATE_QUERY_INFO_URL = "https://api.weixin.qq.com/tcb/databasemigratequeryinfo"; String DATABASE_MIGRATE_EXPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateexport"; String DATABASE_MIGRATE_IMPORT_URL = "https://api.weixin.qq.com/tcb/databasemigrateimport"; String UPDATE_INDEX_URL = "https://api.weixin.qq.com/tcb/updateindex"; String DATABASE_COUNT_URL = "https://api.weixin.qq.com/tcb/databasecount"; String DATABASE_AGGREGATE_URL = "https://api.weixin.qq.com/tcb/databaseaggregate"; String DATABASE_QUERY_URL = "https://api.weixin.qq.com/tcb/databasequery"; String DATABASE_UPDATE_URL = "https://api.weixin.qq.com/tcb/databaseupdate"; String DATABASE_DELETE_URL = "https://api.weixin.qq.com/tcb/databasedelete"; String DATABASE_ADD_URL = "https://api.weixin.qq.com/tcb/databaseadd"; String SEND_SMS_V2_URL = "https://api.weixin.qq.com/tcb/sendsmsv2"; } public interface Msg { String KEFU_MESSAGE_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/custom/send"; String TEMPLATE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/send"; String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send"; String UNIFORM_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send"; String ACTIVITY_ID_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/activityid/create"; String UPDATABLE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/wxopen/updatablemsg/send"; } public interface Code { /** 为授权的小程序帐号上传小程序代码. */ String COMMIT_URL = "https://api.weixin.qq.com/wxa/commit"; String GET_QRCODE_URL = "https://api.weixin.qq.com/wxa/get_qrcode"; String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxa/get_category"; String GET_PAGE_URL = "https://api.weixin.qq.com/wxa/get_page"; String SUBMIT_AUDIT_URL = "https://api.weixin.qq.com/wxa/submit_audit"; String GET_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_auditstatus"; String GET_LATEST_AUDIT_STATUS_URL = "https://api.weixin.qq.com/wxa/get_latest_auditstatus"; String RELEASE_URL = "https://api.weixin.qq.com/wxa/release"; String CHANGE_VISIT_STATUS_URL = "https://api.weixin.qq.com/wxa/change_visitstatus"; String REVERT_CODE_RELEASE_URL = "https://api.weixin.qq.com/wxa/revertcoderelease"; String GET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion"; String SET_SUPPORT_VERSION_URL = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion"; String UNDO_CODE_AUDIT_URL = "https://api.weixin.qq.com/wxa/undocodeaudit"; String GET_VERSION_INFO_URL = "https://api.weixin.qq.com/wxa/getversioninfo"; } public interface Express { /** 获取支持的快递公司列表 */ String ALL_DELIVERY_URL = "https://api.weixin.qq.com/cgi-bin/express/business/delivery/getall"; /** 获取所有绑定的物流账号 */ String ALL_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/getall"; /** 绑定、解绑物流账号 */ String BIND_ACCOUNT_URL = "https://api.weixin.qq.com/cgi-bin/express/business/account/bind"; /** 获取电子面单余额 */ String GET_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/express/business/quota/get"; /** 配置面单打印员 */ String UPDATE_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/update"; /** 获取打印员 */ String GET_PRINTER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/printer/getall"; /** 生成运单 */ String ADD_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/add"; /** 批量获取运单数据 */ String BATCH_GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/batchget"; /** 取消运单 */ String CANCEL_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/cancel"; /** 获取运单数据 */ String GET_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/order/get"; /** 查询运单轨迹 */ String GET_PATH_URL = "https://api.weixin.qq.com/cgi-bin/express/business/path/get"; /** 模拟快递公司更新订单状态 */ String TEST_UPDATE_ORDER_URL = "https://api.weixin.qq.com/cgi-bin/express/business/test_update_order"; } public interface ImgProc { /** 二维码/条码识别 */ String QRCODE = "https://api.weixin.qq.com/cv/img/qrcode?img_url=%s"; /** 二维码/条码识别(文件) */ String FILE_QRCODE = "https://api.weixin.qq.com/cv/img/qrcode"; /** 图片高清化 */ String SUPER_RESOLUTION = "https://api.weixin.qq.com/cv/img/superresolution?img_url=%s"; /** 图片高清化(文件) */ String FILE_SUPER_RESOLUTION = "https://api.weixin.qq.com/cv/img/superresolution"; /** 图片智能裁剪 */ String AI_CROP = "https://api.weixin.qq.com/cv/img/aicrop?img_url=%s&ratios=%s"; /** 图片智能裁剪(文件) */ String FILE_AI_CROP = "https://api.weixin.qq.com/cv/img/aicrop?ratios=%s"; } public interface Jsapi { /** 获得jsapi_ticket的url */ String GET_JSAPI_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket"; } public interface Broadcast { /** 直播间管理相关接口 */ interface Room { /** 创建直播间 */ String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create"; /** 获取直播间列表 获取直播间回放 */ String GET_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/getliveinfo"; /** 直播间导入商品 */ String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods"; /** 删除直播间 */ String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom"; /** 编辑直播间 */ String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom"; /** 获取直播间推流地址 */ String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl"; /** 获取直播间分享二维码 */ String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode"; /** 添加管理直播间小助手 */ String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant"; /** 修改管理直播间小助手 */ String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant"; /** 删除管理直播间小助手 */ String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant"; /** 查询管理直播间小助手 */ String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist"; /** 添加主播副号 */ String ADD_SUBANCHOR = "https://api.weixin.qq.com/wxaapi/broadcast/room/addsubanchor"; /** 修改主播副号 */ String MODIFY_SUBANCHOR = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifysubanchor"; /** 删除主播副号 */ String DELETE_SUBANCHOR = "https://api.weixin.qq.com/wxaapi/broadcast/room/deletesubanchor"; /** 获取主播副号 */ String GET_SUBANCHOR = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsubanchor"; /** 开启/关闭直播间官方收录 */ String UPDATE_FEED_PUBLIC = "https://api.weixin.qq.com/wxaapi/broadcast/room/updatefeedpublic"; /** 开启/关闭回放功能 */ String UPDATE_REPLAY = "https://api.weixin.qq.com/wxaapi/broadcast/room/updatereplay"; /** 开启/关闭客服功能 */ String UPDATE_KF = "https://api.weixin.qq.com/wxaapi/broadcast/room/updatekf"; /** 开启/关闭直播间全局禁言 */ String UPDATE_COMMENT = "https://api.weixin.qq.com/wxaapi/broadcast/room/updatecomment"; /** 上下架商品 */ String ONSALE = "https://api.weixin.qq.com/wxaapi/broadcast/goods/onsale"; /** 删除商品 */ String DELETE_IN_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/goods/deleteInRoom"; /** 推送商品 */ String PUSH = "https://api.weixin.qq.com/wxaapi/broadcast/goods/push"; /** 商品排序 */ String SORT = "https://api.weixin.qq.com/wxaapi/broadcast/goods/sort"; /** 下载商品讲解视频 */ String GET_VIDEO = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getVideo"; } /** 直播商品管理相关接口 */ interface Goods { String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/add"; String RESET_AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/resetaudit"; String AUDIT_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/audit"; String DELETE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete"; String UPDATE_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/update"; String GET_GOODS_WARE_HOUSE = "https://api.weixin.qq.com/wxa/business/getgoodswarehouse"; String GET_APPROVED_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getapproved"; /** 直播挂件设置全局 Key */ String SET_KEY = "https://api.weixin.qq.com/wxaapi/broadcast/goods/setkey"; /** 直播挂件获取全局 Key */ String GET_KEY = "https://api.weixin.qq.com/wxaapi/broadcast/goods/getkey"; } /** 小程序直播成员管理接口 */ interface Role { String ADD_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/addrole"; String DELETE_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/deleterole"; String LIST_BY_ROLE = "https://api.weixin.qq.com/wxaapi/broadcast/role/getrolelist"; } } public interface Media { String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/cgi-bin/media/upload?type=%s"; String MEDIA_GET_URL = "https://api.weixin.qq.com/cgi-bin/media/get"; } public interface Plugin { String PLUGIN_URL = "https://api.weixin.qq.com/wxa/plugin"; } public interface Qrcode { String CREATE_QRCODE_URL = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode"; String GET_WXACODE_URL = "https://api.weixin.qq.com/wxa/getwxacode"; String GET_WXACODE_UNLIMIT_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit"; } public interface Run {} public interface Scheme { String GENERATE_SCHEME_URL = "https://api.weixin.qq.com/wxa/generatescheme"; String GENERATE_NFC_SCHEME_URL = "https://api.weixin.qq.com/wxa/generatenfcscheme"; } public interface Link { String GENERATE_URLLINK_URL = "https://api.weixin.qq.com/wxa/generate_urllink"; String QUERY_URLLINK_URL = "https://api.weixin.qq.com/wxa/query_urllink"; } public interface ShortLink { String GENERATE_SHORT_LINK_URL = "https://api.weixin.qq.com/wxa/genwxashortlink"; } /** 小程序安全 */ public interface SecCheck { String IMG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/img_sec_check"; String MSG_SEC_CHECK_URL = "https://api.weixin.qq.com/wxa/msg_sec_check"; String MEDIA_CHECK_ASYNC_URL = "https://api.weixin.qq.com/wxa/media_check_async"; /** 获取用户安全等级 */ String GET_USER_RISK_RANK = "https://api.weixin.qq.com/wxa/getuserriskrank"; } public interface Setting { /** * 修改服务器地址:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489138143_WPbOO&token=&lang=zh_CN * access_token 为 authorizer_access_token */ String MODIFY_DOMAIN_URL = "https://api.weixin.qq.com/wxa/modify_domain"; String SET_WEB_VIEW_DOMAIN_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain"; /** * 小程序成员管理:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140588_nVUgx&token=&lang=zh_CN * access_token 为 authorizer_access_token */ String BIND_TESTER_URL = "https://api.weixin.qq.com/wxa/bind_tester"; String UNBIND_TESTER_URL = "https://api.weixin.qq.com/wxa/unbind_tester"; } public interface Share {} public interface Subscribe { /** 获取模板标题下的关键词列表. */ String GET_PUB_TEMPLATE_TITLE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles"; /** 获取模板标题下的关键词列表. */ String GET_PUB_TEMPLATE_KEY_WORDS_BY_ID_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords"; /** 组合模板并添加至帐号下的个人模板库. */ String TEMPLATE_ADD_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate"; /** 获取当前帐号下的个人模板列表. */ String TEMPLATE_LIST_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate"; /** 删除帐号下的某个模板. */ String TEMPLATE_DEL_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate"; /** 获取小程序账号的类目 */ String GET_CATEGORY_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getcategory"; /** 发送订阅消息 */ String SUBSCRIBE_MSG_SEND_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send"; } public interface User { String SET_USER_STORAGE = "https://api.weixin.qq.com/wxa/set_user_storage?appid=%s&signature=%s&openid=%s&sig_method=%s"; String GET_PHONE_NUMBER_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber"; /** 多端登录验证接口 */ String CODE_2_VERIFY_INFO_URL = "https://api.weixin.qq.com/wxa/sec/checkcode2verifyinfo"; } public interface Ocr { String IDCARD = "https://api.weixin.qq.com/cv/ocr/idcard?img_url=%s"; String FILEIDCARD = "https://api.weixin.qq.com/cv/ocr/idcard"; String BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard?img_url=%s"; String FILE_BANK_CARD = "https://api.weixin.qq.com/cv/ocr/bankcard"; String DRIVING = "https://api.weixin.qq.com/cv/ocr/driving?img_url=%s"; String FILE_DRIVING = "https://api.weixin.qq.com/cv/ocr/driving"; String DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense?img_url=%s"; String FILE_DRIVING_LICENSE = "https://api.weixin.qq.com/cv/ocr/drivinglicense"; String BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense?img_url=%s"; String FILE_BIZ_LICENSE = "https://api.weixin.qq.com/cv/ocr/bizlicense"; String COMM = "https://api.weixin.qq.com/cv/ocr/comm?img_url=%s"; String FILE_COMM = "https://api.weixin.qq.com/cv/ocr/comm"; } public interface Product { interface Spu { String PRODUCT_SPU_ADD_URL = "https://api.weixin.qq.com/product/spu/add"; String PRODUCT_SPU_DEL_URL = "https://api.weixin.qq.com/product/spu/del"; String PRODUCT_SPU_GET_URL = "https://api.weixin.qq.com/product/spu/get"; String PRODUCT_SPU_GET_LIST_URL = "https://api.weixin.qq.com/product/spu/get_list"; String PRODUCT_SPU_UPDATE_URL = "https://api.weixin.qq.com/product/spu/update"; String PRODUCT_SPU_LISTING_URL = "https://api.weixin.qq.com/product/spu/listing"; String PRODUCT_SPU_DELISTING_URL = "https://api.weixin.qq.com/product/spu/delisting"; } interface Sku { String PRODUCT_ADD_SKU_URL = "https://api.weixin.qq.com/product/sku/add"; String PRODUCT_BATCH_ADD_SKU_URL = "https://api.weixin.qq.com/product/sku/batch_add"; String PRODUCT_DEL_SKU_URL = "https://api.weixin.qq.com/product/sku/del"; String PRODUCT_UPDATE_SKU_URL = "https://api.weixin.qq.com/product/sku/update"; String PRODUCT_UPDATE_SKU_PRICE_URL = "https://api.weixin.qq.com/product/sku/update_price"; String PRODUCT_UPDATE_SKU_STOCK_URL = "https://api.weixin.qq.com/product/stock/update"; String PRODUCT_SKU_LIST = "https://api.weixin.qq.com/product/sku/get_list"; } interface Order { String PRODUCT_ORDER_GET_LIST = "https://api.weixin.qq.com/product/order/get_list"; String PRODUCT_ORDER_DETAIL_URL = "https://api.weixin.qq.com/product/order/get"; String PRODUCT_ORDER_CHANGE_MERCHANT_NOTES_URL = "https://api.weixin.qq.com/product/order/change_merchant_notes"; String PRODUCT_DELIVERY_SEND = "https://api.weixin.qq.com/product/delivery/send"; String GET_AFTER_SALE_ORDER = "https://api.weixin.qq.com/product/order/getaftersaleorder"; String BATCH_GET_AFTER_SALE_ORDER = "https://api.weixin.qq.com/product/order/batchgetaftersaleorder"; String AFTER_SALE_ACCEPT_APPLY = "https://api.weixin.qq.com/product/order/acceptapply"; String AFTER_SALE_REJECT_APPLY = "https://api.weixin.qq.com/product/order/rejectrefund"; } interface OTHER { String GET_CATEGORY = "https://api.weixin.qq.com/product/category/get"; String GET_BRAND = "https://api.weixin.qq.com/product/brand/get"; String GET_FREIGHT_TEMPLATE = "https://api.weixin.qq.com/product/delivery/get_freight_template"; String IMG_UPLOAD = "https://api.weixin.qq.com/product/img/upload"; } } public interface Shop { interface Spu { String SPU_ADD_URL = "https://api.weixin.qq.com/shop/spu/add"; String SPU_DEL_URL = "https://api.weixin.qq.com/shop/spu/del"; String SPU_GET_URL = "https://api.weixin.qq.com/shop/spu/get"; String SPU_GET_LIST_URL = "https://api.weixin.qq.com/shop/spu/get_list"; String SPU_UPDATE_URL = "https://api.weixin.qq.com/shop/spu/update"; String SPU_UPDATE_WITHOUT_URL = "https://api.weixin.qq.com/shop/spu/update_without_audit"; String SPU_LISTING_URL = "https://api.weixin.qq.com/shop/spu/listing"; String SPU_DELISTING_URL = "https://api.weixin.qq.com/shop/spu/delisting"; String DEL_AUDIT_URL = "https://api.weixin.qq.com/shop/spu/del_audit"; } interface Order { String ORDER_CHECK_SCENE = "https://api.weixin.qq.com/shop/scene/check"; String ORDER_ADD = "https://api.weixin.qq.com/shop/order/add"; String ORDER_PAY = "https://api.weixin.qq.com/shop/order/pay"; String ORDER_GET = "https://api.weixin.qq.com/shop/order/get"; String ORDER_GET_LIST = "https://api.weixin.qq.com/shop/order/get_list"; String ORDER_GET_PAYMENT_PARAMS = "https://api.weixin.qq.com/shop/order/getpaymentparams"; } interface Register { String REGISTER_APPLY = "https://api.weixin.qq.com/shop/register/apply"; String REGISTER_CHECK = "https://api.weixin.qq.com/shop/register/check"; String REGISTER_FINISH_ACCESS_INFO = "https://api.weixin.qq.com/shop/register/finish_access_info"; String REGISTER_APPLY_SCENE = "https://api.weixin.qq.com/shop/register/apply_scene"; } interface Account { String GET_CATEGORY_LIST = "https://api.weixin.qq.com/shop/account/get_category_list"; String GET_BRAND_LIST = "https://api.weixin.qq.com/shop/account/get_brand_list"; String UPDATE_INFO = "https://api.weixin.qq.com/shop/account/update_info"; String GET_INFO = "https://api.weixin.qq.com/shop/account/get_info"; } interface Cat { String GET_CAT = "https://api.weixin.qq.com/shop/cat/get"; } interface Img { String IMG_UPLOAD = "https://api.weixin.qq.com/shop/img/upload"; } interface Audit { String AUDIT_BRAND = "https://api.weixin.qq.com/shop/audit/audit_brand"; String AUDIT_CATEGORY = "https://api.weixin.qq.com/shop/audit/audit_category"; String AUDIT_RESULT = "https://api.weixin.qq.com/shop/audit/result"; String GET_MINIAPP_CERTIFICATE = "https://api.weixin.qq.com/shop/audit/get_miniapp_certificate"; } interface Delivery { String GET_COMPANY_LIST = "https://api.weixin.qq.com/shop/delivery/get_company_list"; String DELIVERY_SEND = "https://api.weixin.qq.com/shop/delivery/send"; String DELIVERY_RECEIVE = "https://api.weixin.qq.com/shop/delivery/recieve"; } interface Aftersale { String AFTERSALE_ADD = "https://api.weixin.qq.com/shop/ecaftersale/add"; String AFTERSALE_CANCEL = "https://api.weixin.qq.com/shop/ecaftersale/cancel"; String AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/aftersale/update"; String EC_AFTERSALE_UPDATE = "https://api.weixin.qq.com/shop/ecaftersale/update"; String AFTERSALE_UPLOAD_RETURN_INFO = "https://api.weixin.qq.com/shop/ecaftersale/uploadreturninfo"; String AFTERSALE_ACCEPT_REFUND = "https://api.weixin.qq.com/shop/ecaftersale/acceptrefund"; String AFTERSALE_ACCEPT_RETURN = "https://api.weixin.qq.com/shop/ecaftersale/acceptreturn"; String AFTERSALE_REJECT = "https://api.weixin.qq.com/shop/ecaftersale/reject"; String AFTERSALE_UPLOAD_CERTIFICATES = "https://api.weixin.qq.com/shop/ecaftersale/upload_certificates"; String AFTERSALE_UPLOAD_DEADLINE = "https://api.weixin.qq.com/shop/aftersale/update_deadline"; String AFTERSALE_GET_LIST = "https://api.weixin.qq.com/shop/ecaftersale/get_list"; String AFTERSALE_GET = "https://api.weixin.qq.com/shop/aftersale/get"; String ECAFTERSALE_GET = "https://api.weixin.qq.com/shop/ecaftersale/get"; } interface Sharer { String BIND = "https://api.weixin.qq.com/shop/sharer/bind"; String GET_SHARER_DATA_SUMMARY = "https://api.weixin.qq.com/shop/sharer/get_sharer_data_summary"; String GET_SHARER_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_list"; String GET_SHARER_LIVE_ORDER_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_live_order_list"; String GET_SHARER_LIVE_SUMMARY_LIST = "https://api.weixin.qq.com/shop/sharer/get_sharer_live_summary_list"; String SEARCH_SHARER = "https://api.weixin.qq.com/shop/sharer/search_sharer"; String UNBIND = "https://api.weixin.qq.com/shop/sharer/unbind"; } interface Coupon { String ADD_COUPON = "https://api.weixin.qq.com/shop/coupon/add"; String GET_COUPON = "https://api.weixin.qq.com/shop/coupon/get"; String GET_COUPON_LIST = "https://api.weixin.qq.com/shop/coupon/get_list"; String UPDATE_COUPON = "https://api.weixin.qq.com/shop/coupon/update"; String UPDATE_COUPON_STATUS = "https://api.weixin.qq.com/shop/coupon/update_status"; String UPDATE_COUPON_STOCK = "https://api.weixin.qq.com/shop/coupon/update_coupon_stock"; String ADD_USER_COUPON = "https://api.weixin.qq.com/shop/coupon/add_user_coupon"; String GET_USER_COUPON_LIST = "https://api.weixin.qq.com/shop/coupon/get_usercoupon_list"; String UPDATE_USER_COUPON = "https://api.weixin.qq.com/shop/coupon/update_user_coupon"; String UPDATE_USER_COUPON_STATUS = "https://api.weixin.qq.com/shop/coupon/update_usercoupon_status"; } interface Pay { String CREATE_ORDER = "https://api.weixin.qq.com/shop/pay/createorder"; String GET_ORDER = "https://api.weixin.qq.com/shop/pay/getorder"; String REFUND_ORDER = "https://api.weixin.qq.com/shop/pay/refundorder"; } } /** 电子发票报销方 */ public interface Invoice { /** 报销方查询报销发票信息 */ String GET_INVOICE_INFO = "https://api.weixin.qq.com/card/invoice/reimburse/getinvoiceinfo"; /** 报销方批量查询报销发票信息 */ String GET_INVOICE_BATCH = "https://api.weixin.qq.com/card/invoice/reimburse/getinvoicebatch"; /** 报销方更新发票状态 */ String UPDATE_INVOICE_STATUS = "https://api.weixin.qq.com/card/invoice/reimburse/updateinvoicestatus"; /** 报销方批量更新发票状态 */ String UPDATE_STATUS_BATCH = "https://api.weixin.qq.com/card/invoice/reimburse/updatestatusbatch"; } public interface Internet { String GET_USER_ENCRYPT_KEY = "https://api.weixin.qq.com/wxa/business/getuserencryptkey"; } /** 设备订阅消息 */ public interface DeviceSubscribe { /** 获取设备票据 */ String GET_SN_TICKET_URL = "https://api.weixin.qq.com/wxa/getsnticket"; /** 发送设备订阅消息 */ String SEND_DEVICE_SUBSCRIBE_MSG_URL = "https://api.weixin.qq.com/cgi-bin/message/device/subscribe/send"; /** 创建设备组 */ String CREATE_IOT_GROUP_ID_URL = "https://api.weixin.qq.com/wxa/business/group/createid"; /** 设备组添加设备 */ String ADD_IOT_GROUP_DEVICE_URL = "https://api.weixin.qq.com/wxa/business/group/adddevice"; /** 设备组删除设备 */ String REMOVE_IOT_GROUP_DEVICE_URL = "https://api.weixin.qq.com/wxa/business/group/removedevice"; /** 查询设备组信息 */ String GET_IOT_GROUP_INFO_URL = "https://api.weixin.qq.com/wxa/business/group/getinfo"; } /** * 即时配送相关接口. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/immediate-delivery/overview.html * </pre> */ public interface InstantDelivery { /** * 拉取已绑定账号. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getBindAccount.html * </pre> */ String GET_BIND_ACCOUNT = "https://api.weixin.qq.com/cgi-bin/express/local/business/shop/get"; /** * 拉取配送单信息. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getOrder.html * </pre> */ String GET_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/order/get"; /** * 模拟配送公司更新配送单状态. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.mockUpdateOrder.html * </pre> */ String MOCK_UPDATE_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/test_update_order"; /** 物流服务-查询组件-跟踪物流面单 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化 */ String TRACE_WAYBILL_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/trace_waybill"; /** 物流服务-查询组件-查询运单接口 query_trace 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 */ String QUERY_WAYBILL_TRACE_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_trace"; /** 物流服务-消息组件-传运单接口(订阅消息) follow_waybill 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 */ String FOLLOW_WAYBILL_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/follow_waybill"; /** 物流服务-消息组件-查运单接口(订阅消息) query_follow_trace 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 */ String QUERY_FOLLOW_TRACE_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/query_follow_trace"; /** 获取运力id列表get_delivery_list 商户使用此接口获取所有运力id的列表 */ String GET_DELIVERY_LIST_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/get_delivery_list"; /** 物流服务-查询组件-更新物品信息接口 update_waybill_goods 更新物品信息 */ String UPDATE_WAYBILL_GOODS_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/update_waybill_goods"; /** 下单接口. */ interface PlaceAnOrder { /** * 获取已支持的配送公司列表接口. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getAllImmeDelivery.html * </pre> */ String GET_ALL_IMME_DELIVERY = "https://api.weixin.qq.com/cgi-bin/express/local/business/delivery/getall"; /** * 预下配送单接口. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.preAddOrder.html * </pre> */ String PRE_ADD_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/order/pre_add"; /** * 下配送单接口. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addOrder.html * </pre> */ String ADD_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/order/add"; /** * 重新下单. * * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.reOrder.html * </pre> */ String RE_ORDER = "https://api.weixin.qq.com/cgi-bin/express/local/business/order/readd"; /** * 增加小费. * * <pre> * 可以对待接单状态的订单增加小费。需要注意:订单的小费,以最新一次加小费动作的金额为准,故下一次增加小费额必须大于上一次小费额. * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addTip.html * </pre> */ String ADD_TIP = "https://api.weixin.qq.com/cgi-bin/express/local/business/order/addtips"; } /** 取消接口. */ interface Cancel { /** * 预取消配送单接口. * * <pre>
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
true
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/ImageMessageBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/ImageMessageBuilder.java
package cn.binarywang.wx.miniapp.builder; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; import static cn.binarywang.wx.miniapp.constant.WxMaConstants.KefuMsgType; /** * 图片消息builder. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public final class ImageMessageBuilder extends BaseBuilder<ImageMessageBuilder> { private String mediaId; public ImageMessageBuilder() { this.msgType = KefuMsgType.IMAGE; } public ImageMessageBuilder mediaId(String mediaId) { this.mediaId = mediaId; return this; } @Override public WxMaKefuMessage build() { WxMaKefuMessage m = super.build(); m.setImage(new WxMaKefuMessage.KfImage(this.mediaId)); return m; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/TextMessageBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/TextMessageBuilder.java
package cn.binarywang.wx.miniapp.builder; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; import static cn.binarywang.wx.miniapp.constant.WxMaConstants.KefuMsgType; /** * 文本消息builder. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public final class TextMessageBuilder extends BaseBuilder<TextMessageBuilder> { private String content; public TextMessageBuilder() { this.msgType = KefuMsgType.TEXT; } public TextMessageBuilder content(String content) { this.content = content; return this; } @Override public WxMaKefuMessage build() { WxMaKefuMessage m = super.build(); m.setText(new WxMaKefuMessage.KfText(this.content)); return m; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/BaseBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/BaseBuilder.java
package cn.binarywang.wx.miniapp.builder; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class BaseBuilder<T> { protected String msgType; protected String toUser; protected String aiMsgContextMsgId; @SuppressWarnings("unchecked") public T toUser(String toUser) { this.toUser = toUser; return (T) this; } @SuppressWarnings("unchecked") public T aiMsgContextMsgId(String msgId) { this.aiMsgContextMsgId = msgId; return (T) this; } /** * 构造器方法. */ public WxMaKefuMessage build() { WxMaKefuMessage m = new WxMaKefuMessage(); m.setMsgType(this.msgType); m.setToUser(this.toUser); if (this.aiMsgContextMsgId != null) { m.setAiMsgContext(new WxMaKefuMessage.AiMsgContext(this.aiMsgContextMsgId)); } return m; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/MaPageMessageBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/MaPageMessageBuilder.java
package cn.binarywang.wx.miniapp.builder; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; import static cn.binarywang.wx.miniapp.constant.WxMaConstants.KefuMsgType; /** * 小程序卡片消息builder * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class MaPageMessageBuilder extends BaseBuilder<MaPageMessageBuilder> { private String title; private String pagePath; private String thumbMediaId; public MaPageMessageBuilder() { this.msgType = KefuMsgType.MA_PAGE; } public MaPageMessageBuilder title(String title) { this.title = title; return this; } public MaPageMessageBuilder pagePath(String pagePath) { this.pagePath = pagePath; return this; } public MaPageMessageBuilder thumbMediaId(String thumbMediaId) { this.thumbMediaId = thumbMediaId; return this; } @Override public WxMaKefuMessage build() { WxMaKefuMessage m = super.build(); m.setMaPage(WxMaKefuMessage.KfMaPage.builder() .title(this.title) .pagePath(this.pagePath) .thumbMediaId(this.thumbMediaId) .build() ); return m; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/LinkMessageBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/builder/LinkMessageBuilder.java
package cn.binarywang.wx.miniapp.builder; import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; import static cn.binarywang.wx.miniapp.constant.WxMaConstants.KefuMsgType; /** * 图文链接消息builder * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class LinkMessageBuilder extends BaseBuilder<LinkMessageBuilder> { private String title; private String description; private String url; private String thumbUrl; public LinkMessageBuilder() { this.msgType = KefuMsgType.LINK; } public LinkMessageBuilder title(String title) { this.title = title; return this; } public LinkMessageBuilder description(String description) { this.description = description; return this; } public LinkMessageBuilder url(String url) { this.url = url; return this; } public LinkMessageBuilder thumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; return this; } @Override public WxMaKefuMessage build() { WxMaKefuMessage m = super.build(); m.setLink(WxMaKefuMessage.KfLink.builder().title(this.title) .description(this.description) .url(this.url) .thumbUrl(this.thumbUrl) .build() ); return m; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/WxMaGsonBuilder.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/WxMaGsonBuilder.java
package cn.binarywang.wx.miniapp.json; import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMsgEvent; import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage; import cn.binarywang.wx.miniapp.bean.analysis.WxMaRetainInfo; import cn.binarywang.wx.miniapp.bean.analysis.WxMaUserPortrait; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitDistribution; import cn.binarywang.wx.miniapp.bean.code.WxMaCodeCommitRequest; import cn.binarywang.wx.miniapp.bean.code.WxMaCodeVersionDistribution; import cn.binarywang.wx.miniapp.json.adaptor.*; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; import java.io.File; import java.util.Objects; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaGsonBuilder { private static final GsonBuilder INSTANCE = new GsonBuilder(); private static volatile Gson GSON_INSTANCE; static { INSTANCE.disableHtmlEscaping(); INSTANCE.registerTypeAdapter(WxMaSubscribeMessage.class, new WxMaSubscribeMessageGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaUniformMessage.class, new WxMaUniformMessageGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaCodeCommitRequest.class, new WxMaCodeCommitRequestGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaCodeVersionDistribution.class, new WxMaCodeVersionDistributionGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaVisitDistribution.class, new WxMaVisitDistributionGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaRetainInfo.class, new WxMaRetainInfoGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaUserPortrait.class, new WxMaUserPortraitGsonAdapter()); INSTANCE.registerTypeAdapter(WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson.class, new WxMaSubscribeMsgEventJsonAdapter()); INSTANCE.setExclusionStrategies(new ExclusionStrategy() { @Override public boolean shouldSkipField(FieldAttributes fieldAttributes) { return false; } @Override public boolean shouldSkipClass(Class<?> aClass) { return aClass == File.class || aClass == ApacheHttpClientBuilder.class; } }); } public static Gson create() { if (Objects.isNull(GSON_INSTANCE)) { synchronized (INSTANCE) { if (Objects.isNull(GSON_INSTANCE)) { GSON_INSTANCE = INSTANCE.create(); } } } return GSON_INSTANCE; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaUserPortraitGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaUserPortraitGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.analysis.WxMaUserPortrait; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import me.chanjar.weixin.common.util.json.GsonHelper; import org.apache.commons.lang3.StringUtils; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaUserPortraitGsonAdapter implements JsonDeserializer<WxMaUserPortrait> { @Override public WxMaUserPortrait deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { if (json == null) { return null; } WxMaUserPortrait portrait = new WxMaUserPortrait(); JsonObject object = json.getAsJsonObject(); String refDate = GsonHelper.getString(object, "ref_date"); portrait.setRefDate(refDate); portrait.setVisitUvNew(getPortraitItem(object.getAsJsonObject("visit_uv_new"))); portrait.setVisitUv(getPortraitItem(object.getAsJsonObject("visit_uv"))); return portrait; } private WxMaUserPortrait.Item getPortraitItem(JsonObject object) { if (object == null) { return null; } WxMaUserPortrait.Item item = new WxMaUserPortrait.Item(); item.setProvince(getAsMap(object, "province")); item.setCity(getAsMap(object, "city")); item.setGenders(getAsMap(object, "genders")); item.setPlatforms(getAsMap(object, "platforms")); item.setDevices(getAsMap(object, "devices")); item.setAges(getAsMap(object, "ages")); return item; } private Map<String, Long> getAsMap(JsonObject object, String memberName) { JsonArray array = object.getAsJsonArray(memberName); if (array != null && !array.isEmpty()) { Map<String, Long> map = new LinkedHashMap<>(array.size()); for (JsonElement element : array) { JsonObject elementObject = element.getAsJsonObject(); String name = GsonHelper.getString(elementObject, "name"); if (StringUtils.isNotBlank(name)) { Long value = GsonHelper.getLong(elementObject, "value"); map.put(name, value); } } return map; } return null; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaRetainInfoGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaRetainInfoGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.analysis.WxMaRetainInfo; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import me.chanjar.weixin.common.util.json.GsonHelper; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaRetainInfoGsonAdapter implements JsonDeserializer<WxMaRetainInfo> { @Override public WxMaRetainInfo deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { if (json == null) { return null; } WxMaRetainInfo retainInfo = new WxMaRetainInfo(); JsonObject object = json.getAsJsonObject(); String refDate = GsonHelper.getString(object, "ref_date"); retainInfo.setRefDate(refDate); retainInfo.setVisitUvNew(getAsMap(object, "visit_uv_new")); retainInfo.setVisitUv(getAsMap(object, "visit_uv")); return retainInfo; } private Map<Integer, Integer> getAsMap(JsonObject object, String memberName) { JsonArray array = object.getAsJsonArray(memberName); if (array != null && !array.isEmpty()) { Map<Integer, Integer> map = new LinkedHashMap<>(array.size()); for (JsonElement element : array) { JsonObject elementObject = element.getAsJsonObject(); Integer key = GsonHelper.getInteger(elementObject, "key"); if (key != null) { Integer value = GsonHelper.getInteger(elementObject, "value"); map.put(key, value); } } return map; } return null; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaSubscribeMessageGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaSubscribeMessageGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import java.lang.reflect.Type; /** * . * * @author S */ public class WxMaSubscribeMessageGsonAdapter implements JsonSerializer<WxMaSubscribeMessage> { @Override public JsonElement serialize(WxMaSubscribeMessage message, Type typeOfSrc, JsonSerializationContext context) { JsonObject messageJson = new JsonObject(); messageJson.addProperty("touser", message.getToUser()); messageJson.addProperty("template_id", message.getTemplateId()); if (message.getPage() != null) { messageJson.addProperty("page", message.getPage()); } if (message.getMiniprogramState() != null) { messageJson.addProperty("miniprogram_state", message.getMiniprogramState()); } if (message.getLang() != null) { messageJson.addProperty("lang", message.getLang()); } JsonObject data = new JsonObject(); messageJson.add("data", data); if (message.getData() == null) { return messageJson; } for (WxMaSubscribeMessage.MsgData datum : message.getData()) { JsonObject dataJson = new JsonObject(); dataJson.addProperty("value", datum.getValue()); data.add(datum.getName(), dataJson); } return messageJson; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaSubscribeMsgEventJsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaSubscribeMsgEventJsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMsgEvent; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import lombok.extern.slf4j.Slf4j; import java.lang.reflect.Type; /** * WxMaSubscribeMsgEventJsonAdapter class * * @author dany * created on 2021/12/31 */ @Slf4j public class WxMaSubscribeMsgEventJsonAdapter implements JsonDeserializer<WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson> { @Override public WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson result = new WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson(); if (json.isJsonArray()) { JsonArray array = json.getAsJsonArray(); if (!array.isEmpty()) { JsonObject obj = array.get(0).getAsJsonObject(); MsgEventTypeEnum eventType = detectMsgEventType(obj); for (int i = 0; i < array.size(); ++i) { obj = array.get(i).getAsJsonObject(); setField(result, eventType, obj); } } } else { JsonObject obj = json.getAsJsonObject(); MsgEventTypeEnum eventType = detectMsgEventType(obj); setField(result, eventType, obj); } return result; } public enum MsgEventTypeEnum { EVENT_POPUP,EVENT_CHANGE,EVENT_SENT; } private MsgEventTypeEnum detectMsgEventType(JsonObject obj) { JsonElement popupScene = obj.get("PopupScene"); if (popupScene != null) { return MsgEventTypeEnum.EVENT_POPUP; } JsonElement msgId = obj.get("MsgID"); if (msgId != null) { return MsgEventTypeEnum.EVENT_SENT; } JsonElement errorCode = obj.get("ErrorCode"); if (errorCode != null) { return MsgEventTypeEnum.EVENT_SENT; } JsonElement errorStatus = obj.get("ErrorStatus"); if (errorStatus != null) { return MsgEventTypeEnum.EVENT_SENT; } return MsgEventTypeEnum.EVENT_CHANGE; } private WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson setField(WxMaSubscribeMsgEvent.WxMaSubscribeMsgEventJson target, MsgEventTypeEnum eventType, JsonObject json) { switch (eventType) { case EVENT_POPUP: if (target.getPopupEvents() == null) { target.setPopupEvents(new WxMaSubscribeMsgEvent.SubscribeMsgPopupEvent()); } WxMaSubscribeMsgEvent.PopupEvent popupEvent = new WxMaSubscribeMsgEvent.PopupEvent(); popupEvent.setTemplateId(json.get("TemplateId").getAsString()); popupEvent.setSubscribeStatusString(json.get("SubscribeStatusString").getAsString()); popupEvent.setPopupScene(json.get("PopupScene").getAsString()); target.getPopupEvents().getList().add(popupEvent); break; case EVENT_CHANGE: if (target.getChangeEvents() == null) { target.setChangeEvents(new WxMaSubscribeMsgEvent.SubscribeMsgChangeEvent()); } WxMaSubscribeMsgEvent.ChangeEvent changeEvent = new WxMaSubscribeMsgEvent.ChangeEvent(); changeEvent.setTemplateId(json.get("TemplateId").getAsString()); changeEvent.setSubscribeStatusString(json.get("SubscribeStatusString").getAsString()); target.getChangeEvents().getList().add(changeEvent); break; case EVENT_SENT: if (target.getSentEvent() == null) { target.setSentEvent(new WxMaSubscribeMsgEvent.SubscribeMsgSentEvent()); } WxMaSubscribeMsgEvent.SentEvent sentEvent = new WxMaSubscribeMsgEvent.SentEvent(); sentEvent.setTemplateId(json.get("TemplateId").getAsString()); sentEvent.setMsgId(json.get("MsgID").getAsString()); sentEvent.setErrorCode(json.get("ErrorCode").getAsString()); sentEvent.setErrorStatus(json.get("ErrorStatus").getAsString()); target.getSentEvent().setList(sentEvent); break; } return target; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaCodeCommitRequestGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaCodeCommitRequestGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.code.WxMaCodeCommitRequest; import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; import java.lang.reflect.Type; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 19:47 */ public class WxMaCodeCommitRequestGsonAdapter implements JsonSerializer<WxMaCodeCommitRequest> { @Override public JsonElement serialize(WxMaCodeCommitRequest request, Type typeOfSrc, JsonSerializationContext context) { JsonObject requestJson = new JsonObject(); requestJson.addProperty("template_id", request.getTemplateId()); requestJson.addProperty("user_version", request.getUserVersion()); requestJson.addProperty("user_desc", request.getUserDesc()); if (request.getExtConfig() != null) { requestJson.addProperty("ext_json", WxMaGsonBuilder.create().toJson(request.getExtConfig())); } return requestJson; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaVisitDistributionGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaVisitDistributionGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.analysis.WxMaVisitDistribution; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import me.chanjar.weixin.common.util.json.GsonHelper; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public class WxMaVisitDistributionGsonAdapter implements JsonDeserializer<WxMaVisitDistribution> { @Override public WxMaVisitDistribution deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { if (json == null) { return null; } WxMaVisitDistribution distribution = new WxMaVisitDistribution(); JsonObject object = json.getAsJsonObject(); String refDate = GsonHelper.getString(object, "ref_date"); distribution.setRefDate(refDate); boolean hasList = object.has("list"); if (!hasList) { return distribution; } JsonArray listArray = object.getAsJsonArray("list"); Map<String, Map<Integer, Integer>> list = new ConcurrentHashMap<>(listArray.size()); for (JsonElement indexElement : listArray) { JsonObject indexObject = indexElement.getAsJsonObject(); String index = GsonHelper.getString(indexObject, "index"); if (index == null) { continue; } Map<Integer, Integer> itemList = new LinkedHashMap<>(); JsonArray itemArray = indexObject.getAsJsonArray("item_list"); if (itemArray == null || itemArray.size() <= 0) { list.put(index, itemList); continue; } for (JsonElement itemElement : itemArray) { JsonObject itemObject = itemElement.getAsJsonObject(); Integer key = GsonHelper.getInteger(itemObject, "key"); Integer value = GsonHelper.getInteger(itemObject, "value"); if (key != null) { itemList.put(key, value); } } list.put(index, itemList); } distribution.setList(list); return distribution; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaCodeVersionDistributionGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaCodeVersionDistributionGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import cn.binarywang.wx.miniapp.bean.code.WxMaCodeVersionDistribution; import com.google.gson.JsonArray; import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializer; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParseException; import me.chanjar.weixin.common.util.json.GsonHelper; import java.lang.reflect.Type; import java.util.LinkedHashMap; import java.util.Map; /** * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-26 19:47 */ public class WxMaCodeVersionDistributionGsonAdapter implements JsonDeserializer<WxMaCodeVersionDistribution> { @Override public WxMaCodeVersionDistribution deserialize(JsonElement json, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException { if (json == null) { return null; } WxMaCodeVersionDistribution distribution = new WxMaCodeVersionDistribution(); JsonObject object = json.getAsJsonObject(); distribution.setNowVersion(GsonHelper.getString(object, "now_version")); distribution.setUvInfo(getAsMap(object.getAsJsonObject("uv_info"), "items")); return distribution; } private Map<String, Float> getAsMap(JsonObject object, String memberName) { JsonArray array = object.getAsJsonArray(memberName); if (array != null && !array.isEmpty()) { Map<String, Float> map = new LinkedHashMap<>(array.size()); for (JsonElement element : array) { JsonObject elementObject = element.getAsJsonObject(); String version = GsonHelper.getString(elementObject, "version"); if (version != null) { Float percentage = GsonHelper.getFloat(elementObject, "percentage"); map.put(version, percentage); } } return map; } return null; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaUniformMessageGsonAdapter.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/json/adaptor/WxMaUniformMessageGsonAdapter.java
package cn.binarywang.wx.miniapp.json.adaptor; import java.lang.reflect.Type; import cn.binarywang.wx.miniapp.bean.WxMaTemplateData; import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializer; /** * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public class WxMaUniformMessageGsonAdapter implements JsonSerializer<WxMaUniformMessage> { @Override public JsonElement serialize(WxMaUniformMessage message, Type typeOfSrc, JsonSerializationContext context) { JsonObject messageJson = new JsonObject(); messageJson.addProperty("touser", message.getToUser()); if (message.isMpTemplateMsg()) { JsonObject msg = new JsonObject(); if (message.getAppid() != null) { msg.addProperty("appid", message.getAppid()); } msg.addProperty("template_id", message.getTemplateId()); if (message.getUrl() != null) { msg.addProperty("url", message.getUrl()); } final WxMaUniformMessage.MiniProgram miniProgram = message.getMiniProgram(); if (miniProgram != null) { JsonObject miniProgramJson = new JsonObject(); miniProgramJson.addProperty("appid", miniProgram.getAppid()); if (miniProgram.isUsePath()) { miniProgramJson.addProperty("path", miniProgram.getPagePath()); } else if (miniProgram.isUsePagePath()) { miniProgramJson.addProperty("pagePath", miniProgram.getPagePath()); } else { miniProgramJson.addProperty("pagepath", miniProgram.getPagePath()); } msg.add("miniprogram", miniProgramJson); } if (message.getData() != null) { JsonObject data = new JsonObject(); for (WxMaTemplateData templateData : message.getData()) { JsonObject dataJson = new JsonObject(); dataJson.addProperty("value", templateData.getValue()); if (templateData.getColor() != null) { dataJson.addProperty("color", templateData.getColor()); } data.add(templateData.getName(), dataJson); } msg.add("data", data); } messageJson.add("mp_template_msg", msg); return messageJson; } //小程序模版消息 JsonObject msg = new JsonObject(); msg.addProperty("template_id", message.getTemplateId()); if (message.getPage() != null) { msg.addProperty("page", message.getPage()); } if (message.getFormId() != null) { msg.addProperty("form_id", message.getFormId()); } JsonObject data = new JsonObject(); msg.add("data", data); if (message.getData() != null) { for (WxMaTemplateData templateData : message.getData()) { JsonObject dataJson = new JsonObject(); dataJson.addProperty("value", templateData.getValue()); data.add(templateData.getName(), dataJson); } } if (message.getEmphasisKeyword() != null) { msg.addProperty("emphasis_keyword", message.getEmphasisKeyword()); } messageJson.add("weapp_template_msg", msg); return messageJson; } }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAuditService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAuditService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAuditBrandRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAuditCategoryRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditBrandResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditCategoryResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAuditResultResponse; import com.google.gson.JsonObject; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序交易组件-接入商品前必需接口(审核相关接口) * * @author liming1019 * created on 2021/8/12 */ public interface WxMaShopAuditService { /** * 上传品牌信息(品牌审核) * * @param request * @return WxMaShopAuditBrandResponse * @throws WxErrorException */ WxMaShopAuditBrandResponse auditBrand(WxMaShopAuditBrandRequest request) throws WxErrorException; /** * 上传类目资质(类目审核) * * @param request * @return * @throws WxErrorException */ WxMaShopAuditCategoryResponse auditCategory(WxMaShopAuditCategoryRequest request) throws WxErrorException; /** * 获取审核结果 * * @param auditId * @return WxMaShopAuditResultResponse * @throws WxErrorException */ WxMaShopAuditResultResponse getAuditResult(String auditId) throws WxErrorException; /** * 获取小程序提交过的入驻资质信息 * * @param reqType * @return JsonObject * @throws WxErrorException */ JsonObject getMiniappCertificate(int reqType) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaRunService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaRunService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaRunStepInfo; import java.util.List; /** * 微信运动相关操作接口. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public interface WxMaRunService { /** * 解密分享敏感数据. * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api/open-api/werun/wx.getWeRunData.html * * @param sessionKey 会话密钥 * @param encryptedData 消息密文 * @param ivStr 加密算法的初始向量 * @return the run step info */ List<WxMaRunStepInfo> getRunStepInfo(String sessionKey, String encryptedData, String ivStr); }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCustomserviceWorkService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCustomserviceWorkService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.customservice.WxMaCustomserviceResult; import me.chanjar.weixin.common.error.WxErrorException; /** * <pre> * 小程序 - 微信客服 相关接口 * 负责处理 https://api.weixin.qq.com/customservice/work/** * 文档:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/kf-work/getKfWorkBound.html * 绑定的企业ID,需和小程序主体一致。 * 目前仅支持绑定非个人小程序。 * Created by tryking123 on 2025/8/18. * </pre> * * @author <a href="https://github.com/tryking123">tryking123</a> */ public interface WxMaCustomserviceWorkService { /** * 查询小程序的微信客服绑定情况 */ String GET_CUSTOMSERVICE_URL = "https://api.weixin.qq.com/customservice/work/get"; /** * 为小程序绑定微信客服 注:此接口绑定的企业ID需完成企业认证 */ String BIND_CUSTOMSERVICE_URL = "https://api.weixin.qq.com/customservice/work/bind"; /** * 为小程序解除绑定微信客服 */ String UNBIND_CUSTOMSERVICE_URL = "https://api.weixin.qq.com/customservice/work/unbind"; /** * 查询小程序的微信客服绑定情况 * * @return 成功示例json { "errcode": 0,"entityName": "XXXXX有限公司","corpid": "wwee11111xxxxxxx","bindTime": 1694611289 } * @throws WxErrorException */ WxMaCustomserviceResult getCustomservice() throws WxErrorException; /** * 绑定微信客服 * @param corpid 企业ID,获取方式参考:https://developer.work.weixin.qq.com/document/path/90665#corpid * @return 成功示例json { "errcode": 0 } * @throws WxErrorException */ WxMaCustomserviceResult bindCustomservice(String corpid) throws WxErrorException; /** * 解除绑定微信客服 * @param corpid 企业ID,获取方式参考:https://developer.work.weixin.qq.com/document/path/90665#corpid * @return 成功示例json { "errcode": 0 } * @throws WxErrorException */ WxMaCustomserviceResult unbindCustomservice(String corpid) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSharerService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSearchSharerResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerBindResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerDataSummaryResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveOrderListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerLiveSummaryListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopSharerUnbindResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * 分享员 * @author leiin * created on 2022/6/18 2:48 下午 */ public interface WxMaShopSharerService { /** * 绑定分享员 * 用来批量邀请分享员 * @param openids * @return * @throws WxErrorException */ WxMaShopSharerBindResponse bindSharer(String[] openids) throws WxErrorException; /** * 获取分享员的总带货数据 * @param openid * @return * @throws WxErrorException */ WxMaShopSharerDataSummaryResponse getSharerDataSummary(String openid) throws WxErrorException; /** * 获取已经绑定的分享员列表 * @param page * @param pageSize * @return * @throws WxErrorException */ WxMaShopSharerListResponse getSharerList(Integer page, Integer pageSize) throws WxErrorException; /** * 获取分享员的直播间订单汇总 * @param openid * @param liveExportId * @param page * @param pageSize * @return * @throws WxErrorException */ WxMaShopSharerLiveOrderListResponse getSharerLiveOrderList(String openid, String liveExportId, Integer page, Integer pageSize) throws WxErrorException; /** * 获取分享员的直播间带货数据汇总 * @param openid * @param page * @param pageSize * @return * @throws WxErrorException */ WxMaShopSharerLiveSummaryListResponse getSharerLiveSummaryList(String openid, Integer page, Integer pageSize) throws WxErrorException; /** * 查看分享员 * @param openid * @return * @throws WxErrorException */ WxMaShopSearchSharerResponse searchSharer(String openid) throws WxErrorException; /** * 解绑分享员 * @param openids * @return * @throws WxErrorException */ WxMaShopSharerUnbindResponse unbindSharer(String[] openids) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaSchemeService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaSchemeService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.scheme.WxMaGenerateNfcSchemeRequest; import cn.binarywang.wx.miniapp.bean.scheme.WxMaGenerateSchemeRequest; import me.chanjar.weixin.common.error.WxErrorException; /** * <pre> * 小程序Scheme码相关操作接口. * * * </pre> * * @author : cofedream * created on : 2021-01-26 */ public interface WxMaSchemeService { /** * 获取小程序scheme码 *文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html * @param request 请求参数 * @throws WxErrorException 生成失败时抛出,具体错误码请看文档 */ String generate(WxMaGenerateSchemeRequest request) throws WxErrorException; /** * 获取NFC 的小程序 scheme *文档地址:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-scheme/generateNFCScheme.html * @param request 请求参数 * @throws WxErrorException 生成失败时抛出,具体错误码请看文档 */ String generateNFC(WxMaGenerateNfcSchemeRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.live.*; import me.chanjar.weixin.common.error.WxErrorException; import java.util.List; import java.util.Map; /** * <pre> * 直播相关操作接口. * Created by yjwang on 2020/4/5. * </pre> * * @author <a href="https://github.com/yjwang3300300">yjwang</a> */ public interface WxMaLiveService { /** * 创建直播间 * <pre> * 调用此接口创建直播间,创建成功后将在直播间列表展示,调用额度:10000次/一天 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#1 * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=ACCESS_TOKEN * </pre> * * @param roomInfo 直播间信息 * @return . * @throws WxErrorException . */ WxMaCreateRoomResult createRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException; /** * 删除直播间 * <pre> * 调用额度:10000次/一天 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#5 * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom?access_token=ACCESS_TOKEN * </pre> * * @param roomId 直播间id * @return . * @throws WxErrorException . */ boolean deleteRoom(Integer roomId) throws WxErrorException; /** * 编辑直播间 * <pre> * 调用此接口编辑直播间,调用额度:10000次/一天 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#6 * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/editroom?access_token=ACCESS_TOKEN * </pre> * * @param roomInfo 直播间信息 * @return . * @throws WxErrorException . */ boolean editRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException; /** * 获取直播间推流地址 * <pre> * 调用额度:10000次/一天 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#7 * http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl?access_token=ACCESS_TOKEN * </pre> * * @param roomId 直播间id * @return . * @throws WxErrorException . */ String getPushUrl(Integer roomId) throws WxErrorException; /** * 获取直播间分享二维码 * <pre> * 调用额度:10000次/一天 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#8 * http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode?access_token=ACCESS_TOKEN * </pre> * * @param roomId 直播间id * @return . * @throws WxErrorException . */ WxMaLiveSharedCode getSharedCode(Integer roomId, String params) throws WxErrorException; /** * 获取直播房间列表.(分页) * * @param start 起始拉取房间,start = 0 表示从第 1 个房间开始拉取 * @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内 * @return . * @throws WxErrorException . */ WxMaLiveResult getLiveInfo(Integer start, Integer limit) throws WxErrorException; /** * 获取所有直播间信息(没有分页直接获取全部) * * @return . * @throws WxErrorException . */ List<WxMaLiveResult.RoomInfo> getLiveInfos() throws WxErrorException; /** * 获取直播房间回放数据信息. * * @param action 获取回放 * @param roomId 直播间 id * @param start 起始拉取视频,start = 0 表示从第 1 个视频片段开始拉取 * @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内 * @return . * @throws WxErrorException . */ WxMaLiveResult getLiveReplay(String action, Integer roomId, Integer start, Integer limit) throws WxErrorException; /** * 获取直播房间回放数据信息. * <p> * 获取回放 (默认:get_replay) * * @param roomId 直播间 id * @param start 起始拉取视频,start = 0 表示从第 1 个视频片段开始拉取 * @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内 * @return . * @throws WxErrorException . */ WxMaLiveResult getLiveReplay(Integer roomId, Integer start, Integer limit) throws WxErrorException; /** * 直播间导入商品 * <p> * 调用接口往指定直播间导入已入库的商品 * 调用频率 * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param goodsIds 数组列表,可传入多个,里面填写 商品 ID * @return 导入商品是否成功 * @throws WxErrorException . */ boolean addGoodsToRoom(Integer roomId, List<Integer> goodsIds) throws WxErrorException; /** * 添加管理直播间小助手 * <p> * 调用接口往指定直播间添加管理直播间小助手 * 调用频率 * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param users 数组列表,可传入多个,"users": [{"username":"testwechat","nickname":"testnick"}] * @return 添加管理直播间小助手是否成功 * @throws WxErrorException . */ boolean addAssistant(Integer roomId, List<WxMaLiveAssistantInfo> users) throws WxErrorException; /** * 修改直播间小助手昵称 * <p> * 调用接口修改直播间小助手昵称 * 调用频率 * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param username 小助手微信号 * @param nickname 小助手直播间昵称 * @return 修改小助手昵称是否成功 * @throws WxErrorException . */ boolean modifyAssistant(Integer roomId, String username, String nickname) throws WxErrorException; /** * 删除直播间小助手 * <p> * 删除直播间小助手 * 调用频率 * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param username 小助手微信号 * @return 删除小助手昵称是否成功 * @throws WxErrorException . */ boolean removeAssistant(Integer roomId, String username) throws WxErrorException; /** * 查询直播间小助手 * <p> * 查询直播间小助手 * 调用频率 * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @return 小助手列表 * @throws WxErrorException . */ List<WxMaAssistantResult.Assistant> getAssistantList(Integer roomId) throws WxErrorException; /** * 添加主播副号 * <p> * 调用接口添加主播副号 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/addsubanchor?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param username 用户微信号 * @return 是否成功 * @throws WxErrorException . */ boolean addSubanchor(Integer roomId, String username) throws WxErrorException; /** * 修改主播副号 * <p> * 调用接口修改主播副号 * <p> * 调用频率: 10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param username 小助手微信号 * @param username 用户微信号 * @return 是否成功 * @throws WxErrorException . */ boolean modifySubanchor(Integer roomId, String username) throws WxErrorException; /** * 删除主播副号 * <p> * 调用频率: 10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/deletesubanchor?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @return 是否成功 * @throws WxErrorException . */ boolean deleteSubanchor(Integer roomId) throws WxErrorException; /** * 获取主播副号 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/room/getsubanchor?access_token=ACCESS_TOKEN * </pre> * @param roomId 直播间id * @return . * @throws WxErrorException . */ String getSubanchor(Integer roomId) throws WxErrorException; /** * 开启/关闭直播间官方收录 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/updatefeedpublic?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param isFeedsPublic 是否开启官方收录 【1: 开启,0:关闭】 * @return 是否成功 * @throws WxErrorException . */ boolean updatefeedpublic(Integer roomId, Integer isFeedsPublic) throws WxErrorException; /** * 开启/关闭回放功能 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/updatereplay?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param closeReplay 是否关闭回放 【0:开启,1:关闭】 * @return 是否成功 * @throws WxErrorException . */ boolean updatereplay(Integer roomId, Integer closeReplay) throws WxErrorException; /** * 开启/关闭客服功能 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/updatekf?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param closeKf 是否关闭客服 【0:开启,1:关闭】 * @return 是否成功 * @throws WxErrorException . */ boolean updatekf(Integer roomId, Integer closeKf) throws WxErrorException; /** * 开启/关闭直播间全局禁言 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/updatecomment?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param banComment 1-禁言,0-取消禁言 * @return 是否成功 * @throws WxErrorException . */ boolean updatecomment(Integer roomId, Integer banComment) throws WxErrorException; /** * 上下架商品 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/onsale?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param goodsId 商品ID * @param onSale 上下架 【0:下架,1:上架】 * @return 是否成功 * @throws WxErrorException . */ boolean onsale(Integer roomId, Integer goodsId, Integer onSale) throws WxErrorException; /** * 删除直播间商品 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/deleteInRoom?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param goodsId 商品ID * @return 是否成功 * @throws WxErrorException . */ boolean deleteInRoom(Integer roomId, Integer goodsId) throws WxErrorException; /** * 推送商品 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/push?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param goodsId 商品ID * @return 是否成功 * @throws WxErrorException . */ boolean push(Integer roomId, Integer goodsId) throws WxErrorException; /** * 直播间商品排序 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/sort?access_token=ACCESS_TOKEN * <pre> * @param roomId 房间ID * @param goods 商品ID列表, 例如: [{"goodsId":"123"}, {"goodsId":"234"}] * @return 是否成功 * @throws WxErrorException . */ boolean sort(Integer roomId, List<Map<String,String>> goods) throws WxErrorException; /** * 下载商品讲解视频 * <p> * 调用额度:10000次/一天 * <p> * http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/goods/getVideo?access_token=ACCESS_TOKEN * </pre> * @param roomId 直播间id * @param goodsId 商品ID * @return . * @throws WxErrorException . */ String getVideo(Integer roomId, Integer goodsId) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaImmediateDeliveryService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; import cn.binarywang.wx.miniapp.bean.delivery.*; import me.chanjar.weixin.common.error.WxErrorException; /** * 微信小程序即时配送服务. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/immediate-delivery/overview.html * </pre> * * @author Luo * @version 1.0 * created on 2021-10-13 16:40 */ public interface WxMaImmediateDeliveryService { /** * 拉取已绑定账号. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getBindAccount.html * </pre> * * @return 响应 * @throws WxErrorException 异常 */ BindAccountResponse getBindAccount() throws WxErrorException; /** * 下配送单接口. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.addOrder.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ AddOrderResponse addOrder(AddOrderRequest request) throws WxErrorException; /** * 拉取配送单信息. * <pre> * 商家可使用本接口查询某一配送单的配送状态,便于商家掌握配送情况。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.getOrder.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ GetOrderResponse getOrder(GetOrderRequest request) throws WxErrorException; /** * 取消配送单接口. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.cancelOrder.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ CancelOrderResponse cancelOrder(CancelOrderRequest request) throws WxErrorException; /** * 异常件退回商家商家确认收货接口. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.abnormalConfirm.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ AbnormalConfirmResponse abnormalConfirm(AbnormalConfirmRequest request) throws WxErrorException; /** * 模拟配送公司更新配送单状态, 该接口只用于沙盒环境,即订单并没有真实流转到运力方. * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/immediate-delivery/by-business/immediateDelivery.mockUpdateOrder.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ MockUpdateOrderResponse mockUpdateOrder(MockUpdateOrderRequest request) throws WxErrorException; /** * 商户使用此接口向微信提供某交易单号对应的运单号。微信后台会跟踪运单的状态变化 * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_search.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ TraceWaybillResponse traceWaybill(TraceWaybillRequest request) throws WxErrorException; /** * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_search.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ QueryWaybillTraceResponse queryWaybillTrace(QueryWaybillTraceRequest request) throws WxErrorException; /** * 传运单接口 follow_waybill 订阅微信后台会跟踪运单的状态变化 * <pre> * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ FollowWaybillResponse followWaybill(FollowWaybillRequest request) throws WxErrorException; /** * 查运单接口 query_follow_trace * * <pre> * 商户在调用完trace_waybill接口后,可以使用本接口查询到对应运单的详情信息 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/express_open_msg.html * </pre> * * @param request request * @return 响应 * @throws WxErrorException 异常 */ QueryFollowTraceResponse queryFollowTrace(QueryFollowTraceRequest request) throws WxErrorException ; /** * 获取运力id列表get_delivery_list * * <pre> * 商户使用此接口获取所有运力id的列表 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_search.html * </pre> * * @return 响应 * @throws WxErrorException 异常 */ GetDeliveryListResponse getDeliveryList() throws WxErrorException; /** * 更新物流物品信息接口 update_waybill_goods * * <pre> * 更新物品信息 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/express_search.html * </pre> * * @return 响应 * @throws WxErrorException 异常 */ WxMaBaseResponse updateWaybillGoods(UpdateWaybillGoodsRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaEmployeeRelationService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaEmployeeRelationService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.employee.WxMaSendEmployeeMsgRequest; import cn.binarywang.wx.miniapp.bean.employee.WxMaUnbindEmployeeRequest; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序用工关系相关操作接口 * <p> * 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/laboruse/intro.html">用工关系简介</a> * </p> * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2025-12-19 */ public interface WxMaEmployeeRelationService { /** * 解绑用工关系 * <p> * 企业可以调用该接口解除和用户的B2C用工关系 * </p> * 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/laboruse/api_unbinduserb2cauthinfo.html">解绑用工关系</a> * * @param request 解绑请求参数 * @throws WxErrorException 调用微信接口失败时抛出 */ void unbindEmployee(WxMaUnbindEmployeeRequest request) throws WxErrorException; /** * 推送用工消息 * <p> * 企业可以调用该接口向用户推送用工相关消息 * </p> * 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/laboruse/api_sendemployeerelationmsg.html">推送用工消息</a> * * @param request 推送消息请求参数 * @throws WxErrorException 调用微信接口失败时抛出 */ void sendEmployeeMsg(WxMaSendEmployeeMsgRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaCloudService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.cloud.*; import cn.binarywang.wx.miniapp.bean.cloud.request.WxCloudSendSmsV2Request; import com.google.gson.JsonArray; import me.chanjar.weixin.common.error.WxErrorException; import java.util.List; import java.util.Map; /** * 云开发相关接口. * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2020 -01-22 */ public interface WxMaCloudService { /** * 触发云函数。注意:HTTP API 途径触发云函数不包含用户信息。 * * @param name 云函数名称 * @param body 云函数的传入参数,具体结构由开发者定义 * @return 云函数返回的buffer * @throws WxErrorException 调用失败时抛出 */ String invokeCloudFunction(String name, String body) throws WxErrorException; /** * 触发云函数。注意:HTTP API 途径触发云函数不包含用户信息。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/functions/invokeCloudFunction.html * * @param env 云开发环境ID * @param name 云函数名称 * @param body 云函数的传入参数,具体结构由开发者定义 * @return 云函数返回的buffer * @throws WxErrorException 调用失败时抛出 */ String invokeCloudFunction(String env, String name, String body) throws WxErrorException; /** * 批量添加记录到集合。 * * @param collection 集合名称 * @param list 要添加的记录列表 * @return 插入成功的记录ID列表 * @throws WxErrorException 添加失败时抛出 */ List<String> add(String collection, List<?> list) throws WxErrorException; /** * 添加单条记录到集合。 * * @param collection 集合名称 * @param obj 要添加的记录对象 * @return 插入成功的记录ID * @throws WxErrorException 添加失败时抛出 */ String add(String collection, Object obj) throws WxErrorException; /** * 数据库插入记录。 * * @param query 数据库操作语句 * @return 插入成功的数据集合主键_id列表 * @throws WxErrorException 插入失败时抛出 */ JsonArray databaseAdd(String query) throws WxErrorException; /** * 数据库插入记录。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseAdd.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 插入成功的数据集合主键_id列表 * @throws WxErrorException 插入失败时抛出 */ JsonArray databaseAdd(String env, String query) throws WxErrorException; /** * 删除集合中符合条件的记录。 * * @param collection 集合名称 * @param whereJson 查询条件JSON字符串 * @return 删除的记录数量 * @throws WxErrorException 删除失败时抛出 */ Integer delete(String collection, String whereJson) throws WxErrorException; /** * 数据库删除记录。 * * @param query 数据库操作语句 * @return 删除记录数量 * @throws WxErrorException 删除失败时抛出 */ int databaseDelete(String query) throws WxErrorException; /** * 数据库删除记录。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseDelete.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 删除记录数量 * @throws WxErrorException 删除失败时抛出 */ int databaseDelete(String env, String query) throws WxErrorException; /** * 更新集合中符合条件的记录。 * * @param collection 集合名称 * @param whereJson 查询条件JSON字符串 * @param updateJson 更新内容JSON字符串 * @return 更新结果对象 * @throws WxErrorException 更新失败时抛出 */ WxCloudDatabaseUpdateResult update(String collection, String whereJson, String updateJson) throws WxErrorException; /** * 数据库更新记录。 * * @param query 数据库操作语句 * @return 更新结果对象 * @throws WxErrorException 更新失败时抛出 */ WxCloudDatabaseUpdateResult databaseUpdate(String query) throws WxErrorException; /** * 数据库更新记录。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseUpdate.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 更新结果对象 * @throws WxErrorException 更新失败时抛出 */ WxCloudDatabaseUpdateResult databaseUpdate(String env, String query) throws WxErrorException; /** * 查询集合中的记录。 * 示例: * db.collection('geo') * .where({price: _.gt(10)}) * .orderBy('_id', 'asc') * .orderBy('price', 'desc') * .skip(1) * .limit(10) * .get() * * @param collection 集合名称 * @param whereJson 查询条件JSON字符串 * @param orderBy 排序条件Map * @param skip 跳过记录数 * @param limit 限制返回记录数 * @return 查询结果对象 * @throws WxErrorException 查询失败时抛出 */ WxCloudDatabaseQueryResult query(String collection, String whereJson, Map<String, String> orderBy, Integer skip, Integer limit) throws WxErrorException; /** * 数据库查询记录。 * * @param query 数据库操作语句 * @return 查询结果对象 * @throws WxErrorException 查询失败时抛出 */ WxCloudDatabaseQueryResult databaseQuery(String query) throws WxErrorException; /** * 数据库查询记录。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseQuery.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 查询结果对象 * @throws WxErrorException 查询失败时抛出 */ WxCloudDatabaseQueryResult databaseQuery(String env, String query) throws WxErrorException; /** * 数据库聚合记录。 * * @param query 数据库操作语句 * @return 聚合结果JSON数组 * @throws WxErrorException 聚合失败时抛出 */ JsonArray databaseAggregate(String query) throws WxErrorException; /** * 数据库聚合记录。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseAggregate.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 聚合结果JSON数组 * @throws WxErrorException 聚合失败时抛出 */ JsonArray databaseAggregate(String env, String query) throws WxErrorException; /** * 统计集合中符合条件的记录数。 * * @param collection 集合名称 * @param whereJson 查询条件JSON字符串 * @return 记录数量 * @throws WxErrorException 统计失败时抛出 */ Long count(String collection, String whereJson) throws WxErrorException; /** * 统计集合记录数或统计查询语句对应的结果记录数。 * * @param query 数据库操作语句 * @return 记录数量 * @throws WxErrorException 统计失败时抛出 */ Long databaseCount(String query) throws WxErrorException; /** * 统计集合记录数或统计查询语句对应的结果记录数。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseCount.html * * @param env 云环境ID * @param query 数据库操作语句 * @return 记录数量 * @throws WxErrorException 统计失败时抛出 */ Long databaseCount(String env, String query) throws WxErrorException; /** * 变更数据库索引。 * * @param collectionName 集合名称 * @param createIndexes 新增索引对象列表 * @param dropIndexNames 要删除的索引名称列表 * @throws WxErrorException 更新失败时抛出 */ void updateIndex(String collectionName, List<WxCloudDatabaseCreateIndexRequest> createIndexes, List<String> dropIndexNames) throws WxErrorException; /** * 变更数据库索引。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/updateIndex.html * * @param env 云环境ID * @param collectionName 集合名称 * @param createIndexes 新增索引对象列表 * @param dropIndexNames 要删除的索引名称列表 * @throws WxErrorException 更新失败时抛出 */ void updateIndex(String env, String collectionName, List<WxCloudDatabaseCreateIndexRequest> createIndexes, List<String> dropIndexNames) throws WxErrorException; /** * 数据库导入。 * * @param collectionName 导入collection名 * @param filePath 导入文件路径 * @param fileType 导入文件类型,1:JSON,2:CSV * @param stopOnError 是否在遇到错误时停止导入 * @param conflictMode 冲突处理模式,1:INSERT,2:UPSERT * @return 任务ID * @throws WxErrorException 导入失败时抛出 */ Long databaseMigrateImport(String collectionName, String filePath, int fileType, boolean stopOnError, int conflictMode) throws WxErrorException; /** * 数据库导入。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseMigrateImport.html * 注意:导入文件需先上传到同环境的存储中,可使用开发者工具或HTTP API的上传文件API上传 * * @param env 云环境ID * @param collectionName 导入collection名 * @param filePath 导入文件路径 * @param fileType 导入文件类型,1:JSON,2:CSV * @param stopOnError 是否在遇到错误时停止导入 * @param conflictMode 冲突处理模式,1:INSERT,2:UPSERT * @return 任务ID * @throws WxErrorException 导入失败时抛出 */ Long databaseMigrateImport(String env, String collectionName, String filePath, int fileType, boolean stopOnError, int conflictMode) throws WxErrorException; /** * 数据库导出。 * * @param filePath 导出文件路径 * @param fileType 导出文件类型,1:JSON,2:CSV * @param query 导出条件 * @return 任务ID * @throws WxErrorException 导出失败时抛出 */ Long databaseMigrateExport(String filePath, int fileType, String query) throws WxErrorException; /** * 数据库导出。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseMigrateExport.html * 注意:文件会导出到同环境的云存储中,可使用获取下载链接API获取下载链接 * * @param env 云环境ID * @param filePath 导出文件路径 * @param fileType 导出文件类型,1:JSON,2:CSV * @param query 导出条件 * @return 任务ID * @throws WxErrorException 导出失败时抛出 */ Long databaseMigrateExport(String env, String filePath, int fileType, String query) throws WxErrorException; /** * 数据库迁移状态查询。 * * @param jobId 迁移任务ID * @return 迁移状态查询结果 * @throws WxErrorException 查询失败时抛出 */ WxCloudCloudDatabaseMigrateQueryInfoResult databaseMigrateQueryInfo(Long jobId) throws WxErrorException; /** * 数据库迁移状态查询。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseMigrateQueryInfo.html * * @param env 云环境ID * @param jobId 迁移任务ID * @return 迁移状态查询结果 * @throws WxErrorException 查询失败时抛出 */ WxCloudCloudDatabaseMigrateQueryInfoResult databaseMigrateQueryInfo(String env, Long jobId) throws WxErrorException; /** * 获取文件上传链接。 * * @param path 上传路径 * @return 上传结果对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudUploadFileResult uploadFile(String path) throws WxErrorException; /** * 获取文件上传链接。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/storage/uploadFile.html * * @param env 云环境ID * @param path 上传路径 * @return 上传结果对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudUploadFileResult uploadFile(String env, String path) throws WxErrorException; /** * 获取文件下载链接。 * * @param fileIds 文件ID数组 * @param maxAges 下载链接有效期数组,对应文件id列表 * @return 下载链接信息对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudBatchDownloadFileResult batchDownloadFile(String[] fileIds, long[] maxAges) throws WxErrorException; /** * 获取文件下载链接。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/storage/batchDownloadFile.html * * @param env 云环境ID * @param fileIds 文件ID数组 * @param maxAges 下载链接有效期数组,对应文件id列表 * @return 下载链接信息对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudBatchDownloadFileResult batchDownloadFile(String env, String[] fileIds, long[] maxAges) throws WxErrorException; /** * 删除文件。 * * @param fileIds 文件ID数组 * @return 删除结果对象 * @throws WxErrorException 删除失败时抛出 */ WxCloudBatchDeleteFileResult batchDeleteFile(String[] fileIds) throws WxErrorException; /** * 删除文件。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/storage/batchDeleteFile.html * * @param env 云环境ID * @param fileIds 文件ID数组 * @return 删除结果对象 * @throws WxErrorException 删除失败时抛出 */ WxCloudBatchDeleteFileResult batchDeleteFile(String env, String[] fileIds) throws WxErrorException; /** * 获取腾讯云API调用凭证。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/utils/getQcloudToken.html * * @param lifeSpan 有效期(单位为秒,最大7200) * @return 腾讯云Token结果对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudGetQcloudTokenResult getQcloudToken(long lifeSpan) throws WxErrorException; /** * 新增集合。 * * @param collectionName 集合名称 * @throws WxErrorException 新增失败时抛出 */ void databaseCollectionAdd(String collectionName) throws WxErrorException; /** * 新增集合。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseCollectionAdd.html * * @param env 云环境ID * @param collectionName 集合名称 * @throws WxErrorException 新增失败时抛出 */ void databaseCollectionAdd(String env, String collectionName) throws WxErrorException; /** * 删除集合。 * * @param collectionName 集合名称 * @throws WxErrorException 删除失败时抛出 */ void databaseCollectionDelete(String collectionName) throws WxErrorException; /** * 删除集合。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseCollectionDelete.html * * @param env 云环境ID * @param collectionName 集合名称 * @throws WxErrorException 删除失败时抛出 */ void databaseCollectionDelete(String env, String collectionName) throws WxErrorException; /** * 获取特定云环境下集合信息。 * * @param limit 获取数量限制,默认值:10 * @param offset 偏移量,默认值:0 * @return 集合信息获取结果对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudDatabaseCollectionGetResult databaseCollectionGet(Long limit, Long offset) throws WxErrorException; /** * 获取特定云环境下集合信息。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-http-api/database/databaseCollectionGet.html * * @param env 云环境ID * @param limit 获取数量限制,默认值:10 * @param offset 偏移量,默认值:0 * @return 集合信息获取结果对象 * @throws WxErrorException 获取失败时抛出 */ WxCloudDatabaseCollectionGetResult databaseCollectionGet(String env, Long limit, Long offset) throws WxErrorException; /** * 发送携带 URL Link 的短信。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/cloudbase/cloudbase.sendSmsV2.html * * @param request 短信发送请求对象 * @return 短信发送结果对象 * @throws WxErrorException 发送失败时抛出 */ WxCloudSendSmsV2Result sendSmsV2(WxCloudSendSmsV2Request request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOpenApiService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOpenApiService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.openapi.WxMiniGetApiQuotaResult; import cn.binarywang.wx.miniapp.bean.openapi.WxMiniGetRidInfoResult; import me.chanjar.weixin.common.error.WxErrorException; /** * openApi管理 * * @author shuiyihan12 * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/clearQuota.html">openApi管理 微信文档</a> * @since 2023/7/7 17:07 */ public interface WxMaOpenApiService { /** * 本接口用于清空公众号/小程序/第三方平台等接口的每日调用接口次数 * * @return 是否成功 * @throws WxErrorException the wx error exception * @apiNote !!! 单小程序直接调用该方法 , 如多个appid调用此方法前请调用 {@link WxMaService#switchoverTo} 切换appid !!! * @code wxMaService.getWxMaOpenApiService().clearQuota() //单个 * @code wxMaService.switchoverTo(" appid ").getWxMaOpenApiService().clearQuota() //多个 * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/clearQuota.html">注意事项参考微信文档</a> */ boolean clearQuota() throws WxErrorException; /** * 查询API调用额度 * * @param cgiPath api的请求地址, * 例如"/cgi-bin/message/custom/send";不要前缀“https://api.weixin.qq.com” ,也不要漏了"/",否则都会76003的报错; * @return 额度详情 * @throws WxErrorException 微信异常 * @apiNote "/xxx/sns/xxx" 这类接口不支持使用该接口,会出现76022报错。 * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/getApiQuota.html">注意事项参考微信文档</a> */ WxMiniGetApiQuotaResult getApiQuota(String cgiPath) throws WxErrorException; /** * 查询rid信息 * * @param rid 调用接口报错返回的rid * @return 该rid对应的请求详情 * @throws WxErrorException 微信异常 * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/getRidInfo.html">注意事项参考微信文档</a> */ WxMiniGetRidInfoResult getRidInfo(String rid) throws WxErrorException; /** * 使用AppSecret重置 API 调用次数 * * @return 是否成功 * @throws WxErrorException 微信异常 * @apiNote !!! 单小程序直接调用该方法 , 如多个appid调用此方法前请调用 {@link WxMaService#switchoverTo} 切换appid!!! * 参考示例 * @code wxMaService.getWxMaOpenApiService().clearQuotaByAppSecret() //单个 * @code wxMaService.switchoverTo(" appid ").getWxMaOpenApiService().clearQuotaByAppSecret() //多个 * @see <a href="https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/openApi-mgnt/clearQuotaByAppSecret.html">注意事项参考微信文档</a> */ boolean clearQuotaByAppSecret() throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaInternetService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaInternetService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.internet.WxMaInternetResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * <pre> * 【小程序-服务端-网络】网络相关接口. * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/internet/internet.getUserEncryptKey.html * </pre> * * @author <a href="https://github.com/chutian0124">chutian0124</a> */ public interface WxMaInternetService { /** * <pre> * 获取用户encryptKey。 会获取用户最近3次的key,每个key的存活时间为3600s。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/internet/internet.getUserEncryptKey.html * 接口地址:POST https://api.weixin.qq.com/wxa/business/getuserencryptkey?access_token=ACCESS_TOKEN&openid=OPENID&signature=SIGNATURE&sig_method=hmac_sha256 * @param openid 用户的openid * @param signature 用sessionkey对空字符串签名得到的结果 * @param sigMethod 签名方法,只支持 hmac_sha256 * </pre> * * @return {@link WxMaInternetResponse} * @throws WxErrorException * @apiNote 推荐使用 {@link #getUserEncryptKey(java.lang.String, java.lang.String)} */ @Deprecated WxMaInternetResponse getUserEncryptKey(String openid, String signature, String sigMethod) throws WxErrorException; /** * <pre> * 获取用户encryptKey。 * @implNote 会获取用户最近3次的key,每个key的存活时间为3600s。 * 文档地址:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/internet/internet.getUserEncryptKey.html * 接口地址:POST https://api.weixin.qq.com/wxa/business/getuserencryptkey?access_token=ACCESS_TOKEN&openid=OPENID&signature=SIGNATURE&sig_method=hmac_sha256 * @param openid 用户的openid * @param sessionKey 用户的sessionKey * </pre> * * @return {@link WxMaInternetResponse} * @throws WxErrorException */ WxMaInternetResponse getUserEncryptKey(String openid, String sessionKey) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLiveMemberService.java
package cn.binarywang.wx.miniapp.api; import com.google.gson.JsonArray; import me.chanjar.weixin.common.error.WxErrorException; /** * 【小程序直播】成员管理接口. * https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/role-manage.html * * @author <a href="https://github.com/binarywang">Binary Wang</a> * created on 2021 -02-15 */ public interface WxMaLiveMemberService { /** * 1.设置成员角色 * 调用此接口设置小程序直播成员的管理员、运营者和主播角色 * 调用额度:10000次/一天 * 请求URL : https://api.weixin.qq.com/wxaapi/broadcast/role/addrole?access_token= * * @param username 用户的微信号 * @param role 设置用户的角色,取值[1-管理员,2-主播,3-运营者],设置超级管理员将无效 * @return the string * @throws WxErrorException the wx error exception */ String addRole(String username, int role) throws WxErrorException; /** * 2.解除成员角色 * 调用此接口移除小程序直播成员的管理员、运营者和主播角色 * 调用额度:10000次/一天 * 请求URL:https://api.weixin.qq.com/wxaapi/broadcast/role/deleterole?access_token= * * @param username 用户的微信号 * @param role 设置用户的角色,取值[1-管理员,2-主播,3-运营者],设置超级管理员将无效 * @return the string * @throws WxErrorException the wx error exception */ String deleteRole(String username, int role) throws WxErrorException; /** * 3.查询成员列表 * 调用此接口查询小程序直播成员列表 * 调用额度:10000次/一天 * 请求URL:https://api.weixin.qq.com/wxaapi/broadcast/role/getrolelist?access_token= * * @param role 查询的用户角色,取值 [-1-所有成员, 0-超级管理员,1-管理员,2-主播,3-运营者],默认-1 * @param offset 起始偏移量, 默认0 * @param limit 查询个数,最大30,默认10 * @param keyword 搜索的微信号或昵称,不传则返回全部 * @return . json array * @throws WxErrorException the wx error exception */ JsonArray listByRole(Integer role, Integer offset, Integer limit, String keyword) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaXPayService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaXPayService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse; import cn.binarywang.wx.miniapp.bean.xpay.*; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序虚拟支付相关接口。 * 文档:https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html * */ public interface WxMaXPayService { /** * 查询用户虚拟币余额。 * * @param request 查询用户余额请求对象 * @param sigParams 签名参数对象 * @return 用户余额查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryUserBalanceResponse queryUserBalance(WxMaXPayQueryUserBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 虚拟币充值下单。 * * @param request 虚拟币充值请求对象 * @param sigParams 签名参数对象 * @return 虚拟币充值结果 * @throws WxErrorException 充值失败时抛出 */ WxMaXPayCurrencyPayResponse currencyPay(WxMaXPayCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询订单信息。 * * @param request 查询订单请求对象 * @param sigParams 签名参数对象 * @return 订单查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryOrderResponse queryOrder(WxMaXPayQueryOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 取消虚拟币充值订单。 * * @param request 取消充值订单请求对象 * @param sigParams 签名参数对象 * @return 取消充值订单结果 * @throws WxErrorException 取消失败时抛出 */ WxMaXPayCancelCurrencyPayResponse cancelCurrencyPay(WxMaXPayCancelCurrencyPayRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 通知发货。 * * @param request 通知发货请求对象 * @param sigParams 签名参数对象 * @return 通知发货是否成功 * @throws WxErrorException 通知失败时抛出 */ boolean notifyProvideGoods(WxMaXPayNotifyProvideGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 赠送虚拟币。 * * @param request 赠送虚拟币请求对象 * @param sigParams 签名参数对象 * @return 赠送虚拟币结果 * @throws WxErrorException 赠送失败时抛出 */ WxMaXPayPresentCurrencyResponse presentCurrency(WxMaXPayPresentCurrencyRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 道具直购。 * * @param request 道具直购请求对象 * @param sigParams 签名参数对象 * @return 道具直购结果 * @throws WxErrorException 直购失败时抛出 */ WxMaXPayPresentGoodsResponse presentGoods(WxMaXPayPresentGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 下载对账单。 * * @param request 下载对账单请求对象 * @param sigParams 签名参数对象 * @return 对账单下载结果 * @throws WxErrorException 下载失败时抛出 */ WxMaXPayDownloadBillResponse downloadBill(WxMaXPayDownloadBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 退款申请。 * * @param request 退款申请请求对象 * @param sigParams 签名参数对象 * @return 退款申请结果 * @throws WxErrorException 退款失败时抛出 */ WxMaXPayRefundOrderResponse refundOrder(WxMaXPayRefundOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 创建提现订单。 * * @param request 创建提现订单请求对象 * @param sigParams 签名参数对象 * @return 创建提现订单结果 * @throws WxErrorException 创建失败时抛出 */ WxMaXPayCreateWithdrawOrderResponse createWithdrawOrder(WxMaXPayCreateWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询提现订单。 * * @param request 查询提现订单请求对象 * @param sigParams 签名参数对象 * @return 提现订单查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryWithdrawOrderResponse queryWithdrawOrder(WxMaXPayQueryWithdrawOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 启动道具上传。 * * @param request 启动道具上传请求对象 * @param sigParams 签名参数对象 * @return 启动道具上传是否成功 * @throws WxErrorException 启动失败时抛出 */ boolean startUploadGoods(WxMaXPayStartUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询道具上传状态。 * * @param request 查询道具上传状态请求对象 * @param sigParams 签名参数对象 * @return 道具上传状态查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryUploadGoodsResponse queryUploadGoods(WxMaXPayQueryUploadGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 启动道具发布。 * * @param request 启动道具发布请求对象 * @param sigParams 签名参数对象 * @return 启动道具发布是否成功 * @throws WxErrorException 启动失败时抛出 */ boolean startPublishGoods(WxMaXPayStartPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询道具发布状态。 * * @param request 查询道具发布状态请求对象 * @param sigParams 签名参数对象 * @return 道具发布状态查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询商家账户里的可提现余额。 * * @param request 查询商家账户里的可提现余额请求对象 * @param sigParams 签名参数对象 * @return 商家账户里的可提现余额查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryBizBalanceResponse queryBizBalance(WxMaXPayQueryBizBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询广告金充值账户。 * * @param request 查询广告金充值账户请求对象 * @param sigParams 签名参数对象 * @return 广告金充值账户查询结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryTransferAccountResponse queryTransferAccount(WxMaXPayQueryTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询广告金发放记录。 * * @param request 查询广告金发放记录请求对象 * @param sigParams 签名参数对象 * @return 查询广告金发放记录结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryAdverFundsResponse queryAdverFunds(WxMaXPayQueryAdverFundsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 充值广告金。 * * @param request 充值广告金请求对象 * @param sigParams 签名参数对象 * @return 充值广告金结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayCreateFundsBillResponse createFundsBill(WxMaXPayCreateFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 绑定广告金充值账户。 * * @param request 绑定广告金充值账户请求对象 * @param sigParams 签名参数对象 * @return 绑定广告金充值账户结果 * @throws WxErrorException 查询失败时抛出 */ WxMaBaseResponse bindTransferAccount(WxMaXPayBindTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询广告金充值记录。 * * @param request 查询广告金充值记录请求对象 * @param sigParams 签名参数对象 * @return 查询广告金充值记录结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryFundsBillResponse queryFundsBill(WxMaXPayQueryFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 查询广告金回收记录。 * * @param request 查询广告金回收记录请求对象 * @param sigParams 签名参数对象 * @return 查询广告金回收记录结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayQueryRecoverBillResponse queryRecoverBill(WxMaXPayQueryRecoverBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 获取投诉列表。 * * @param request 获取投诉列表请求对象 * @param sigParams 签名参数对象 * @return 获取投诉列表结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayGetComplaintListResponse getComplaintList(WxMaXPayGetComplaintListRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 获取投诉详情。 * * @param request 获取投诉详情请求对象 * @param sigParams 签名参数对象 * @return 获取投诉详情结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayGetComplaintDetailResponse getComplaintDetail(WxMaXPayGetComplaintDetailRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 获取协商历史。 * * @param request 获取协商历史请求对象 * @param sigParams 签名参数对象 * @return 获取协商历史结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayGetNegotiationHistoryResponse getNegotiationHistory(WxMaXPayGetNegotiationHistoryRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 回复用户。 * * @param request 回复用户请求对象 * @param sigParams 签名参数对象 * @return 回复用户结果 * @throws WxErrorException 查询失败时抛出 */ WxMaBaseResponse responseComplaint(WxMaXPayResponseComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 完成投诉处理。 * * @param request 完成投诉处理请求对象 * @param sigParams 签名参数对象 * @return 完成投诉处理结果 * @throws WxErrorException 查询失败时抛出 */ WxMaBaseResponse completeComplaint(WxMaXPayCompleteComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 上传媒体文件(如图片,凭证等)。 * * @param request 上传媒体文件(如图片,凭证等)请求对象 * @param sigParams 签名参数对象 * @return 上传媒体文件(如图片,凭证等)结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayUploadVpFileResponse uploadVpFile(WxMaXPayUploadVpFileRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 获取微信支付反馈投诉图片的签名头部。 * * @param request 获取微信支付反馈投诉图片的签名头部请求对象 * @param sigParams 签名参数对象 * @return 获取微信支付反馈投诉图片的签名头部结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayGetUploadFileSignResponse getUploadFileSign(WxMaXPayGetUploadFileSignRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; /** * 下载广告金对应的商户订单信息。 * * @param request 下载广告金对应的商户订单信息请求对象 * @param sigParams 签名参数对象 * @return 下载广告金对应的商户订单信息结果 * @throws WxErrorException 查询失败时抛出 */ WxMaXPayDownloadAdverfundsOrderResponse downloadAdverfundsOrder(WxMaXPayDownloadAdverfundsOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLinkService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaLinkService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shortlink.GenerateShortLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.GenerateUrlLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.request.QueryUrlLinkRequest; import cn.binarywang.wx.miniapp.bean.urllink.response.QueryUrlLinkResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * @author <a href="https://github.com/mr-xiaoyu">xiaoyu</a> * @since 2021-06-10 */ public interface WxMaLinkService { /** * 获取小程序 URL Link接口 * 接口文档: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-link/urllink.generate.html * * @param request 请求 * @return link地址 * @throws WxErrorException . */ String generateUrlLink(GenerateUrlLinkRequest request) throws WxErrorException; /** * 获取小程序 Short Link接口 * 接口文档: https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/short-link/shortlink.generate.html * * @param request 请求 * @return link地址 * @throws WxErrorException . */ String generateShortLink(GenerateShortLinkRequest request) throws WxErrorException; /** * 查询 URL Link * 接口文档: https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/url-link/queryUrlLink.html * * @param request 请求 * @return link地址 * @throws WxErrorException . */ QueryUrlLinkResponse queryUrlLink(QueryUrlLinkRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopRegisterService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopRegisterService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopRegisterApplySceneRequest; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopRegisterFinishAccessInfoRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopRegisterCheckResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序交易组件-申请接入服务 * * @author liming1019 */ public interface WxMaShopRegisterService { /** * 接入申请 * * @return WxMaShopBaseResponse * @throws WxErrorException */ WxMaShopBaseResponse registerApply() throws WxErrorException; /** * 获取接入状态 * * @return WxMaShopRegisterCheckResponse * @throws WxErrorException */ WxMaShopRegisterCheckResponse registerCheck() throws WxErrorException; /** * 完成接入任务 * * @return WxMaShopBaseResponse * @throws WxErrorException */ WxMaShopBaseResponse registerFinishAccessInfo(WxMaShopRegisterFinishAccessInfoRequest request) throws WxErrorException; /** * 场景接入申请 * * @return WxMaShopBaseResponse * @throws WxErrorException */ WxMaShopBaseResponse registerApplyScene(WxMaShopRegisterApplySceneRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaJsapiService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaJsapiService.java
package cn.binarywang.wx.miniapp.api; import me.chanjar.weixin.common.bean.WxJsapiSignature; import me.chanjar.weixin.common.error.WxErrorException; /** * <pre> * jsapi相关接口 * Created by BinaryWang on 2018/8/5. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public interface WxMaJsapiService { /** * 获得卡券api_ticket,不强制刷新api_ticket * * @return the card api ticket * @throws WxErrorException the wx error exception * @see #getJsapiTicket(boolean) #getJsapiTicket(boolean) */ String getCardApiTicket() throws WxErrorException; /** * <pre> * 获得卡券api_ticket * 获得时会检查apiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 * * 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN * </pre> * * @param forceRefresh 强制刷新 * @return the card api ticket * @throws WxErrorException the wx error exception */ String getCardApiTicket(boolean forceRefresh) throws WxErrorException; /** * 获得jsapi_ticket,不强制刷新jsapi_ticket * * @return the jsapi ticket * @throws WxErrorException the wx error exception * @see #getJsapiTicket(boolean) #getJsapiTicket(boolean) */ String getJsapiTicket() throws WxErrorException; /** * <pre> * 获得jsapi_ticket * 获得时会检查jsapiToken是否过期,如果过期了,那么就刷新一下,否则就什么都不干 * * 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN * </pre> * * @param forceRefresh 强制刷新 * @return the jsapi ticket * @throws WxErrorException the wx error exception */ String getJsapiTicket(boolean forceRefresh) throws WxErrorException; /** * <pre> * 创建调用jsapi时所需要的签名 * * 详情请见:http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115&token=&lang=zh_CN * </pre> * * @param url the url * @return the wx jsapi signature * @throws WxErrorException the wx error exception */ WxJsapiSignature createJsapiSignature(String url) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaPluginService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaPluginService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaPluginListResult; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序插件管理 API * <p> * 详情请见:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/plugin-management/pluginManager.applyPlugin.html * 或者:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/Plug-ins_Management.html * * @author ArBing */ public interface WxMaPluginService { /** * 向插件开发者发起使用插件的申请 * * @param pluginAppId 插件 appId * @param reason 申请使用理由 * @throws WxErrorException 异常 */ void applyPlugin(String pluginAppId, String reason) throws WxErrorException; /** * 查询已添加的插件 * * @return plugin list * @throws WxErrorException the wx error exception */ WxMaPluginListResult getPluginList() throws WxErrorException; /** * 删除已添加的插件 * * @param pluginAppId 插件 appId * @throws WxErrorException the wx error exception */ void unbindPlugin(String pluginAppId) throws WxErrorException; /** * 快速更新插件版本号(第三方平台代小程序管理插件) * * @param pluginAppId 插件 appid * @param userVersion 升级至版本号,要求此插件版本支持快速更新 * @throws WxErrorException the wx error exception */ void updatePlugin(String pluginAppId, String userVersion) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAccountService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopAccountService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopAccountUpdateInfoRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAccountGetBrandListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAccountGetCategoryListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAccountGetInfoResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序交易组件-商家入驻接口 * * @author liming1019 */ public interface WxMaShopAccountService { /** * 获取商家类目列表 * * @return WxMaShopAccountGetCategoryListResponse * @throws WxErrorException */ WxMaShopAccountGetCategoryListResponse getCategoryList() throws WxErrorException; /** * 获取商家品牌列表 * * @return WxMaShopAccountGetBrandListResponse * @throws WxErrorException */ WxMaShopAccountGetBrandListResponse getBrandList() throws WxErrorException; /** * 更新商家信息 * * @param request * @return WxMaShopBaseResponse * @throws WxErrorException */ WxMaShopBaseResponse updateInfo(WxMaShopAccountUpdateInfoRequest request) throws WxErrorException; /** * 获取商家信息 * * @return WxMaShopAccountGetInfoResponse * @throws WxErrorException */ WxMaShopAccountGetInfoResponse getInfo() throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaAnalysisService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaAnalysisService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.analysis.*; import me.chanjar.weixin.common.error.WxErrorException; import java.util.Date; import java.util.List; /** * 小程序数据分析相关接口。 * 文档:https://mp.weixin.qq.com/debug/wxadoc/dev/api/analysis.html * * @author <a href="https://github.com/charmingoh">Charming</a> * @since 2018-04-28 */ public interface WxMaAnalysisService { /** * 查询概况趋势。 * 温馨提示:小程序接口目前只能查询一天的数据,即 beginDate 和 endDate 一样 * * @param beginDate 开始日期 * @param endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日 * @return 概况趋势列表 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ List<WxMaSummaryTrend> getDailySummaryTrend(Date beginDate, Date endDate) throws WxErrorException; /** * 获取日访问趋势。 * 温馨提示:小程序接口目前只能查询一天的数据,即 beginDate 和 endDate 一样 * * @param beginDate 开始日期 * @param endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日 * @return 日访问趋势列表 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ List<WxMaVisitTrend> getDailyVisitTrend(Date beginDate, Date endDate) throws WxErrorException; /** * 获取周访问趋势。 * 限定查询一个自然周的数据,时间必须按照自然周的方式输入: 如:20170306(周一), 20170312(周日) * * @param beginDate 开始日期,为周一日期 * @param endDate 结束日期,为周日日期,限定查询一周数据 * @return 周访问趋势列表(每项数据都是一个自然周汇总) * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ List<WxMaVisitTrend> getWeeklyVisitTrend(Date beginDate, Date endDate) throws WxErrorException; /** * 获取月访问趋势。 * 限定查询一个自然月的数据,时间必须按照自然月的方式输入: 如:20170201(月初), 20170228(月末) * * @param beginDate 开始日期,为自然月第一天 * @param endDate 结束日期,为自然月最后一天,限定查询一个月数据 * @return 月访问趋势列表(每项数据都是一个自然月汇总) * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ List<WxMaVisitTrend> getMonthlyVisitTrend(Date beginDate, Date endDate) throws WxErrorException; /** * 获取访问分布。 * (此接口目前只能查询一天的数据,即 beginDate 和 endDate 一样) * * @param beginDate 开始日期 * @param endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日 * @return 访问分布对象 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ WxMaVisitDistribution getVisitDistribution(Date beginDate, Date endDate) throws WxErrorException; /** * 获取日留存数据。 * (此接口目前只能查询一天的数据,即 beginDate 和 endDate 一样) * * @param beginDate 开始日期 * @param endDate 结束日期,限定查询 1 天数据,endDate 允许设置的最大值为昨日 * @return 日留存信息对象 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ WxMaRetainInfo getDailyRetainInfo(Date beginDate, Date endDate) throws WxErrorException; /** * 获取周留存数据。 * 限定查询一个自然周的数据,时间必须按照自然周的方式输入: 如:20170306(周一), 20170312(周日) * * @param beginDate 开始日期,为周一日期 * @param endDate 结束日期,为周日日期,限定查询一周数据 * @return 周留存信息对象 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ WxMaRetainInfo getWeeklyRetainInfo(Date beginDate, Date endDate) throws WxErrorException; /** * 获取月留存数据。 * 限定查询一个自然月的数据,时间必须按照自然月的方式输入: 如:20170201(月初), 20170228(月末) * * @param beginDate 开始日期,为自然月第一天 * @param endDate 结束日期,为自然月最后一天,限定查询一个月数据 * @return 月留存信息对象 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ WxMaRetainInfo getMonthlyRetainInfo(Date beginDate, Date endDate) throws WxErrorException; /** * 获取访问页面数据。 * 温馨提示:此接口目前只能查询一天的数据,即 beginDate 和 endDate 一样 * * @param beginDate 开始日期 * @param endDate 结束日期,限定查询1天数据,end_date允许设置的最大值为昨日 * @return 访问页面数据列表 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ List<WxMaVisitPage> getVisitPage(Date beginDate, Date endDate) throws WxErrorException; /** * 获取小程序新增或活跃用户的画像分布数据。 * 时间范围支持昨天、最近7天、最近30天。 * 其中,新增用户数为时间范围内首次访问小程序的去重用户数, * 活跃用户数为时间范围内访问过小程序的去重用户数。 * 画像属性包括用户年龄、性别、省份、城市、终端类型、机型。 * * @param beginDate 开始日期 * @param endDate 结束日期,开始日期与结束日期相差的天数限定为0/6/29,分别表示查询最近1/7/30天数据,end_date允许设置的最大值为昨日 * @return 小程序新增或活跃用户的画像分布数据对象 * @throws WxErrorException 获取失败时抛出,具体错误码请看文档 */ WxMaUserPortrait getUserPortrait(Date beginDate, Date endDate) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderShippingService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.request.shipping.*; import cn.binarywang.wx.miniapp.bean.shop.response.*; import me.chanjar.weixin.common.error.WxErrorException; /** * @author xzh * created on 2023/5/17 16:49 */ public interface WxMaOrderShippingService { /** * 查询小程序是否已开通发货信息管理服务 * * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingIsTradeManagedResponse isTradeManaged(String appId) throws WxErrorException; /** * 发货信息录入接口 * * @param request 请求 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingInfoBaseResponse upload(WxMaOrderShippingInfoUploadRequest request) throws WxErrorException; /** * 发货信息合单录入接口 * * @param request 请求 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingInfoBaseResponse upload(WxMaOrderCombinedShippingInfoUploadRequest request) throws WxErrorException; /** * 查询订单发货状态 * 你可以通过交易单号或商户号+商户单号来查询该支付单的发货状态。 * * @param request 请求 * @return WxMaOrderShippingInfoGetResponse * @throws WxErrorException e */ WxMaOrderShippingInfoGetResponse get(WxMaOrderShippingInfoGetRequest request) throws WxErrorException; /** * 查询订单列表 * 你可以通过支付时间、支付者openid或订单状态来查询订单列表。 * * @param request 请求 * @return WxMaOrderShippingInfoGetListResponse * @throws WxErrorException e */ WxMaOrderShippingInfoGetListResponse getList(WxMaOrderShippingInfoGetListRequest request) throws WxErrorException; /** * 确认收货提醒接口 * 如你已经从你的快递物流服务方获知到用户已经签收相关商品,可以通过该接口提醒用户及时确认收货,以提高资金结算效率,每个订单仅可调用一次。 * * @param request 请求 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingInfoBaseResponse notifyConfirmReceive(WxMaOrderShippingInfoNotifyConfirmRequest request) throws WxErrorException; /** * 消息跳转路径设置接口 * 如你已经在小程序内接入平台提供的确认收货组件,可以通过该接口设置发货消息及确认收货消息的跳转动作,用户点击发货消息时会直接进入你的小程序订单列表页面或详情页面进行确认收货,进一步优化用户体验。 * * @param path 商户自定义跳转路径 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingInfoBaseResponse setMsgJumpPath(String path) throws WxErrorException; /** * 查询小程序是否已完成交易结算管理确认 * * @param appId 待查询小程序的 appid,非服务商调用时仅能查询本账号 * @return WxMaOrderShippingITMCCompletedResult * @throws WxErrorException e */ WxMaOrderShippingITMCCompletedResult isTradeManagementConfirmationCompleted(String appId) throws WxErrorException; /** * 特殊发货报备 * @param orderId 需要特殊发货报备的订单号,可传入微信支付单号或商户单号 * @param type 特殊发货报备类型,1为预售商品订单,2为测试订单 * @param delayTo 预计发货时间的unix时间戳,type为1时必填,type为2可省略 * @return WxMaOrderShippingInfoBaseResponse * @throws WxErrorException e */ WxMaOrderShippingInfoBaseResponse opSpecialOrder(String orderId, Integer type, Long delayTo) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaPromotionService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaPromotionService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.promoter.request.*; import cn.binarywang.wx.miniapp.bean.promoter.response.*; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序推广员 * * @author zhuangzibin */ public interface WxMaPromotionService { /** * 管理角色接口-新增角色 * * @param request 请求参数 * @return WxMaPromotionAddRoleResponse */ WxMaPromotionAddRoleResponse addRole(WxMaPromotionAddRoleRequest request) throws WxErrorException; /** * 管理角色接口-查询角色 * * @param request 请求参数 * @return WxMaPromotionGetRoleResponse */ WxMaPromotionGetRoleResponse getRole(WxMaPromotionGetRoleRequest request) throws WxErrorException; /** * 管理角色接口-修改角色 * * @param request 请求参数 * @return WxMaPromotionUpdateRoleResponse */ WxMaPromotionUpdateRoleResponse updateRole(WxMaPromoterUpdateRoleRequest request) throws WxErrorException; /** * 管理推广员接口-声明推广员身份 * * @param request 请求参数 * @return WxMaPromotionAddPromoterResponse */ WxMaPromotionAddPromoterResponse addPromoter(WxMaPromotionAddPromoterRequest request) throws WxErrorException; /** * 管理推广员接口-查询推广员身份 * * @param request 请求参数 * @return WxMaPromotionGetPromoterResponse */ WxMaPromotionGetPromoterResponse getPromoter(WxMaPromotionGetPromoterRequest request) throws WxErrorException; /** * 管理推广员接口-修改推广员身份 * * @param request 请求参数 * @return WxMaPromotionUpdatePromoterResponse */ WxMaPromotionUpdatePromoterResponse updatePromoter(WxMaPromotionUpdatePromoterRequest request) throws WxErrorException; /** * 邀请推广员-获取推广员邀请素材 * * @param request 请求参数 * @return WxMaPromotionGetInvitationMaterialResponse */ WxMaPromotionGetInvitationMaterialResponse getInvitationMaterial(WxMaPromotionGetInvitationMaterialRequest request) throws WxErrorException; /** * 推广员消息管理接口-群发消息 * * @param request 请求参数 * @return WxMaPromotionSendMsgResponse */ WxMaPromotionSendMsgResponse sendMsg(WxMaPromotionSendMsgRequest request) throws WxErrorException; /** * 推广员消息管理接口-单发消息 * * @param request 请求参数 * @return WxMaPromotionSingleSendMsgResponse */ WxMaPromotionSingleSendMsgResponse singleSendMsg(WxMaPromotionSingleSendMsgRequest request) throws WxErrorException; /** * 推广员消息管理接口-查询送达结果 * * @param request 请求参数 * @return WxMaPromotionGetMsgResponse */ WxMaPromotionGetMsgResponse getMsg(WxMaPromotionGetMsgRequest request) throws WxErrorException; /** * 推广员消息管理接口-分析点击效果 * * @param request 请求参数 * @return WxMaPromotionGetMsgClickDataResponse */ WxMaPromotionGetMsgClickDataResponse getMsgClickData(WxMaPromotionGetMsgClickDataRequest request) throws WxErrorException; /** * 推广数据接口-生成推广素材 * * @param request 请求参数 * @return WxMaPromotionGetShareMaterialResponse */ WxMaPromotionGetShareMaterialResponse getShareMaterial(WxMaPromotionGetShareMaterialRequest request) throws WxErrorException; /** * 推广数据接口-分析触达效果 * * @param request 请求参数 * @return WxMaPromotionGetRelationResponse */ WxMaPromotionGetRelationResponse getRelation(WxMaPromotionGetRelationRequest request) throws WxErrorException; /** * 推广数据接口-查询推广订单 * * @param request 请求参数 * @return WxMaPromotionGetOrderResponse */ WxMaPromotionGetOrderResponse getOrder(WxMaPromotionGetOrderRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCatService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopCatService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopCatGetResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序交易组件-接入商品前必需接口 * * @author liming1019 */ public interface WxMaShopCatService { /** * 获取商品类目 * * @return WxMaShopCatGetResponse * @throws WxErrorException */ WxMaShopCatGetResponse getCat() throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaSecurityService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaSecurityService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaMediaAsyncCheckResult; import cn.binarywang.wx.miniapp.bean.safety.request.WxMaUserSafetyRiskRankRequest; import cn.binarywang.wx.miniapp.bean.safety.response.WxMaUserSafetyRiskRankResponse; import cn.binarywang.wx.miniapp.bean.security.WxMaMediaSecCheckCheckRequest; import cn.binarywang.wx.miniapp.bean.security.WxMaMsgSecCheckCheckRequest; import cn.binarywang.wx.miniapp.bean.security.WxMaMsgSecCheckCheckResponse; import me.chanjar.weixin.common.error.WxErrorException; import java.io.File; /** * <pre> * 小程序安全相关接口. * Created by Binary Wang on 2018/11/24. * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public interface WxMaSecurityService { /** * <pre> * 校验一张图片是否含有违法违规内容. * 应用场景举例: * 1)图片智能鉴黄:涉及拍照的工具类应用(如美拍,识图类应用)用户拍照上传检测;电商类商品上架图片检测;媒体类用户文章里的图片检测等; * 2)敏感人脸识别:用户头像;媒体类用户文章里的图片检测;社交类用户上传的图片检测等。频率限制:单个 appId 调用上限为 1000 次/分钟,100,000 次/天 * 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/imgSecCheck.html">https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/imgSecCheck.html</a> * </pre> * * @param file the file * @return the boolean * @throws WxErrorException the wx error exception */ boolean checkImage(File file) throws WxErrorException; /** * 校验一张图片是否含有违法违规内容 * * @param fileUrl 文件网络地址 * @return 是否违规 boolean * @throws WxErrorException . */ boolean checkImage(String fileUrl) throws WxErrorException; /** * <pre> * 检查一段文本是否含有违法违规内容。 * 应用场景举例: * 用户个人资料违规文字检测; * 媒体新闻类用户发表文章,评论内容检测; * 游戏类用户编辑上传的素材(如答题类小游戏用户上传的问题及答案)检测等。 频率限制:单个 appId 调用上限为 4000 次/分钟,2,000,000 次/天* * 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/msgSecCheck.html">https://developers.weixin.qq.com/miniprogram/dev/api/open-api/sec-check/msgSecCheck.html</a> * </pre> * * @param msgString the msg string * @return the boolean * @throws WxErrorException the wx error exception */ boolean checkMessage(String msgString) throws WxErrorException; /** * <pre> * 检查一段文本是否含有违法违规内容(新版本接口,主要是request和response做了参数优化) * 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.msgSecCheck.html">https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.msgSecCheck.html</a> * </pre> * @param msgRequest request * @return WxMaMsgSecCheckCheckResponse * @throws WxErrorException the wx error exception */ WxMaMsgSecCheckCheckResponse checkMessage(WxMaMsgSecCheckCheckRequest msgRequest) throws WxErrorException; /** * <pre> * 异步校验图片/音频是否含有违法违规内容。 * 应用场景举例: * 语音风险识别:社交类用户发表的语音内容检测; * 图片智能鉴黄:涉及拍照的工具类应用(如美拍,识图类应用)用户拍照上传检测;电商类商品上架图片检测;媒体类用户文章里的图片检测等; * 敏感人脸识别:用户头像;媒体类用户文章里的图片检测;社交类用户上传的图片检测等。 * 频率限制: * 单个 appId 调用上限为 2000 次/分钟,200,000 次/天;文件大小限制:单个文件大小不超过10M * 详情请见: * <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html">https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html</a> * </pre> * * @param mediaUrl 要检测的多媒体url * @param mediaType 媒体类型,{@link cn.binarywang.wx.miniapp.constant.WxMaConstants.SecCheckMediaType} * @return wx ma media async check result * @throws WxErrorException the wx error exception */ WxMaMediaAsyncCheckResult mediaCheckAsync(String mediaUrl, int mediaType) throws WxErrorException; /** * <pre> * 异步校验图片/音频是否含有违法违规内容。(新版本接口,主要对request和respone做了参数优化) * 应用场景举例: * 语音风险识别:社交类用户发表的语音内容检测; * 图片智能鉴黄:涉及拍照的工具类应用(如美拍,识图类应用)用户拍照上传检测;电商类商品上架图片检测;媒体类用户文章里的图片检测等; * 敏感人脸识别:用户头像;媒体类用户文章里的图片检测;社交类用户上传的图片检测等。 * 频率限制: * 单个 appId 调用上限为 2000 次/分钟,200,000 次/天;文件大小限制:单个文件大小不超过10M * 详情请见: * <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html">https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/sec-check/security.mediaCheckAsync.html</a> * </pre> * * @param request 请求 * @return wx ma media async check result * @throws WxErrorException the wx error exception */ WxMaMediaAsyncCheckResult mediaCheckAsync(WxMaMediaSecCheckCheckRequest request) throws WxErrorException; /** * <pre> * 根据提交的用户信息数据获取用户的安全等级,无需用户授权 * 文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/safety-control-capability/riskControl.getUserRiskRank.html * </pre> * * @param wxMaUserSafetyRiskRankRequest 获取用户安全等级请求 * @throws WxErrorException 通用异常 */ WxMaUserSafetyRiskRankResponse getUserRiskRank(WxMaUserSafetyRiskRankRequest wxMaUserSafetyRiskRankRequest) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSpuService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaShopSpuService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuInfo; import cn.binarywang.wx.miniapp.bean.shop.WxMaShopSpuWithoutAuditInfo; import cn.binarywang.wx.miniapp.bean.shop.request.WxMaShopSpuPageRequest; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopAddSpuResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopBaseResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuListResponse; import cn.binarywang.wx.miniapp.bean.shop.response.WxMaShopGetSpuResponse; import me.chanjar.weixin.common.error.WxErrorException; /** * 小程序交易组件-商品服务 * * @author boris */ public interface WxMaShopSpuService { WxMaShopAddSpuResponse addSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException; WxMaShopBaseResponse deleteSpu(Integer productId, String outProductId) throws WxErrorException; WxMaShopGetSpuResponse getSpu(Integer productId, String outProductId, Integer needEditSpu) throws WxErrorException; WxMaShopGetSpuListResponse getSpuList(WxMaShopSpuPageRequest request) throws WxErrorException; WxMaShopAddSpuResponse updateSpu(WxMaShopSpuInfo spuInfo) throws WxErrorException; WxMaShopAddSpuResponse updateSpuWithoutAudit(WxMaShopSpuWithoutAuditInfo spuInfo) throws WxErrorException; WxMaShopBaseResponse listingSpu(Integer productId, String outProductId) throws WxErrorException; WxMaShopBaseResponse delistingSpu(Integer productId, String outProductId) throws WxErrorException; WxMaShopBaseResponse deleteAudit(Integer productId, String outProductId) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaKefuService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaKefuService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfInfo; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfList; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfSession; import cn.binarywang.wx.miniapp.bean.kefu.WxMaKfSessionList; import cn.binarywang.wx.miniapp.bean.kefu.request.WxMaKfAccountRequest; import me.chanjar.weixin.common.error.WxErrorException; /** * <pre> * 小程序客服管理接口. * 不同于 WxMaCustomserviceWorkService (企业微信客服绑定) 和 WxMaMsgService.sendKefuMsg (发送客服消息), * 此接口专门处理小程序客服账号管理、会话管理等功能。 * * 注意:小程序客服管理接口与公众号客服管理接口在API端点和功能上有所不同。 * </pre> * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public interface WxMaKefuService { /** * <pre> * 获取客服基本信息 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.getContactList.html">获取客服基本信息</a> * 接口url格式:https://api.weixin.qq.com/cgi-bin/customservice/getkflist?access_token=ACCESS_TOKEN * </pre> * * @return 客服列表 * @throws WxErrorException 异常 */ WxMaKfList kfList() throws WxErrorException; /** * <pre> * 添加客服账号 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.addKfAccount.html">添加客服账号</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN * </pre> * * @param request 客服账号信息 * @return 是否成功 * @throws WxErrorException 异常 */ boolean kfAccountAdd(WxMaKfAccountRequest request) throws WxErrorException; /** * <pre> * 修改客服账号 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.updateKfAccount.html">修改客服账号</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/update?access_token=ACCESS_TOKEN * </pre> * * @param request 客服账号信息 * @return 是否成功 * @throws WxErrorException 异常 */ boolean kfAccountUpdate(WxMaKfAccountRequest request) throws WxErrorException; /** * <pre> * 删除客服账号 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.deleteKfAccount.html">删除客服账号</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfaccount/del?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT * </pre> * * @param kfAccount 客服账号 * @return 是否成功 * @throws WxErrorException 异常 */ boolean kfAccountDel(String kfAccount) throws WxErrorException; /** * <pre> * 创建会话 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.createSession.html">创建会话</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfsession/create?access_token=ACCESS_TOKEN * </pre> * * @param openid 用户openid * @param kfAccount 客服账号 * @return 是否成功 * @throws WxErrorException 异常 */ boolean kfSessionCreate(String openid, String kfAccount) throws WxErrorException; /** * <pre> * 关闭会话 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.closeSession.html">关闭会话</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfsession/close?access_token=ACCESS_TOKEN * </pre> * * @param openid 用户openid * @param kfAccount 客服账号 * @return 是否成功 * @throws WxErrorException 异常 */ boolean kfSessionClose(String openid, String kfAccount) throws WxErrorException; /** * <pre> * 获取客户的会话状态 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.getSession.html">获取客户的会话状态</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfsession/getsession?access_token=ACCESS_TOKEN&openid=OPENID * </pre> * * @param openid 用户openid * @return 会话信息 * @throws WxErrorException 异常 */ WxMaKfSession kfSessionGet(String openid) throws WxErrorException; /** * <pre> * 获取客服的会话列表 * 详情请见:<a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/customer-service/customerServiceMessage.getSessionList.html">获取客服的会话列表</a> * 接口url格式:https://api.weixin.qq.com/customservice/kfsession/getsessionlist?access_token=ACCESS_TOKEN&kf_account=KFACCOUNT * </pre> * * @param kfAccount 客服账号 * @return 会话列表 * @throws WxErrorException 异常 */ WxMaKfSessionList kfSessionList(String kfAccount) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaUserService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaUserService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.WxMaCode2VerifyInfoResult; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; import me.chanjar.weixin.common.error.WxErrorException; import java.util.Map; /** * 用户信息相关操作接口. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ public interface WxMaUserService { /** * 获取登录后的session信息. * * @param jsCode 登录时获取的 code * @return . * @throws WxErrorException . */ WxMaJscode2SessionResult getSessionInfo(String jsCode) throws WxErrorException; /** * 解密用户敏感数据. * * @param sessionKey 会话密钥 * @param encryptedData 消息密文 * @param ivStr 加密算法的初始向量 */ WxMaUserInfo getUserInfo(String sessionKey, String encryptedData, String ivStr); /** * 上报用户数据后台接口. * <p>小游戏可以通过本接口上报key-value数据到用户的CloudStorage。</p> * 文档参考https://developers.weixin.qq.com/minigame/dev/document/open-api/data/setUserStorage.html * * @param kvMap 要上报的数据 * @param sessionKey 通过wx.login 获得的登录态 * @param openid . * @throws WxErrorException . */ void setUserStorage(Map<String, String> kvMap, String sessionKey, String openid) throws WxErrorException; /** * 解密用户手机号信息. * * @param sessionKey 会话密钥 * @param encryptedData 消息密文 * @param ivStr 加密算法的初始向量 * @return . * @deprecated 当前(基础库2.21.2以下使用)旧版本,以上请使用替代方法 {@link #getPhoneNoInfo(String)} */ @Deprecated WxMaPhoneNumberInfo getPhoneNoInfo(String sessionKey, String encryptedData, String ivStr); /** * 获取手机号信息,基础库:2.21.2及以上或2023年8月28日起 * * @param code 每个code只能使用一次,code的有效期为5min。code获取方式参考<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html">手机号快速验证组件</a> * @return 用户手机号信息 * @throws WxErrorException . * @apiNote 该接口用于将code换取用户手机号。 */ WxMaPhoneNumberInfo getPhoneNumber(String code) throws WxErrorException; /** * 获取手机号信息,基础库:2.21.2及以上或2023年8月28日起 * * @param code 每个code只能使用一次,code的有效期为5min。code获取方式参考<a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html">手机号快速验证组件</a> * @return 用户手机号信息 * @throws WxErrorException . * @apiNote 该接口用于将code换取用户手机号。 * @implNote 为保持命名风格一致,此方法将更名,推荐使用{@link WxMaUserService#getPhoneNumber(String)} */ @Deprecated WxMaPhoneNumberInfo getPhoneNoInfo(String code) throws WxErrorException; /** * 验证用户信息完整性. * * @param sessionKey 会话密钥 * @param rawData 微信用户基本信息 * @param signature 数据签名 * @return . */ boolean checkUserInfo(String sessionKey, String rawData, String signature); /** * 多端登录验证接口. * <p> * 通过 code 换取用户登录态信息,用于多端登录场景(如手表端)。 * </p> * 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/miniapp/openapi/code2Verifyinfo.html">多端登录</a> * * @param code 登录时获取的 code * @param checkcode 手表授权页面返回的 checkcode * @return 登录验证结果,包含 session_key、openid、unionid 和 is_limit 字段 * @throws WxErrorException 调用微信接口失败时抛出 */ WxMaCode2VerifyInfoResult getCode2VerifyInfo(String code, String checkcode) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaDeviceSubscribeService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaDeviceSubscribeService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.device.*; import me.chanjar.weixin.common.error.WxErrorException; import java.util.List; /** * 小程序设备订阅消息相关 API * 文档: * * @author <a href="https://github.com/leejuncheng">JCLee</a> * @since 2021-12-16 17:13:35 */ public interface WxMaDeviceSubscribeService { /** * <pre> * 获取设备票据 * 应用场景: * 小程序前端界面拉起设备消息授权订阅弹框界面 * 注意: * 设备ticket有效时间为5分钟 * </pre> * * @param deviceTicketRequest * @return * @throws WxErrorException */ String getSnTicket(WxMaDeviceTicketRequest deviceTicketRequest) throws WxErrorException; /** * <pre> * 发送设备订阅消息 * </pre> * * @param deviceSubscribeMessageRequest 订阅消息 * @throws WxErrorException . */ void sendDeviceSubscribeMsg(WxMaDeviceSubscribeMessageRequest deviceSubscribeMessageRequest) throws WxErrorException; /** * <pre> * 创建设备组 * 详情请见:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/createIotGroupId.html * </pre> * * @param createIotGroupIdRequest 请求参数 * @return 设备组的唯一标识 * @throws WxErrorException */ String createIotGroupId(WxMaCreateIotGroupIdRequest createIotGroupIdRequest) throws WxErrorException; /** * <pre> * 查询设备组信息 * 详情请见:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/getIotGroupInfo.html * </pre> * * @param getIotGroupInfoRequest 请求参数 * @return 设备组信息 * @throws WxErrorException */ WxMaIotGroupDeviceInfoResponse getIotGroupInfo(WxMaGetIotGroupInfoRequest getIotGroupInfoRequest) throws WxErrorException; /** * <pre> * 设备组添加设备 * 一个设备组最多添加 50 个设备。 一个设备同一时间只能被添加到一个设备组中。 * 详情请见:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/addIotGroupDevice.html * </pre> * * @param request 请求参数 * @return 成功添加的设备信息 * @throws WxErrorException */ List<WxMaDeviceTicketRequest> addIotGroupDevice(WxMaIotGroupDeviceRequest request) throws WxErrorException; /** * <pre> * 设备组删除设备 * 详情请见:https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/hardware-device/removeIotGroupDevice.html * </pre> * * @param request 请求参数 * @return 成功删除的设备信息 * @throws WxErrorException */ List<WxMaDeviceTicketRequest> removeIotGroupDevice(WxMaIotGroupDeviceRequest request) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderManagementService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaOrderManagementService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.order.WxMaOrderManagementGetOrderDetailPath; import cn.binarywang.wx.miniapp.bean.order.WxMaOrderManagementResult; import me.chanjar.weixin.common.error.WxErrorException; /** * @author xzh * @Description * @createTime 2025/01/16 15:20 */ public interface WxMaOrderManagementService { /** * 查询订单详情路径 * 注意事项 * 如果没有配置过订单详情路径,会返回成功,其中path为''。 * * @return WxMaOrderManagementGetOrderDetailPath * @throws WxErrorException e */ WxMaOrderManagementGetOrderDetailPath getOrderDetailPath() throws WxErrorException; /** * 配置订单详情路径 * 注意事项 * 调用接口前需要先完成订单中心授权协议签署。 * 请确保配置的path可正常跳转到小程序,并且path必须包含字符串“${商品订单号}”。 * * @param path 订单详情路径 * @return WxMaOrderManagementResult * @throws WxErrorException e */ WxMaOrderManagementResult updateOrderDetailPath(String path) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaVodService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaVodService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.vod.*; import me.chanjar.weixin.common.error.WxErrorException; import java.io.File; import java.util.List; /** * 小程序短剧管理服务接口。 * 提供短剧视频上传、管理、审核、播放等相关功能。 * 文档:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/vod.html * */ public interface WxMaVodService { /** * 获取媒体列表。 * 分页获取已上传的媒体文件列表。 * * @param request 获取媒体列表请求对象 * @return 媒体信息列表 * @throws WxErrorException 获取失败时抛出 */ List<WxMaVodMediaInfo> listMedia(WxMaVodListMediaRequest request) throws WxErrorException; /** * 获取剧集列表。 * 分页获取已创建的剧集列表。 * * @param request 获取剧集列表请求对象 * @return 剧集信息列表 * @throws WxErrorException 获取失败时抛出 */ List<WxMaVodDramaInfo> listDrama(WxMaVodListDramaRequest request) throws WxErrorException; /** * 获取媒体播放链接。 * 获取指定媒体文件的播放地址和相关信息。 * * @param request 获取媒体播放链接请求对象 * @return 媒体播放信息对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodMediaPlaybackInfo getMediaLink(WxMaVodGetMediaLinkRequest request) throws WxErrorException; /** * 获取媒体详情。 * 获取指定媒体文件的详细信息。 * * @param request 获取媒体详情请求对象 * @return 媒体信息对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodMediaInfo getMedia(WxMaVodGetMediaRequest request) throws WxErrorException; /** * 删除媒体文件。 * 删除指定的媒体文件,删除后无法恢复。 * * @param request 删除媒体请求对象 * @return 删除是否成功 * @throws WxErrorException 删除失败时抛出 */ boolean deleteMedia(WxMaVodDeleteMediaRequest request) throws WxErrorException; /** * 获取剧集详情。 * 获取指定剧集的详细信息。 * * @param request 获取剧集详情请求对象 * @return 剧集信息对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodDramaInfo getDrama(WxMaVodGetDramaRequest request) throws WxErrorException; /** * 审核剧集。 * 提交剧集进行内容审核。 * * @param request 审核剧集请求对象 * @return 审核任务ID * @throws WxErrorException 审核提交失败时抛出 */ Integer auditDrama(WxMaVodAuditDramaRequest request) throws WxErrorException; /** * 获取CDN用量数据。 * 查询指定时间段内的CDN流量使用情况。 * * @param request 获取CDN用量请求对象 * @return CDN用量数据响应对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodGetCdnUsageResponse getCdnUsageData(WxMaVodGetCdnUsageRequest request) throws WxErrorException; /** * 获取CDN日志。 * 获取指定时间段内的CDN访问日志。 * * @param request 获取CDN日志请求对象 * @return CDN日志响应对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodGetCdnLogResponse getCdnLogs(WxMaVodGetCdnLogRequest request) throws WxErrorException; /** * 拉取上传。 * 通过URL拉取视频文件到平台进行上传。 * * @param request 拉取上传请求对象 * @return 拉取上传响应对象 * @throws WxErrorException 拉取失败时抛出 */ WxMaVodPullUploadResponse pullUpload(WxMaVodPullUploadRequest request) throws WxErrorException; /** * 获取任务状态。 * 查询异步任务的执行状态和结果。 * * @param request 获取任务状态请求对象 * @return 任务状态响应对象 * @throws WxErrorException 获取失败时抛出 */ WxMaVodGetTaskResponse getTask(WxMaVodGetTaskRequest request) throws WxErrorException; /** * 单文件上传(简化版)。 * 直接上传单个视频文件到平台。 * * @param file 要上传的文件 * @param mediaName 媒体文件名称 * @param mediaType 媒体文件类型 * @return 单文件上传结果 * @throws WxErrorException 上传失败时抛出 */ WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType) throws WxErrorException; /** * 单文件上传(完整版)。 * 上传视频文件和封面图片到平台。 * * @param file 要上传的视频文件 * @param mediaName 媒体文件名称 * @param mediaType 媒体文件类型 * @param coverType 封面图片类型 * @param coverData 封面图片文件 * @param sourceContext 来源上下文信息 * @return 单文件上传结果 * @throws WxErrorException 上传失败时抛出 */ WxMaVodSingleFileUploadResult uploadSingleFile(File file, String mediaName, String mediaType, String coverType, File coverData, String sourceContext) throws WxErrorException; /** * 申请上传。 * 申请分片上传的上传凭证和上传地址。 * * @param request 申请上传请求对象 * @return 申请上传响应对象 * @throws WxErrorException 申请失败时抛出 */ WxMaVodApplyUploadResponse applyUpload(WxMaVodApplyUploadRequest request) throws WxErrorException; /** * 确认上传。 * 确认分片上传完成,合并所有分片文件。 * * @param request 确认上传请求对象 * @return 确认上传响应对象 * @throws WxErrorException 确认失败时抛出 */ WxMaVodCommitUploadResponse commitUpload(WxMaVodCommitUploadRequest request) throws WxErrorException; /** * 上传分片。 * 上传文件的一个分片。 * * @param file 分片文件 * @param uploadId 上传ID * @param partNumber 分片编号 * @param resourceType 资源类型 * @return 分片上传结果 * @throws WxErrorException 上传失败时抛出 */ WxMaVodUploadPartResult uploadPart(File file, String uploadId, Integer partNumber, Integer resourceType) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false
binarywang/WxJava
https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressDeliveryReturnService.java
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaExpressDeliveryReturnService.java
package cn.binarywang.wx.miniapp.api; import cn.binarywang.wx.miniapp.bean.express.request.WxMaExpressDeliveryReturnAddRequest; import cn.binarywang.wx.miniapp.bean.express.result.WxMaExpressReturnInfoResult; import me.chanjar.weixin.common.error.WxErrorException; /** * 微信小程序物流退货组件接口。 * 用于处理退货单相关操作,包括新增、查询和取消退货单。 * 文档:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/express/express.html * */ public interface WxMaExpressDeliveryReturnService { /** 新增退货单接口地址 */ String ADD_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/add"; /** 获取退货单接口地址 */ String GET_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/get"; /** 取消退货单接口地址 */ String UNBIND_DELIVERY_RETURN_URL = "https://api.weixin.qq.com/cgi-bin/express/delivery/return/unbind"; /** * 新增退货单。 * 用于创建新的退货单,返回退货单信息。 * * @param wxMaExpressDeliveryReturnAddRequest 退货单新增请求对象 * @return 退货单信息结果 * @throws WxErrorException 新增失败时抛出 */ WxMaExpressReturnInfoResult addDeliveryReturn(WxMaExpressDeliveryReturnAddRequest wxMaExpressDeliveryReturnAddRequest) throws WxErrorException; /** * 获取退货单信息。 * 根据退货单ID查询退货单的详细信息。 * * @param returnId 退货单ID * @return 退货单信息结果 * @throws WxErrorException 获取失败时抛出 */ WxMaExpressReturnInfoResult getDeliveryReturn(String returnId) throws WxErrorException; /** * 取消退货单。 * 取消指定的退货单,取消后的退货单将无法继续使用。 * * @param returnId 退货单ID * @return 操作结果 * @throws WxErrorException 取消失败时抛出 */ WxMaExpressReturnInfoResult unbindDeliveryReturn(String returnId) throws WxErrorException; }
java
Apache-2.0
84b5c4d2d0774f800237634e5d0336f53c004fe3
2026-01-04T14:46:39.499027Z
false