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/spring-boot-starters/wx-java-channel-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/StorageType.java | spring-boot-starters/wx-java-channel-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/StorageType.java | package com.binarywang.spring.starter.wxjava.channel.enums;
/**
* storage类型
*
* @author <a href="https://github.com/lixize">Zeyes</a>
*/
public enum StorageType {
/**
* 内存
*/
Memory,
/**
* redis(JedisClient)
*/
Jedis,
/**
* redis(Redisson)
*/
Redisson,
/**
* redis(RedisTemplate)
*/
RedisTemplate
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/service/WxMaMultiServicesImpl.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/service/WxMaMultiServicesImpl.java | package com.binarywang.spring.starter.wxjava.miniapp.service;
import cn.binarywang.wx.miniapp.api.WxMaService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 微信小程序 {@link com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices} 默认实现
*
* @author monch
* created on 2024/9/6
*/
public class WxMaMultiServicesImpl implements com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices {
private final Map<String, WxMaService> services = new ConcurrentHashMap<>();
@Override
public WxMaService getWxMaService(String tenantId) {
return this.services.get(tenantId);
}
/**
* 根据租户 Id,添加一个 WxMaService 到列表
*
* @param tenantId 租户 Id
* @param wxMaService WxMaService 实例
*/
public void addWxMaService(String tenantId, WxMaService wxMaService) {
this.services.put(tenantId, wxMaService);
}
@Override
public void removeWxMaService(String tenantId) {
this.services.remove(tenantId);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/service/WxMaMultiServices.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/service/WxMaMultiServices.java | package com.binarywang.spring.starter.wxjava.miniapp.service;
import cn.binarywang.wx.miniapp.api.WxMaService;
/**
* 微信小程序 {@link WxMaService} 所有实例存放类.
*
* @author monch
* created on 2024/9/6
*/
public interface WxMaMultiServices {
/**
* 通过租户 Id 获取 WxMaService
*
* @param tenantId 租户 Id
* @return WxMaService
*/
WxMaService getWxMaService(String tenantId);
/**
* 根据租户 Id,从列表中移除一个 WxMaService 实例
*
* @param tenantId 租户 Id
*/
void removeWxMaService(String tenantId);
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/WxMaMultiServiceConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/WxMaMultiServiceConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration;
import com.binarywang.spring.starter.wxjava.miniapp.configuration.services.WxMaInJedisConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.configuration.services.WxMaInMemoryConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.configuration.services.WxMaInRedisTemplateConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.configuration.services.WxMaInRedissonConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 微信小程序相关服务自动注册
*
* @author monch
* created on 2024/9/6
*/
@Configuration
@EnableConfigurationProperties(WxMaMultiProperties.class)
@Import({
WxMaInJedisConfiguration.class,
WxMaInMemoryConfiguration.class,
WxMaInRedissonConfiguration.class,
WxMaInRedisTemplateConfiguration.class
})
public class WxMaMultiServiceConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInMemoryConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInMemoryConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration.services;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于内存策略配置
*
* @author monch
* created on 2024/9/6
*/
@Configuration
@ConditionalOnProperty(
prefix = WxMaMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "memory", matchIfMissing = true
)
@RequiredArgsConstructor
public class WxMaInMemoryConfiguration extends AbstractWxMaConfiguration {
private final WxMaMultiProperties wxMaMultiProperties;
@Bean
public WxMaMultiServices wxMaMultiServices() {
return this.wxMaMultiServices(wxMaMultiProperties);
}
@Override
protected WxMaDefaultConfigImpl wxMaConfigStorage(WxMaMultiProperties wxMaMultiProperties) {
return this.configInMemory();
}
private WxMaDefaultConfigImpl configInMemory() {
return new WxMaDefaultConfigImpl();
// return new WxMaDefaultConfigImpl();
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInJedisConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInJedisConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration.services;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices;
import lombok.RequiredArgsConstructor;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* 自动装配基于 jedis 策略配置
*
* @author monch
* created on 2024/9/6
*/
@Configuration
@ConditionalOnProperty(
prefix = WxMaMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "jedis"
)
@RequiredArgsConstructor
public class WxMaInJedisConfiguration extends AbstractWxMaConfiguration {
private final WxMaMultiProperties wxMaMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxMaMultiServices wxMaMultiServices() {
return this.wxMaMultiServices(wxMaMultiProperties);
}
@Override
protected WxMaDefaultConfigImpl wxMaConfigStorage(WxMaMultiProperties wxMaMultiProperties) {
return this.configRedis(wxMaMultiProperties);
}
private WxMaDefaultConfigImpl configRedis(WxMaMultiProperties wxMaMultiProperties) {
WxMaMultiRedisProperties wxMaMultiRedisProperties = wxMaMultiProperties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (wxMaMultiRedisProperties != null && StringUtils.isNotEmpty(wxMaMultiRedisProperties.getHost())) {
jedisPool = getJedisPool(wxMaMultiProperties);
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
return new WxMaRedisConfigImpl(jedisPool);
}
private JedisPool getJedisPool(WxMaMultiProperties wxMaMultiProperties) {
WxMaMultiProperties.ConfigStorage storage = wxMaMultiProperties.getConfigStorage();
WxMaMultiRedisProperties redis = storage.getRedis();
JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
return new JedisPool(config, redis.getHost(), redis.getPort(),
redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/AbstractWxMaConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/AbstractWxMaConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration.services;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaSingleProperties;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceJoddHttpImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceOkHttpImpl;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* WxMaConfigStorage 抽象配置类
*
* @author monch
* created on 2024/9/6
*/
@RequiredArgsConstructor
@Slf4j
public abstract class AbstractWxMaConfiguration {
protected WxMaMultiServices wxMaMultiServices(WxMaMultiProperties wxMaMultiProperties) {
Map<String, WxMaSingleProperties> appsMap = wxMaMultiProperties.getApps();
if (appsMap == null || appsMap.isEmpty()) {
log.warn("微信公众号应用参数未配置,通过 WxMaMultiServices#getWxMaService(\"tenantId\")获取实例将返回空");
return new WxMaMultiServicesImpl();
}
/**
* 校验 appId 是否唯一,避免使用 redis 缓存 token、ticket 时错乱。
*
* 查看 {@link cn.binarywang.wx.miniapp.config.impl.WxMaRedisConfigImpl#setAppId(String)}
*/
Collection<WxMaSingleProperties> apps = appsMap.values();
if (apps.size() > 1) {
// 校验 appId 是否唯一
boolean multi = apps.stream()
// 没有 appId,如果不判断是否为空,这里会报 NPE 异常
.collect(Collectors.groupingBy(c -> c.getAppId() == null ? 0 : c.getAppId(), Collectors.counting()))
.entrySet().stream().anyMatch(e -> e.getValue() > 1);
if (multi) {
throw new RuntimeException("请确保微信公众号配置 appId 的唯一性");
}
}
WxMaMultiServicesImpl services = new WxMaMultiServicesImpl();
Set<Map.Entry<String, WxMaSingleProperties>> entries = appsMap.entrySet();
for (Map.Entry<String, WxMaSingleProperties> entry : entries) {
String tenantId = entry.getKey();
WxMaSingleProperties wxMaSingleProperties = entry.getValue();
WxMaDefaultConfigImpl storage = this.wxMaConfigStorage(wxMaMultiProperties);
this.configApp(storage, wxMaSingleProperties);
this.configHttp(storage, wxMaMultiProperties.getConfigStorage());
WxMaService wxMaService = this.wxMaService(storage, wxMaMultiProperties);
services.addWxMaService(tenantId, wxMaService);
}
return services;
}
/**
* 配置 WxMaDefaultConfigImpl
*
* @param wxMaMultiProperties 参数
* @return WxMaDefaultConfigImpl
*/
protected abstract WxMaDefaultConfigImpl wxMaConfigStorage(WxMaMultiProperties wxMaMultiProperties);
public WxMaService wxMaService(WxMaConfig wxMaConfig, WxMaMultiProperties wxMaMultiProperties) {
WxMaMultiProperties.ConfigStorage storage = wxMaMultiProperties.getConfigStorage();
WxMaMultiProperties.HttpClientType httpClientType = storage.getHttpClientType();
WxMaService wxMaService;
switch (httpClientType) {
case OK_HTTP:
wxMaService = new WxMaServiceOkHttpImpl();
break;
case JODD_HTTP:
wxMaService = new WxMaServiceJoddHttpImpl();
break;
case HTTP_CLIENT:
wxMaService = new WxMaServiceHttpClientImpl();
break;
default:
wxMaService = new WxMaServiceImpl();
break;
}
wxMaService.setWxMaConfig(wxMaConfig);
int maxRetryTimes = storage.getMaxRetryTimes();
if (maxRetryTimes < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = storage.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
wxMaService.setRetrySleepMillis(retrySleepMillis);
wxMaService.setMaxRetryTimes(maxRetryTimes);
return wxMaService;
}
private void configApp(WxMaDefaultConfigImpl config, WxMaSingleProperties properties) {
String appId = properties.getAppId();
String appSecret = properties.getAppSecret();
String token = properties.getToken();
String aesKey = properties.getAesKey();
boolean useStableAccessToken = properties.isUseStableAccessToken();
config.setAppid(appId);
config.setSecret(appSecret);
if (StringUtils.isNotBlank(token)) {
config.setToken(token);
}
if (StringUtils.isNotBlank(aesKey)) {
config.setAesKey(aesKey);
}
config.setMsgDataFormat(properties.getMsgDataFormat());
config.useStableAccessToken(useStableAccessToken);
config.setApiHostUrl(StringUtils.trimToNull(properties.getApiHostUrl()));
config.setAccessTokenUrl(StringUtils.trimToNull(properties.getAccessTokenUrl()));
}
private void configHttp(WxMaDefaultConfigImpl config, WxMaMultiProperties.ConfigStorage storage) {
String httpProxyHost = storage.getHttpProxyHost();
Integer httpProxyPort = storage.getHttpProxyPort();
String httpProxyUsername = storage.getHttpProxyUsername();
String httpProxyPassword = storage.getHttpProxyPassword();
if (StringUtils.isNotBlank(httpProxyHost)) {
config.setHttpProxyHost(httpProxyHost);
if (httpProxyPort != null) {
config.setHttpProxyPort(httpProxyPort);
}
if (StringUtils.isNotBlank(httpProxyUsername)) {
config.setHttpProxyUsername(httpProxyUsername);
}
if (StringUtils.isNotBlank(httpProxyPassword)) {
config.setHttpProxyPassword(httpProxyPassword);
}
}
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInRedissonConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInRedissonConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration.services;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedissonConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于 redisson 策略配置
*
* @author monch
* created on 2024/9/6
*/
@Configuration
@ConditionalOnProperty(
prefix = WxMaMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redisson"
)
@RequiredArgsConstructor
public class WxMaInRedissonConfiguration extends AbstractWxMaConfiguration {
private final WxMaMultiProperties wxMaMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxMaMultiServices wxMaMultiServices() {
return this.wxMaMultiServices(wxMaMultiProperties);
}
@Override
protected WxMaDefaultConfigImpl wxMaConfigStorage(WxMaMultiProperties wxMaMultiProperties) {
return this.configRedisson(wxMaMultiProperties);
}
private WxMaDefaultConfigImpl configRedisson(WxMaMultiProperties wxMaMultiProperties) {
WxMaMultiRedisProperties redisProperties = wxMaMultiProperties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient(wxMaMultiProperties);
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxMaRedissonConfigImpl(redissonClient, wxMaMultiProperties.getConfigStorage().getKeyPrefix());
}
private RedissonClient getRedissonClient(WxMaMultiProperties wxMaMultiProperties) {
WxMaMultiProperties.ConfigStorage storage = wxMaMultiProperties.getConfigStorage();
WxMaMultiRedisProperties redis = storage.getRedis();
Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
.setDatabase(redis.getDatabase())
.setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInRedisTemplateConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/configuration/services/WxMaInRedisTemplateConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.configuration.services;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaMultiProperties;
import com.binarywang.spring.starter.wxjava.miniapp.service.WxMaMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
* 自动装配基于 redisTemplate 策略配置
*
* @author <a href="mailto:huangbing0730@gmail">hb0730</a> 2025/9/10
*/
@Configuration
@ConditionalOnProperty(prefix = WxMaMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redis_template")
@RequiredArgsConstructor
public class WxMaInRedisTemplateConfiguration extends AbstractWxMaConfiguration {
private final WxMaMultiProperties wxMaMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxMaMultiServices wxMaMultiServices() {
return this.wxMaMultiServices(wxMaMultiProperties);
}
@Override
protected WxMaDefaultConfigImpl wxMaConfigStorage(WxMaMultiProperties wxMaMultiProperties) {
return this.configRedisTemplate(wxMaMultiProperties);
}
private WxMaDefaultConfigImpl configRedisTemplate(WxMaMultiProperties wxMaMultiProperties) {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
RedisTemplateWxRedisOps wxRedisOps = new RedisTemplateWxRedisOps(redisTemplate);
return new WxMaRedisBetterConfigImpl(wxRedisOps, wxMaMultiProperties.getConfigStorage().getKeyPrefix());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/autoconfigure/WxMaMultiAutoConfiguration.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/autoconfigure/WxMaMultiAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.autoconfigure;
import com.binarywang.spring.starter.wxjava.miniapp.configuration.WxMaMultiServiceConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* @author monch
* created on 2024/9/6
*/
@Configuration
@Import(WxMaMultiServiceConfiguration.class)
public class WxMaMultiAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaSingleProperties.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaSingleProperties.java | package com.binarywang.spring.starter.wxjava.miniapp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author monch
* created on 2024/9/6
*/
@Data
@NoArgsConstructor
public class WxMaSingleProperties implements Serializable {
private static final long serialVersionUID = 1980986361098922525L;
/**
* 设置微信公众号的 appid.
*/
private String appId;
/**
* 设置微信公众号的 app secret.
*/
private String appSecret;
/**
* 设置微信公众号的 token.
*/
private String token;
/**
* 设置微信公众号的 EncodingAESKey.
*/
private String aesKey;
/**
* 消息格式,XML或者JSON.
*/
private String msgDataFormat;
/**
* 是否使用稳定版 Access Token
*/
private boolean useStableAccessToken = false;
/**
* 自定义API主机地址,用于替换默认的 https://api.weixin.qq.com
* 例如:http://proxy.company.com:8080
*/
private String apiHostUrl;
/**
* 自定义获取AccessToken地址,用于向自定义统一服务获取AccessToken
* 例如:http://proxy.company.com:8080/oauth/token
*/
private String accessTokenUrl;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaMultiProperties.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaMultiProperties.java | package com.binarywang.spring.starter.wxjava.miniapp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author monch
* created on 2024/9/6
*/
@Data
@NoArgsConstructor
@ConfigurationProperties(WxMaMultiProperties.PREFIX)
public class WxMaMultiProperties implements Serializable {
private static final long serialVersionUID = -5358245184407791011L;
public static final String PREFIX = "wx.ma";
private Map<String, WxMaSingleProperties> apps = new HashMap<>();
/**
* 自定义host配置
*/
private HostConfig hosts;
/**
* 存储策略
*/
private final ConfigStorage configStorage = new ConfigStorage();
@Data
@NoArgsConstructor
public static class HostConfig implements Serializable {
private static final long serialVersionUID = -4172767630740346001L;
/**
* 对应于:https://api.weixin.qq.com
*/
private String apiHost;
/**
* 对应于:https://open.weixin.qq.com
*/
private String openHost;
/**
* 对应于:https://mp.weixin.qq.com
*/
private String mpHost;
}
@Data
@NoArgsConstructor
public static class ConfigStorage implements Serializable {
private static final long serialVersionUID = 4815731027000065434L;
/**
* 存储类型.
*/
private StorageType type = StorageType.MEMORY;
/**
* 指定key前缀.
*/
private String keyPrefix = "wx:ma:multi";
/**
* redis连接配置.
*/
@NestedConfigurationProperty
private final WxMaMultiRedisProperties redis = new WxMaMultiRedisProperties();
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HTTP_CLIENT;
/**
* http代理主机.
*/
private String httpProxyHost;
/**
* http代理端口.
*/
private Integer httpProxyPort;
/**
* http代理用户名.
*/
private String httpProxyUsername;
/**
* http代理密码.
*/
private String httpProxyPassword;
/**
* http 请求最大重试次数
* <pre>
* {@link cn.binarywang.wx.miniapp.api.WxMaService#setMaxRetryTimes(int)}
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setMaxRetryTimes(int)}
* </pre>
*/
private int maxRetryTimes = 5;
/**
* http 请求重试间隔
* <pre>
* {@link cn.binarywang.wx.miniapp.api.WxMaService#setRetrySleepMillis(int)}
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setRetrySleepMillis(int)}
* </pre>
*/
private int retrySleepMillis = 1000;
}
public enum StorageType {
/**
* 内存
*/
MEMORY,
/**
* jedis
*/
JEDIS,
/**
* redisson
*/
REDISSON,
/**
* redisTemplate
*/
REDIS_TEMPLATE
}
public enum HttpClientType {
/**
* HttpClient
*/
HTTP_CLIENT,
/**
* OkHttp
*/
OK_HTTP,
/**
* JoddHttp
*/
JODD_HTTP
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaMultiRedisProperties.java | spring-boot-starters/wx-java-miniapp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaMultiRedisProperties.java | package com.binarywang.spring.starter.wxjava.miniapp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author monch
* created on 2024/9/6
*/
@Data
@NoArgsConstructor
public class WxMaMultiRedisProperties implements Serializable {
private static final long serialVersionUID = -5924815351660074401L;
/**
* 主机地址.
*/
private String host = "127.0.0.1";
/**
* 端口号.
*/
private int port = 6379;
/**
* 密码.
*/
private String password;
/**
* 超时.
*/
private int timeout = 2000;
/**
* 数据库.
*/
private int database = 0;
/**
* sentinel ips
*/
private String sentinelIps;
/**
* sentinel name
*/
private String sentinelName;
private Integer maxActive;
private Integer maxIdle;
private Integer maxWaitMillis;
private Integer minIdle;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/service/WxCpMultiServices.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/service/WxCpMultiServices.java | package com.binarywang.spring.starter.wxjava.cp.service;
import me.chanjar.weixin.cp.api.WxCpService;
/**
* 企业微信 {@link WxCpService} 所有实例存放类.
*
* @author yl
* created on 2023/10/16
*/
public interface WxCpMultiServices {
/**
* 通过租户 Id 获取 WxCpService
*
* @param tenantId 租户 Id
* @return WxCpService
*/
WxCpService getWxCpService(String tenantId);
/**
* 根据租户 Id,从列表中移除一个 WxCpService 实例
*
* @param tenantId 租户 Id
*/
void removeWxCpService(String tenantId);
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/service/WxCpMultiServicesImpl.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/service/WxCpMultiServicesImpl.java | package com.binarywang.spring.starter.wxjava.cp.service;
import me.chanjar.weixin.cp.api.WxCpService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 企业微信 {@link WxCpMultiServices} 默认实现
*
* @author yl
* created on 2023/10/16
*/
public class WxCpMultiServicesImpl implements WxCpMultiServices {
private final Map<String, WxCpService> services = new ConcurrentHashMap<>();
/**
* 通过租户 Id 获取 WxCpService
*
* @param tenantId 租户 Id
* @return WxCpService
*/
@Override
public WxCpService getWxCpService(String tenantId) {
return this.services.get(tenantId);
}
/**
* 根据租户 Id,添加一个 WxCpService 到列表
*
* @param tenantId 租户 Id
* @param wxCpService WxCpService 实例
*/
public void addWxCpService(String tenantId, WxCpService wxCpService) {
this.services.put(tenantId, wxCpService);
}
@Override
public void removeWxCpService(String tenantId) {
this.services.remove(tenantId);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/WxCpMultiServicesAutoConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/WxCpMultiServicesAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration;
import com.binarywang.spring.starter.wxjava.cp.configuration.services.WxCpInJedisConfiguration;
import com.binarywang.spring.starter.wxjava.cp.configuration.services.WxCpInMemoryConfiguration;
import com.binarywang.spring.starter.wxjava.cp.configuration.services.WxCpInRedisTemplateConfiguration;
import com.binarywang.spring.starter.wxjava.cp.configuration.services.WxCpInRedissonConfiguration;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 企业微信平台相关服务自动注册
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@EnableConfigurationProperties(WxCpMultiProperties.class)
@Import({
WxCpInJedisConfiguration.class,
WxCpInMemoryConfiguration.class,
WxCpInRedissonConfiguration.class,
WxCpInRedisTemplateConfiguration.class
})
public class WxCpMultiServicesAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInRedissonConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInRedissonConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration.services;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpRedissonConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于 redisson 策略配置
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redisson"
)
@RequiredArgsConstructor
public class WxCpInRedissonConfiguration extends AbstractWxCpConfiguration {
private final WxCpMultiProperties wxCpMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxCpMultiServices wxCpMultiServices() {
return this.wxCpMultiServices(wxCpMultiProperties);
}
@Override
protected WxCpDefaultConfigImpl wxCpConfigStorage(WxCpMultiProperties wxCpMultiProperties) {
return this.configRedisson(wxCpMultiProperties);
}
private WxCpDefaultConfigImpl configRedisson(WxCpMultiProperties wxCpMultiProperties) {
WxCpMultiRedisProperties redisProperties = wxCpMultiProperties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient(wxCpMultiProperties);
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxCpRedissonConfigImpl(redissonClient, wxCpMultiProperties.getConfigStorage().getKeyPrefix());
}
private RedissonClient getRedissonClient(WxCpMultiProperties wxCpMultiProperties) {
WxCpMultiProperties.ConfigStorage storage = wxCpMultiProperties.getConfigStorage();
WxCpMultiRedisProperties redis = storage.getRedis();
Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
.setDatabase(redis.getDatabase())
.setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/AbstractWxCpConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration.services;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpSingleProperties;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServices;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceJoddHttpImpl;
import me.chanjar.weixin.cp.api.impl.WxCpServiceOkHttpImpl;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* WxCpConfigStorage 抽象配置类
*
* @author yl
* created on 2023/10/16
*/
@RequiredArgsConstructor
@Slf4j
public abstract class AbstractWxCpConfiguration {
protected WxCpMultiServices wxCpMultiServices(WxCpMultiProperties wxCpMultiProperties) {
Map<String, WxCpSingleProperties> corps = wxCpMultiProperties.getCorps();
if (corps == null || corps.isEmpty()) {
log.warn("企业微信应用参数未配置,通过 WxCpMultiServices#getWxCpService(\"tenantId\")获取实例将返回空");
return new WxCpMultiServicesImpl();
}
/**
* 校验同一个企业下,agentId 是否唯一,避免使用 redis 缓存 token、ticket 时错乱。
*
* 查看 {@link me.chanjar.weixin.cp.config.impl.AbstractWxCpInRedisConfigImpl#setAgentId(Integer)}
*/
Collection<WxCpSingleProperties> corpList = corps.values();
if (corpList.size() > 1) {
// 先按 corpId 分组统计
Map<String, List<WxCpSingleProperties>> corpsMap = corpList.stream()
.collect(Collectors.groupingBy(WxCpSingleProperties::getCorpId));
Set<Map.Entry<String, List<WxCpSingleProperties>>> entries = corpsMap.entrySet();
for (Map.Entry<String, List<WxCpSingleProperties>> entry : entries) {
String corpId = entry.getKey();
// 校验每个企业下,agentId 是否唯一
boolean multi = entry.getValue().stream()
// 通讯录没有 agentId,如果不判断是否为空,这里会报 NPE 异常
.collect(Collectors.groupingBy(c -> c.getAgentId() == null ? 0 : c.getAgentId(), Collectors.counting()))
.entrySet().stream().anyMatch(e -> e.getValue() > 1);
if (multi) {
throw new RuntimeException("请确保企业微信配置唯一性[" + corpId + "]");
}
}
}
WxCpMultiServicesImpl services = new WxCpMultiServicesImpl();
Set<Map.Entry<String, WxCpSingleProperties>> entries = corps.entrySet();
for (Map.Entry<String, WxCpSingleProperties> entry : entries) {
String tenantId = entry.getKey();
WxCpSingleProperties wxCpSingleProperties = entry.getValue();
WxCpDefaultConfigImpl storage = this.wxCpConfigStorage(wxCpMultiProperties);
this.configCorp(storage, wxCpSingleProperties);
this.configHttp(storage, wxCpMultiProperties.getConfigStorage());
WxCpService wxCpService = this.wxCpService(storage, wxCpMultiProperties.getConfigStorage());
services.addWxCpService(tenantId, wxCpService);
}
return services;
}
/**
* 配置 WxCpDefaultConfigImpl
*
* @param wxCpMultiProperties 参数
* @return WxCpDefaultConfigImpl
*/
protected abstract WxCpDefaultConfigImpl wxCpConfigStorage(WxCpMultiProperties wxCpMultiProperties);
private WxCpService wxCpService(WxCpConfigStorage wxCpConfigStorage, WxCpMultiProperties.ConfigStorage storage) {
WxCpMultiProperties.HttpClientType httpClientType = storage.getHttpClientType();
WxCpService wxCpService;
switch (httpClientType) {
case OK_HTTP:
wxCpService = new WxCpServiceOkHttpImpl();
break;
case JODD_HTTP:
wxCpService = new WxCpServiceJoddHttpImpl();
break;
case HTTP_CLIENT:
wxCpService = new WxCpServiceApacheHttpClientImpl();
break;
default:
wxCpService = new WxCpServiceImpl();
break;
}
wxCpService.setWxCpConfigStorage(wxCpConfigStorage);
int maxRetryTimes = storage.getMaxRetryTimes();
if (maxRetryTimes < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = storage.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
wxCpService.setRetrySleepMillis(retrySleepMillis);
wxCpService.setMaxRetryTimes(maxRetryTimes);
return wxCpService;
}
private void configCorp(WxCpDefaultConfigImpl config, WxCpSingleProperties wxCpSingleProperties) {
String corpId = wxCpSingleProperties.getCorpId();
String corpSecret = wxCpSingleProperties.getCorpSecret();
Integer agentId = wxCpSingleProperties.getAgentId();
String token = wxCpSingleProperties.getToken();
String aesKey = wxCpSingleProperties.getAesKey();
// 企业微信,私钥,会话存档路径
String msgAuditPriKey = wxCpSingleProperties.getMsgAuditPriKey();
String msgAuditLibPath = wxCpSingleProperties.getMsgAuditLibPath();
config.setCorpId(corpId);
config.setCorpSecret(corpSecret);
config.setAgentId(agentId);
if (StringUtils.isNotBlank(token)) {
config.setToken(token);
}
if (StringUtils.isNotBlank(aesKey)) {
config.setAesKey(aesKey);
}
if (StringUtils.isNotBlank(msgAuditPriKey)) {
config.setMsgAuditPriKey(msgAuditPriKey);
}
if (StringUtils.isNotBlank(msgAuditLibPath)) {
config.setMsgAuditLibPath(msgAuditLibPath);
}
if (StringUtils.isNotBlank(wxCpSingleProperties.getBaseApiUrl())) {
config.setBaseApiUrl(wxCpSingleProperties.getBaseApiUrl());
}
}
private void configHttp(WxCpDefaultConfigImpl config, WxCpMultiProperties.ConfigStorage storage) {
String httpProxyHost = storage.getHttpProxyHost();
Integer httpProxyPort = storage.getHttpProxyPort();
String httpProxyUsername = storage.getHttpProxyUsername();
String httpProxyPassword = storage.getHttpProxyPassword();
if (StringUtils.isNotBlank(httpProxyHost)) {
config.setHttpProxyHost(httpProxyHost);
if (httpProxyPort != null) {
config.setHttpProxyPort(httpProxyPort);
}
if (StringUtils.isNotBlank(httpProxyUsername)) {
config.setHttpProxyUsername(httpProxyUsername);
}
if (StringUtils.isNotBlank(httpProxyPassword)) {
config.setHttpProxyPassword(httpProxyPassword);
}
}
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInMemoryConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInMemoryConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration.services;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于内存策略配置
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "memory", matchIfMissing = true
)
@RequiredArgsConstructor
public class WxCpInMemoryConfiguration extends AbstractWxCpConfiguration {
private final WxCpMultiProperties wxCpMultiProperties;
@Bean
public WxCpMultiServices wxCpMultiServices() {
return this.wxCpMultiServices(wxCpMultiProperties);
}
@Override
protected WxCpDefaultConfigImpl wxCpConfigStorage(WxCpMultiProperties wxCpMultiProperties) {
return this.configInMemory();
}
private WxCpDefaultConfigImpl configInMemory() {
return new WxCpDefaultConfigImpl();
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInJedisConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInJedisConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration.services;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpJedisConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* 自动装配基于 jedis 策略配置
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "jedis"
)
@RequiredArgsConstructor
public class WxCpInJedisConfiguration extends AbstractWxCpConfiguration {
private final WxCpMultiProperties wxCpMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxCpMultiServices wxCpMultiServices() {
return this.wxCpMultiServices(wxCpMultiProperties);
}
@Override
protected WxCpDefaultConfigImpl wxCpConfigStorage(WxCpMultiProperties wxCpMultiProperties) {
return this.configRedis(wxCpMultiProperties);
}
private WxCpDefaultConfigImpl configRedis(WxCpMultiProperties wxCpMultiProperties) {
WxCpMultiRedisProperties wxCpMultiRedisProperties = wxCpMultiProperties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (wxCpMultiRedisProperties != null && StringUtils.isNotEmpty(wxCpMultiRedisProperties.getHost())) {
jedisPool = getJedisPool(wxCpMultiProperties);
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
return new WxCpJedisConfigImpl(jedisPool, wxCpMultiProperties.getConfigStorage().getKeyPrefix());
}
private JedisPool getJedisPool(WxCpMultiProperties wxCpMultiProperties) {
WxCpMultiProperties.ConfigStorage storage = wxCpMultiProperties.getConfigStorage();
WxCpMultiRedisProperties redis = storage.getRedis();
JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
return new JedisPool(config, redis.getHost(), redis.getPort(),
redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInRedisTemplateConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/configuration/services/WxCpInRedisTemplateConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.configuration.services;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpMultiProperties;
import com.binarywang.spring.starter.wxjava.cp.service.WxCpMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpRedisTemplateConfigImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
* 自动装配基于 redisTemplate 策略配置
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redistemplate"
)
@RequiredArgsConstructor
public class WxCpInRedisTemplateConfiguration extends AbstractWxCpConfiguration {
private final WxCpMultiProperties wxCpMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxCpMultiServices wxCpMultiServices() {
return this.wxCpMultiServices(wxCpMultiProperties);
}
@Override
protected WxCpDefaultConfigImpl wxCpConfigStorage(WxCpMultiProperties wxCpMultiProperties) {
return this.configRedisTemplate(wxCpMultiProperties);
}
private WxCpDefaultConfigImpl configRedisTemplate(WxCpMultiProperties wxCpMultiProperties) {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
return new WxCpRedisTemplateConfigImpl(redisTemplate, wxCpMultiProperties.getConfigStorage().getKeyPrefix());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/autoconfigure/WxCpMultiAutoConfiguration.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/autoconfigure/WxCpMultiAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.autoconfigure;
import com.binarywang.spring.starter.wxjava.cp.configuration.WxCpMultiServicesAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 企业微信自动注册
*
* @author yl
* created on 2023/10/16
*/
@Configuration
@Import(WxCpMultiServicesAutoConfiguration.class)
public class WxCpMultiAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpSingleProperties.java | package com.binarywang.spring.starter.wxjava.cp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 企业微信企业相关配置属性
*
* @author yl
* created on 2023/10/16
*/
@Data
@NoArgsConstructor
public class WxCpSingleProperties implements Serializable {
private static final long serialVersionUID = -7502823825007859418L;
/**
* 微信企业号 corpId
*/
private String corpId;
/**
* 微信企业号 corpSecret
*/
private String corpSecret;
/**
* 微信企业号应用 token
*/
private String token;
/**
* 微信企业号应用 ID
*/
private Integer agentId;
/**
* 微信企业号应用 EncodingAESKey
*/
private String aesKey;
/**
* 微信企业号应用 会话存档私钥
*/
private String msgAuditPriKey;
/**
* 微信企业号应用 会话存档类库路径
*/
private String msgAuditLibPath;
/**
* 自定义企业微信服务器baseUrl,用于替换默认的 https://qyapi.weixin.qq.com
* 例如:http://proxy.company.com:8080
*/
private String baseApiUrl;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpMultiRedisProperties.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpMultiRedisProperties.java | package com.binarywang.spring.starter.wxjava.cp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Redis配置.
*
* @author yl
* created on 2023/10/16
*/
@Data
@NoArgsConstructor
public class WxCpMultiRedisProperties implements Serializable {
private static final long serialVersionUID = -5924815351660074401L;
/**
* 主机地址.
*/
private String host;
/**
* 端口号.
*/
private int port = 6379;
/**
* 密码.
*/
private String password;
/**
* 超时.
*/
private int timeout = 2000;
/**
* 数据库.
*/
private int database = 0;
private Integer maxActive;
private Integer maxIdle;
private Integer maxWaitMillis;
private Integer minIdle;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpMultiProperties.java | spring-boot-starters/wx-java-cp-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpMultiProperties.java | package com.binarywang.spring.starter.wxjava.cp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 企业微信多企业接入相关配置属性
*
* @author yl
* created on 2023/10/16
*/
@Data
@NoArgsConstructor
@ConfigurationProperties(prefix = WxCpMultiProperties.PREFIX)
public class WxCpMultiProperties implements Serializable {
private static final long serialVersionUID = -1569510477055668503L;
public static final String PREFIX = "wx.cp";
private Map<String, WxCpSingleProperties> corps = new HashMap<>();
/**
* 配置存储策略,默认内存
*/
private ConfigStorage configStorage = new ConfigStorage();
@Data
@NoArgsConstructor
public static class ConfigStorage implements Serializable {
private static final long serialVersionUID = 4815731027000065434L;
/**
* 存储类型
*/
private StorageType type = StorageType.memory;
/**
* 指定key前缀
*/
private String keyPrefix = "wx:cp";
/**
* redis连接配置
*/
@NestedConfigurationProperty
private WxCpMultiRedisProperties redis = new WxCpMultiRedisProperties();
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HTTP_CLIENT;
/**
* http代理主机
*/
private String httpProxyHost;
/**
* http代理端口
*/
private Integer httpProxyPort;
/**
* http代理用户名
*/
private String httpProxyUsername;
/**
* http代理密码
*/
private String httpProxyPassword;
/**
* http 请求最大重试次数
* <pre>
* {@link me.chanjar.weixin.cp.api.WxCpService#setMaxRetryTimes(int)}
* {@link me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl#setMaxRetryTimes(int)}
* </pre>
*/
private int maxRetryTimes = 5;
/**
* http 请求重试间隔
* <pre>
* {@link me.chanjar.weixin.cp.api.WxCpService#setRetrySleepMillis(int)}
* {@link me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl#setRetrySleepMillis(int)}
* </pre>
*/
private int retrySleepMillis = 1000;
}
public enum StorageType {
/**
* 内存
*/
memory,
/**
* jedis
*/
jedis,
/**
* redisson
*/
redisson,
/**
* redistemplate
*/
redistemplate
}
public enum HttpClientType {
/**
* HttpClient
*/
HTTP_CLIENT,
/**
* OkHttp
*/
OK_HTTP,
/**
* JoddHttp
*/
JODD_HTTP
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/service/WxChannelMultiServicesImpl.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/service/WxChannelMultiServicesImpl.java | package com.binarywang.spring.starter.wxjava.channel.service;
import me.chanjar.weixin.channel.api.WxChannelService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 视频号 {@link WxChannelMultiServices} 实现
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
public class WxChannelMultiServicesImpl implements WxChannelMultiServices {
private final Map<String, WxChannelService> services = new ConcurrentHashMap<>();
@Override
public WxChannelService getWxChannelService(String tenantId) {
return this.services.get(tenantId);
}
/**
* 根据租户 Id,添加一个 WxChannelService 到列表
*
* @param tenantId 租户 Id
* @param wxChannelService WxChannelService 实例
*/
public void addWxChannelService(String tenantId, WxChannelService wxChannelService) {
this.services.put(tenantId, wxChannelService);
}
@Override
public void removeWxChannelService(String tenantId) {
this.services.remove(tenantId);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/service/WxChannelMultiServices.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/service/WxChannelMultiServices.java | package com.binarywang.spring.starter.wxjava.channel.service;
import me.chanjar.weixin.channel.api.WxChannelService;
/**
* 视频号 {@link WxChannelService} 所有实例存放类.
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
public interface WxChannelMultiServices {
/**
* 通过租户 Id 获取 WxChannelService
*
* @param tenantId 租户 Id
* @return WxChannelService
*/
WxChannelService getWxChannelService(String tenantId);
/**
* 根据租户 Id,从列表中移除一个 WxChannelService 实例
*
* @param tenantId 租户 Id
*/
void removeWxChannelService(String tenantId);
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/WxChannelMultiServiceConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/WxChannelMultiServiceConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration;
import com.binarywang.spring.starter.wxjava.channel.configuration.services.WxChannelInJedisConfiguration;
import com.binarywang.spring.starter.wxjava.channel.configuration.services.WxChannelInMemoryConfiguration;
import com.binarywang.spring.starter.wxjava.channel.configuration.services.WxChannelInRedisTemplateConfiguration;
import com.binarywang.spring.starter.wxjava.channel.configuration.services.WxChannelInRedissonConfiguration;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 微信视频号相关服务自动注册
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@EnableConfigurationProperties(WxChannelMultiProperties.class)
@Import({WxChannelInJedisConfiguration.class, WxChannelInMemoryConfiguration.class, WxChannelInRedissonConfiguration.class, WxChannelInRedisTemplateConfiguration.class})
public class WxChannelMultiServiceConfiguration {}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInRedissonConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInRedissonConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration.services;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import me.chanjar.weixin.channel.config.impl.WxChannelRedissonConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于 redisson 策略配置
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@ConditionalOnProperty(prefix = WxChannelMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redisson")
@RequiredArgsConstructor
public class WxChannelInRedissonConfiguration extends AbstractWxChannelConfiguration {
private final WxChannelMultiProperties wxChannelMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxChannelMultiServices wxChannelMultiServices() {
return this.wxChannelMultiServices(wxChannelMultiProperties);
}
@Override
protected WxChannelDefaultConfigImpl wxChannelConfigStorage(WxChannelMultiProperties wxChannelMultiProperties) {
return this.configRedisson(wxChannelMultiProperties);
}
private WxChannelDefaultConfigImpl configRedisson(WxChannelMultiProperties wxChannelMultiProperties) {
WxChannelMultiRedisProperties redisProperties = wxChannelMultiProperties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient(wxChannelMultiProperties);
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxChannelRedissonConfigImpl(redissonClient, wxChannelMultiProperties.getConfigStorage().getKeyPrefix());
}
private RedissonClient getRedissonClient(WxChannelMultiProperties wxChannelMultiProperties) {
WxChannelMultiProperties.ConfigStorage storage = wxChannelMultiProperties.getConfigStorage();
WxChannelMultiRedisProperties redis = storage.getRedis();
Config config = new Config();
config.useSingleServer().setAddress("redis://" + redis.getHost() + ":" + redis.getPort()).setDatabase(redis.getDatabase()).setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInMemoryConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInMemoryConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration.services;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于内存策略配置
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@ConditionalOnProperty(prefix = WxChannelMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "memory", matchIfMissing = true)
@RequiredArgsConstructor
public class WxChannelInMemoryConfiguration extends AbstractWxChannelConfiguration {
private final WxChannelMultiProperties wxChannelMultiProperties;
@Bean
public WxChannelMultiServices wxChannelMultiServices() {
return this.wxChannelMultiServices(wxChannelMultiProperties);
}
@Override
protected WxChannelDefaultConfigImpl wxChannelConfigStorage(WxChannelMultiProperties wxChannelMultiProperties) {
return this.configInMemory();
}
private WxChannelDefaultConfigImpl configInMemory() {
return new WxChannelDefaultConfigImpl();
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInJedisConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInJedisConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration.services;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiRedisProperties;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import me.chanjar.weixin.channel.config.impl.WxChannelRedisConfigImpl;
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* 自动装配基于 jedis 策略配置
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@ConditionalOnProperty(prefix = WxChannelMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "jedis")
@RequiredArgsConstructor
public class WxChannelInJedisConfiguration extends AbstractWxChannelConfiguration {
private final WxChannelMultiProperties wxChannelMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxChannelMultiServices wxChannelMultiServices() {
return this.wxChannelMultiServices(wxChannelMultiProperties);
}
@Override
protected WxChannelDefaultConfigImpl wxChannelConfigStorage(WxChannelMultiProperties wxChannelMultiProperties) {
return this.configRedis(wxChannelMultiProperties);
}
private WxChannelDefaultConfigImpl configRedis(WxChannelMultiProperties wxChannelMultiProperties) {
WxChannelMultiRedisProperties wxChannelMultiRedisProperties = wxChannelMultiProperties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (wxChannelMultiRedisProperties != null && StringUtils.isNotEmpty(wxChannelMultiRedisProperties.getHost())) {
jedisPool = getJedisPool(wxChannelMultiProperties);
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
return new WxChannelRedisConfigImpl(new JedisWxRedisOps(jedisPool), wxChannelMultiProperties.getConfigStorage().getKeyPrefix());
}
private JedisPool getJedisPool(WxChannelMultiProperties wxChannelMultiProperties) {
WxChannelMultiProperties.ConfigStorage storage = wxChannelMultiProperties.getConfigStorage();
WxChannelMultiRedisProperties redis = storage.getRedis();
JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/AbstractWxChannelConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/AbstractWxChannelConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration.services;
import com.binarywang.spring.starter.wxjava.channel.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelSingleProperties;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServices;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServicesImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.channel.api.WxChannelService;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceHttpClientImpl;
import me.chanjar.weixin.channel.api.impl.WxChannelServiceImpl;
import me.chanjar.weixin.channel.config.WxChannelConfig;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
* WxChannelConfigStorage 抽象配置类
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@RequiredArgsConstructor
@Slf4j
public abstract class AbstractWxChannelConfiguration {
protected WxChannelMultiServices wxChannelMultiServices(WxChannelMultiProperties wxChannelMultiProperties) {
Map<String, WxChannelSingleProperties> appsMap = wxChannelMultiProperties.getApps();
if (appsMap == null || appsMap.isEmpty()) {
log.warn("微信视频号应用参数未配置,通过 WxChannelMultiServices#getWxChannelService(\"tenantId\")获取实例将返回空");
return new WxChannelMultiServicesImpl();
}
/**
* 校验 appId 是否唯一,避免使用 redis 缓存 token、ticket 时错乱。
*
* 查看 {@link me.chanjar.weixin.channel.config.impl.WxChannelRedisConfigImpl#setAppid(String)}
*/
Collection<WxChannelSingleProperties> apps = appsMap.values();
if (apps.size() > 1) {
// 校验 appId 是否唯一
boolean multi = apps.stream()
// 没有 appId,如果不判断是否为空,这里会报 NPE 异常
.collect(Collectors.groupingBy(c -> c.getAppId() == null ? 0 : c.getAppId(), Collectors.counting()))
.entrySet().stream().anyMatch(e -> e.getValue() > 1);
if (multi) {
throw new RuntimeException("请确保微信视频号配置 appId 的唯一性");
}
}
WxChannelMultiServicesImpl services = new WxChannelMultiServicesImpl();
Set<Map.Entry<String, WxChannelSingleProperties>> entries = appsMap.entrySet();
for (Map.Entry<String, WxChannelSingleProperties> entry : entries) {
String tenantId = entry.getKey();
WxChannelSingleProperties wxChannelSingleProperties = entry.getValue();
WxChannelDefaultConfigImpl storage = this.wxChannelConfigStorage(wxChannelMultiProperties);
this.configApp(storage, wxChannelSingleProperties);
this.configHttp(storage, wxChannelMultiProperties.getConfigStorage());
WxChannelService wxChannelService = this.wxChannelService(storage, wxChannelMultiProperties);
services.addWxChannelService(tenantId, wxChannelService);
}
return services;
}
/**
* 配置 WxChannelDefaultConfigImpl
*
* @param wxChannelMultiProperties 参数
* @return WxChannelDefaultConfigImpl
*/
protected abstract WxChannelDefaultConfigImpl wxChannelConfigStorage(WxChannelMultiProperties wxChannelMultiProperties);
public WxChannelService wxChannelService(WxChannelConfig wxChannelConfig, WxChannelMultiProperties wxChannelMultiProperties) {
WxChannelMultiProperties.ConfigStorage storage = wxChannelMultiProperties.getConfigStorage();
HttpClientType httpClientType = storage.getHttpClientType();
WxChannelService wxChannelService;
switch (httpClientType) {
// case OK_HTTP:
// wxChannelService = new WxChannelServiceOkHttpImpl(false, false);
// break;
case HTTP_CLIENT:
wxChannelService = new WxChannelServiceHttpClientImpl();
break;
default:
wxChannelService = new WxChannelServiceImpl();
break;
}
wxChannelService.setConfig(wxChannelConfig);
int maxRetryTimes = storage.getMaxRetryTimes();
if (maxRetryTimes < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = storage.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
wxChannelService.setRetrySleepMillis(retrySleepMillis);
wxChannelService.setMaxRetryTimes(maxRetryTimes);
return wxChannelService;
}
private void configApp(WxChannelDefaultConfigImpl config, WxChannelSingleProperties wxChannelSingleProperties) {
String appId = wxChannelSingleProperties.getAppId();
String appSecret = wxChannelSingleProperties.getSecret();
String token = wxChannelSingleProperties.getToken();
String aesKey = wxChannelSingleProperties.getAesKey();
boolean useStableAccessToken = wxChannelSingleProperties.isUseStableAccessToken();
config.setAppid(appId);
config.setSecret(appSecret);
if (StringUtils.isNotBlank(token)) {
config.setToken(token);
}
if (StringUtils.isNotBlank(aesKey)) {
config.setAesKey(aesKey);
}
config.setStableAccessToken(useStableAccessToken);
config.setApiHostUrl(StringUtils.trimToNull(wxChannelSingleProperties.getApiHostUrl()));
config.setAccessTokenUrl(StringUtils.trimToNull(wxChannelSingleProperties.getAccessTokenUrl()));
}
private void configHttp(WxChannelDefaultConfigImpl config, WxChannelMultiProperties.ConfigStorage storage) {
String httpProxyHost = storage.getHttpProxyHost();
Integer httpProxyPort = storage.getHttpProxyPort();
String httpProxyUsername = storage.getHttpProxyUsername();
String httpProxyPassword = storage.getHttpProxyPassword();
if (StringUtils.isNotBlank(httpProxyHost)) {
config.setHttpProxyHost(httpProxyHost);
if (httpProxyPort != null) {
config.setHttpProxyPort(httpProxyPort);
}
if (StringUtils.isNotBlank(httpProxyUsername)) {
config.setHttpProxyUsername(httpProxyUsername);
}
if (StringUtils.isNotBlank(httpProxyPassword)) {
config.setHttpProxyPassword(httpProxyPassword);
}
}
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInRedisTemplateConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/configuration/services/WxChannelInRedisTemplateConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.configuration.services;
import com.binarywang.spring.starter.wxjava.channel.properties.WxChannelMultiProperties;
import com.binarywang.spring.starter.wxjava.channel.service.WxChannelMultiServices;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.channel.config.impl.WxChannelDefaultConfigImpl;
import me.chanjar.weixin.channel.config.impl.WxChannelRedisConfigImpl;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
* 自动装配基于 redisTemplate 策略配置
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@ConditionalOnProperty(prefix = WxChannelMultiProperties.PREFIX + ".config-storage", name = "type", havingValue = "redis_template")
@RequiredArgsConstructor
public class WxChannelInRedisTemplateConfiguration extends AbstractWxChannelConfiguration {
private final WxChannelMultiProperties wxChannelMultiProperties;
private final ApplicationContext applicationContext;
@Bean
public WxChannelMultiServices wxChannelMultiServices() {
return this.wxChannelMultiServices(wxChannelMultiProperties);
}
@Override
protected WxChannelDefaultConfigImpl wxChannelConfigStorage(WxChannelMultiProperties wxChannelMultiProperties) {
return this.configRedisTemplate(wxChannelMultiProperties);
}
private WxChannelDefaultConfigImpl configRedisTemplate(WxChannelMultiProperties wxChannelMultiProperties) {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
return new WxChannelRedisConfigImpl(new RedisTemplateWxRedisOps(redisTemplate), wxChannelMultiProperties.getConfigStorage().getKeyPrefix());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/autoconfigure/WxChannelMultiAutoConfiguration.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/autoconfigure/WxChannelMultiAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.channel.autoconfigure;
import com.binarywang.spring.starter.wxjava.channel.configuration.WxChannelMultiServiceConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 微信视频号自动注册
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Configuration
@Import(WxChannelMultiServiceConfiguration.class)
public class WxChannelMultiAutoConfiguration {}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelMultiProperties.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelMultiProperties.java | package com.binarywang.spring.starter.wxjava.channel.properties;
import com.binarywang.spring.starter.wxjava.channel.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.channel.enums.StorageType;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* 微信多视频号接入相关配置属性
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Data
@NoArgsConstructor
@ConfigurationProperties(WxChannelMultiProperties.PREFIX)
public class WxChannelMultiProperties implements Serializable {
private static final long serialVersionUID = - 8361973118805546037L;
public static final String PREFIX = "wx.channel";
private Map<String, WxChannelSingleProperties> apps = new HashMap<>();
/**
* 存储策略
*/
private final ConfigStorage configStorage = new ConfigStorage();
@Data
@NoArgsConstructor
public static class ConfigStorage implements Serializable {
private static final long serialVersionUID = - 5152619132544179942L;
/**
* 存储类型.
*/
private StorageType type = StorageType.MEMORY;
/**
* 指定key前缀.
*/
private String keyPrefix = "wx:channel:multi";
/**
* redis连接配置.
*/
@NestedConfigurationProperty
private final WxChannelMultiRedisProperties redis = new WxChannelMultiRedisProperties();
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HTTP_CLIENT;
/**
* http代理主机.
*/
private String httpProxyHost;
/**
* http代理端口.
*/
private Integer httpProxyPort;
/**
* http代理用户名.
*/
private String httpProxyUsername;
/**
* http代理密码.
*/
private String httpProxyPassword;
/**
* http 请求最大重试次数
*
* <p>{@link me.chanjar.weixin.channel.api.WxChannelService#setMaxRetryTimes(int)}</p>
* <p>{@link me.chanjar.weixin.channel.api.impl.BaseWxChannelServiceImpl#setMaxRetryTimes(int)}</p>
*/
private int maxRetryTimes = 5;
/**
* http 请求重试间隔
*
* <p>{@link me.chanjar.weixin.channel.api.WxChannelService#setRetrySleepMillis(int)}</p>
* <p>{@link me.chanjar.weixin.channel.api.impl.BaseWxChannelServiceImpl#setRetrySleepMillis(int)}</p>
*/
private int retrySleepMillis = 1000;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelSingleProperties.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelSingleProperties.java | package com.binarywang.spring.starter.wxjava.channel.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* 微信视频号相关配置属性
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Data
@NoArgsConstructor
public class WxChannelSingleProperties implements Serializable {
private static final long serialVersionUID = 5306630351265124825L;
/**
* 设置微信视频号的 appid.
*/
private String appId;
/**
* 设置微信视频号的 secret.
*/
private String secret;
/**
* 设置微信视频号的 token.
*/
private String token;
/**
* 设置微信视频号的 EncodingAESKey.
*/
private String aesKey;
/**
* 是否使用稳定版 Access Token
*/
private boolean useStableAccessToken = false;
/**
* 自定义API主机地址,用于替换默认的 https://api.weixin.qq.com
* 例如:http://proxy.company.com:8080
*/
private String apiHostUrl;
/**
* 自定义获取AccessToken地址,用于向自定义统一服务获取AccessToken
* 例如:http://proxy.company.com:8080/oauth/token
*/
private String accessTokenUrl;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelMultiRedisProperties.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/properties/WxChannelMultiRedisProperties.java | package com.binarywang.spring.starter.wxjava.channel.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* Redis配置
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
@Data
@NoArgsConstructor
public class WxChannelMultiRedisProperties implements Serializable {
private static final long serialVersionUID = 9061055444734277357L;
/**
* 主机地址.
*/
private String host = "127.0.0.1";
/**
* 端口号.
*/
private int port = 6379;
/**
* 密码.
*/
private String password;
/**
* 超时.
*/
private int timeout = 2000;
/**
* 数据库.
*/
private int database = 0;
/**
* 最大活动连接数
*/
private Integer maxActive;
/**
* 最大空闲连接数
*/
private Integer maxIdle;
/**
* 最小空闲连接数
*/
private Integer minIdle;
/**
* 最大等待时间
*/
private Integer maxWaitMillis;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/HttpClientType.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/HttpClientType.java | package com.binarywang.spring.starter.wxjava.channel.enums;
/**
* httpclient类型
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
public enum HttpClientType {
/**
* HttpClient
*/
HTTP_CLIENT,
// WxChannelServiceOkHttpImpl 实现经测试无法正常完成业务固暂不支持OK_HTTP方式
// /**
// * OkHttp.
// */
// OK_HTTP,
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/StorageType.java | spring-boot-starters/wx-java-channel-multi-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/channel/enums/StorageType.java | package com.binarywang.spring.starter.wxjava.channel.enums;
/**
* storage类型
*
* @author <a href="https://github.com/Winnie-by996">Winnie</a>
* @date 2024/9/13
*/
public enum StorageType {
/**
* 内存
*/
MEMORY,
/**
* redis(JedisClient)
*/
JEDIS,
/**
* redis(Redisson)
*/
REDISSON,
/**
* redis(RedisTemplate)
*/
REDIS_TEMPLATE
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInRedissonConfigStorageConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInRedissonConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.storage;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpRedisProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpRedissonConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于 redisson 策略配置
*
* @author yl
* created on 2023/04/23
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpProperties.PREFIX + ".config-storage", name = "type", havingValue = "redisson"
)
@RequiredArgsConstructor
public class WxCpInRedissonConfigStorageConfiguration extends AbstractWxCpConfigStorageConfiguration {
private final WxCpProperties wxCpProperties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxCpConfigStorage.class)
public WxCpConfigStorage wxCpConfigStorage() {
WxCpDefaultConfigImpl config = getConfigStorage();
return this.config(config, wxCpProperties);
}
private WxCpRedissonConfigImpl getConfigStorage() {
WxCpRedisProperties redisProperties = wxCpProperties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient();
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxCpRedissonConfigImpl(redissonClient, wxCpProperties.getConfigStorage().getKeyPrefix());
}
private RedissonClient getRedissonClient() {
WxCpProperties.ConfigStorage storage = wxCpProperties.getConfigStorage();
WxCpRedisProperties redis = storage.getRedis();
Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
.setDatabase(redis.getDatabase())
.setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInRedisTemplateConfigStorageConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInRedisTemplateConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.storage;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpRedisTemplateConfigImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
* 自动装配基于 redisTemplate 策略配置
*
* @author yl
* created on 2023/04/23
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpProperties.PREFIX + ".config-storage", name = "type", havingValue = "redistemplate"
)
@RequiredArgsConstructor
public class WxCpInRedisTemplateConfigStorageConfiguration extends AbstractWxCpConfigStorageConfiguration {
private final WxCpProperties wxCpProperties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxCpConfigStorage.class)
public WxCpConfigStorage wxCpConfigStorage() {
WxCpDefaultConfigImpl config = getConfigStorage();
return this.config(config, wxCpProperties);
}
private WxCpRedisTemplateConfigImpl getConfigStorage() {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
return new WxCpRedisTemplateConfigImpl(redisTemplate, wxCpProperties.getConfigStorage().getKeyPrefix());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInMemoryConfigStorageConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInMemoryConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.storage;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 自动装配基于内存策略配置
*
* @author yl
* created on 2021/12/6
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpProperties.PREFIX + ".config-storage", name = "type",
matchIfMissing = true, havingValue = "memory"
)
@RequiredArgsConstructor
public class WxCpInMemoryConfigStorageConfiguration extends AbstractWxCpConfigStorageConfiguration {
private final WxCpProperties wxCpProperties;
@Bean
@ConditionalOnMissingBean(WxCpConfigStorage.class)
public WxCpConfigStorage wxCpConfigStorage() {
WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
return this.config(config, wxCpProperties);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/AbstractWxCpConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.storage;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import org.apache.commons.lang3.StringUtils;
/**
* WxCpConfigStorage 抽象配置类
*
* @author yl & Wang_Wong
* created on 2021/12/6
*/
public abstract class AbstractWxCpConfigStorageConfiguration {
protected WxCpDefaultConfigImpl config(WxCpDefaultConfigImpl config, WxCpProperties properties) {
String corpId = properties.getCorpId();
String corpSecret = properties.getCorpSecret();
Integer agentId = properties.getAgentId();
String token = properties.getToken();
String aesKey = properties.getAesKey();
// 企业微信,私钥,会话存档路径
String msgAuditPriKey = properties.getMsgAuditPriKey();
String msgAuditLibPath = properties.getMsgAuditLibPath();
config.setCorpId(corpId);
config.setCorpSecret(corpSecret);
config.setAgentId(agentId);
if (StringUtils.isNotBlank(token)) {
config.setToken(token);
}
if (StringUtils.isNotBlank(aesKey)) {
config.setAesKey(aesKey);
}
if (StringUtils.isNotBlank(msgAuditPriKey)) {
config.setMsgAuditPriKey(msgAuditPriKey);
}
if (StringUtils.isNotBlank(msgAuditLibPath)) {
config.setMsgAuditLibPath(msgAuditLibPath);
}
if (StringUtils.isNotBlank(properties.getBaseApiUrl())) {
config.setBaseApiUrl(properties.getBaseApiUrl());
}
WxCpProperties.ConfigStorage storage = properties.getConfigStorage();
String httpProxyHost = storage.getHttpProxyHost();
Integer httpProxyPort = storage.getHttpProxyPort();
String httpProxyUsername = storage.getHttpProxyUsername();
String httpProxyPassword = storage.getHttpProxyPassword();
if (StringUtils.isNotBlank(httpProxyHost)) {
config.setHttpProxyHost(httpProxyHost);
if (httpProxyPort != null) {
config.setHttpProxyPort(httpProxyPort);
}
if (StringUtils.isNotBlank(httpProxyUsername)) {
config.setHttpProxyUsername(httpProxyUsername);
}
if (StringUtils.isNotBlank(httpProxyPassword)) {
config.setHttpProxyPassword(httpProxyPassword);
}
}
return config;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInJedisConfigStorageConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/storage/WxCpInJedisConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.storage;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpRedisProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.chanjar.weixin.cp.config.impl.WxCpJedisConfigImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* 自动装配基于 jedis 策略配置
*
* @author yl
* created on 2023/04/23
*/
@Configuration
@ConditionalOnProperty(
prefix = WxCpProperties.PREFIX + ".config-storage", name = "type", havingValue = "jedis"
)
@RequiredArgsConstructor
public class WxCpInJedisConfigStorageConfiguration extends AbstractWxCpConfigStorageConfiguration {
private final WxCpProperties wxCpProperties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxCpConfigStorage.class)
public WxCpConfigStorage wxCpConfigStorage() {
WxCpDefaultConfigImpl config = getConfigStorage();
return this.config(config, wxCpProperties);
}
private WxCpJedisConfigImpl getConfigStorage() {
WxCpRedisProperties wxCpRedisProperties = wxCpProperties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (wxCpRedisProperties != null && StringUtils.isNotEmpty(wxCpRedisProperties.getHost())) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
return new WxCpJedisConfigImpl(jedisPool, wxCpProperties.getConfigStorage().getKeyPrefix());
}
private JedisPool getJedisPool() {
WxCpProperties.ConfigStorage storage = wxCpProperties.getConfigStorage();
WxCpRedisProperties redis = storage.getRedis();
JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
return new JedisPool(config, redis.getHost(), redis.getPort(),
redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpProperties.java | package com.binarywang.spring.starter.wxjava.cp.properties;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import java.io.Serializable;
/**
* 企业微信接入相关配置属性
*
* @author yl
* created on 2021/12/6
*/
@Data
@NoArgsConstructor
@ConfigurationProperties(prefix = WxCpProperties.PREFIX)
public class WxCpProperties {
public static final String PREFIX = "wx.cp";
/**
* 微信企业号 corpId
*/
private String corpId;
/**
* 微信企业号 corpSecret
*/
private String corpSecret;
/**
* 微信企业号应用 token
*/
private String token;
/**
* 微信企业号应用 ID
*/
private Integer agentId;
/**
* 微信企业号应用 EncodingAESKey
*/
private String aesKey;
/**
* 微信企业号应用 会话存档私钥
*/
private String msgAuditPriKey;
/**
* 微信企业号应用 会话存档类库路径
*/
private String msgAuditLibPath;
/**
* 自定义企业微信服务器baseUrl,用于替换默认的 https://qyapi.weixin.qq.com
* 例如:http://proxy.company.com:8080
*/
private String baseApiUrl;
/**
* 配置存储策略,默认内存
*/
private ConfigStorage configStorage = new ConfigStorage();
@Data
@NoArgsConstructor
public static class ConfigStorage implements Serializable {
private static final long serialVersionUID = 4815731027000065434L;
/**
* 存储类型
*/
private StorageType type = StorageType.memory;
/**
* 指定key前缀
*/
private String keyPrefix = "wx:cp";
/**
* redis连接配置
*/
@NestedConfigurationProperty
private WxCpRedisProperties redis = new WxCpRedisProperties();
/**
* http代理主机
*/
private String httpProxyHost;
/**
* http代理端口
*/
private Integer httpProxyPort;
/**
* http代理用户名
*/
private String httpProxyUsername;
/**
* http代理密码
*/
private String httpProxyPassword;
/**
* http 请求最大重试次数
* <pre>
* {@link me.chanjar.weixin.cp.api.WxCpService#setMaxRetryTimes(int)}
* {@link me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl#setMaxRetryTimes(int)}
* </pre>
*/
private int maxRetryTimes = 5;
/**
* http 请求重试间隔
* <pre>
* {@link me.chanjar.weixin.cp.api.WxCpService#setRetrySleepMillis(int)}
* {@link me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl#setRetrySleepMillis(int)}
* </pre>
*/
private int retrySleepMillis = 1000;
}
public enum StorageType {
/**
* 内存
*/
memory,
/**
* jedis
*/
jedis,
/**
* redisson
*/
redisson,
/**
* redistemplate
*/
redistemplate
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpRedisProperties.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/properties/WxCpRedisProperties.java | package com.binarywang.spring.starter.wxjava.cp.properties;
import lombok.Data;
import java.io.Serializable;
/**
* Redis配置.
*
* @author yl
* created on 2023/04/23
*/
@Data
public class WxCpRedisProperties implements Serializable {
private static final long serialVersionUID = -5924815351660074401L;
/**
* 主机地址.
*/
private String host;
/**
* 端口号.
*/
private int port = 6379;
/**
* 密码.
*/
private String password;
/**
* 超时.
*/
private int timeout = 2000;
/**
* 数据库.
*/
private int database = 0;
private Integer maxActive;
private Integer maxIdle;
private Integer maxWaitMillis;
private Integer minIdle;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpStorageAutoConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpStorageAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.config;
import com.binarywang.spring.starter.wxjava.cp.storage.WxCpInJedisConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.cp.storage.WxCpInMemoryConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.cp.storage.WxCpInRedisTemplateConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.cp.storage.WxCpInRedissonConfigStorageConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 企业微信存储策略自动配置
*
* @author yl
* created on 2021/12/6
*/
@Configuration
@Import({
WxCpInMemoryConfigStorageConfiguration.class,
WxCpInJedisConfigStorageConfiguration.class,
WxCpInRedissonConfigStorageConfiguration.class,
WxCpInRedisTemplateConfigStorageConfiguration.class
})
public class WxCpStorageAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpAutoConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.config;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 企业微信自动注册
*
* @author yl
* created on 2021/12/6
*/
@Configuration
@EnableConfigurationProperties(WxCpProperties.class)
@Import({
WxCpStorageAutoConfiguration.class,
WxCpServiceAutoConfiguration.class
})
public class WxCpAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpServiceAutoConfiguration.java | spring-boot-starters/wx-java-cp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/cp/config/WxCpServiceAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.cp.config;
import com.binarywang.spring.starter.wxjava.cp.properties.WxCpProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
import me.chanjar.weixin.cp.config.WxCpConfigStorage;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 企业微信平台相关服务自动注册
*
* @author yl
* created on 2021/12/6
*/
@Configuration
@RequiredArgsConstructor
public class WxCpServiceAutoConfiguration {
private final WxCpProperties wxCpProperties;
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(WxCpConfigStorage.class)
public WxCpService wxCpService(WxCpConfigStorage wxCpConfigStorage) {
WxCpService wxCpService = new WxCpServiceImpl();
wxCpService.setWxCpConfigStorage(wxCpConfigStorage);
WxCpProperties.ConfigStorage storage = wxCpProperties.getConfigStorage();
int maxRetryTimes = storage.getMaxRetryTimes();
if (maxRetryTimes < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = storage.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
wxCpService.setRetrySleepMillis(retrySleepMillis);
wxCpService.setMaxRetryTimes(maxRetryTimes);
return wxCpService;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/RedisProperties.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/RedisProperties.java | package com.binarywang.spring.starter.wxjava.miniapp.properties;
import lombok.Data;
/**
* redis 配置.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-08-30
*/
@Data
public class RedisProperties {
/**
* 主机地址.不填则从spring容器内获取JedisPool
*/
private String host;
/**
* 端口号.
*/
private int port = 6379;
/**
* 密码.
*/
private String password;
/**
* 超时.
*/
private int timeout = 2000;
/**
* 数据库.
*/
private int database = 0;
private Integer maxActive;
private Integer maxIdle;
private Integer maxWaitMillis;
private Integer minIdle;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaProperties.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/properties/WxMaProperties.java | package com.binarywang.spring.starter.wxjava.miniapp.properties;
import com.binarywang.spring.starter.wxjava.miniapp.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.miniapp.enums.StorageType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import static com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties.PREFIX;
/**
* 属性配置类.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2019-08-10
*/
@Data
@ConfigurationProperties(prefix = PREFIX)
public class WxMaProperties {
public static final String PREFIX = "wx.miniapp";
/**
* 设置微信小程序的appid.
*/
private String appid;
/**
* 设置微信小程序的Secret.
*/
private String secret;
/**
* 设置微信小程序消息服务器配置的token.
*/
private String token;
/**
* 设置微信小程序消息服务器配置的EncodingAESKey.
*/
private String aesKey;
/**
* 消息格式,XML或者JSON.
*/
private String msgDataFormat;
/**
* 是否使用稳定版 Access Token
*/
private boolean useStableAccessToken = false;
/**
* 自定义API主机地址,用于替换默认的 https://api.weixin.qq.com
* 例如:http://proxy.company.com:8080
*/
private String apiHostUrl;
/**
* 自定义获取AccessToken地址,用于向自定义统一服务获取AccessToken
* 例如:http://proxy.company.com:8080/oauth/token
*/
private String accessTokenUrl;
/**
* 存储策略
*/
private final ConfigStorage configStorage = new ConfigStorage();
@Data
public static class ConfigStorage {
/**
* 存储类型.
*/
private StorageType type = StorageType.Memory;
/**
* 指定key前缀.
*/
private String keyPrefix = "wa";
/**
* redis连接配置.
*/
@NestedConfigurationProperty
private final RedisProperties redis = new RedisProperties();
/**
* http客户端类型.
*/
private HttpClientType httpClientType = HttpClientType.HttpClient;
/**
* http代理主机.
*/
private String httpProxyHost;
/**
* http代理端口.
*/
private Integer httpProxyPort;
/**
* http代理用户名.
*/
private String httpProxyUsername;
/**
* http代理密码.
*/
private String httpProxyPassword;
/**
* http 请求重试间隔
* <pre>
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setRetrySleepMillis(int)}
* </pre>
*/
private int retrySleepMillis = 1000;
/**
* http 请求最大重试次数
* <pre>
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setMaxRetryTimes(int)}
* </pre>
*/
private int maxRetryTimes = 5;
/**
* 连接超时时间,单位毫秒
*/
private int connectionTimeout = 5000;
/**
* 读数据超时时间,即socketTimeout,单位毫秒
*/
private int soTimeout = 5000;
/**
* 从连接池获取链接的超时时间,单位毫秒
*/
private int connectionRequestTimeout = 5000;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaAutoConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 自动配置.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2019-08-10
*/
@Configuration
@EnableConfigurationProperties(WxMaProperties.class)
@Import({
WxMaStorageAutoConfiguration.class,
WxMaServiceAutoConfiguration.class
})
public class WxMaAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaServiceAutoConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaServiceAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceHttpClientImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceJoddHttpImpl;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceOkHttpImpl;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import com.binarywang.spring.starter.wxjava.miniapp.enums.HttpClientType;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 微信小程序平台相关服务自动注册.
*
* @author someone TaoYu
*/
@Configuration
@AllArgsConstructor
public class WxMaServiceAutoConfiguration {
private final WxMaProperties wxMaProperties;
/**
* 小程序service.
*
* @return 小程序service
*/
@Bean
@ConditionalOnMissingBean(WxMaService.class)
@ConditionalOnBean(WxMaConfig.class)
public WxMaService wxMaService(WxMaConfig wxMaConfig) {
HttpClientType httpClientType = wxMaProperties.getConfigStorage().getHttpClientType();
WxMaService wxMaService;
switch (httpClientType) {
case OkHttp:
wxMaService = new WxMaServiceOkHttpImpl();
break;
case JoddHttp:
wxMaService = new WxMaServiceJoddHttpImpl();
break;
case HttpClient:
wxMaService = new WxMaServiceHttpClientImpl();
break;
default:
wxMaService = new WxMaServiceImpl();
break;
}
wxMaService.setWxMaConfig(wxMaConfig);
return wxMaService;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaStorageAutoConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/WxMaStorageAutoConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config;
import com.binarywang.spring.starter.wxjava.miniapp.config.storage.WxMaInJedisConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.config.storage.WxMaInMemoryConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.config.storage.WxMaInRedisTemplateConfigStorageConfiguration;
import com.binarywang.spring.starter.wxjava.miniapp.config.storage.WxMaInRedissonConfigStorageConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/**
* 微信小程序存储策略自动配置.
*
* @author someone TaoYu
*/
@Configuration
@Import({
WxMaInMemoryConfigStorageConfiguration.class,
WxMaInJedisConfigStorageConfiguration.class,
WxMaInRedisTemplateConfigStorageConfiguration.class,
WxMaInRedissonConfigStorageConfiguration.class
})
public class WxMaStorageAutoConfiguration {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/AbstractWxMaConfigStorageConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/AbstractWxMaConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder;
import org.apache.commons.lang3.StringUtils;
/**
* @author yl TaoYu
*/
public abstract class AbstractWxMaConfigStorageConfiguration {
protected WxMaDefaultConfigImpl config(WxMaDefaultConfigImpl config, WxMaProperties properties) {
WxMaProperties.ConfigStorage storage = properties.getConfigStorage();
config.setAppid(StringUtils.trimToNull(properties.getAppid()));
config.setSecret(StringUtils.trimToNull(properties.getSecret()));
config.setToken(StringUtils.trimToNull(properties.getToken()));
config.setAesKey(StringUtils.trimToNull(properties.getAesKey()));
config.setMsgDataFormat(StringUtils.trimToNull(properties.getMsgDataFormat()));
config.useStableAccessToken(properties.isUseStableAccessToken());
config.setApiHostUrl(StringUtils.trimToNull(properties.getApiHostUrl()));
config.setAccessTokenUrl(StringUtils.trimToNull(properties.getAccessTokenUrl()));
WxMaProperties.ConfigStorage configStorageProperties = properties.getConfigStorage();
config.setHttpProxyHost(configStorageProperties.getHttpProxyHost());
config.setHttpProxyUsername(configStorageProperties.getHttpProxyUsername());
config.setHttpProxyPassword(configStorageProperties.getHttpProxyPassword());
if (configStorageProperties.getHttpProxyPort() != null) {
config.setHttpProxyPort(configStorageProperties.getHttpProxyPort());
}
// 设置自定义的HttpClient超时配置
ApacheHttpClientBuilder clientBuilder = config.getApacheHttpClientBuilder();
if (clientBuilder == null) {
clientBuilder = DefaultApacheHttpClientBuilder.get();
}
if (clientBuilder instanceof DefaultApacheHttpClientBuilder) {
DefaultApacheHttpClientBuilder defaultBuilder = (DefaultApacheHttpClientBuilder) clientBuilder;
defaultBuilder.setConnectionTimeout(storage.getConnectionTimeout());
defaultBuilder.setSoTimeout(storage.getSoTimeout());
defaultBuilder.setConnectionRequestTimeout(storage.getConnectionRequestTimeout());
config.setApacheHttpClientBuilder(defaultBuilder);
}
int maxRetryTimes = configStorageProperties.getMaxRetryTimes();
if (configStorageProperties.getMaxRetryTimes() < 0) {
maxRetryTimes = 0;
}
int retrySleepMillis = configStorageProperties.getRetrySleepMillis();
if (retrySleepMillis < 0) {
retrySleepMillis = 1000;
}
config.setRetrySleepMillis(retrySleepMillis);
config.setMaxRetryTimes(maxRetryTimes);
return config;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInMemoryConfigStorageConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInMemoryConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author yl TaoYu
*/
@Configuration
@ConditionalOnProperty(prefix = WxMaProperties.PREFIX + ".config-storage", name = "type",
matchIfMissing = true, havingValue = "memory")
@RequiredArgsConstructor
public class WxMaInMemoryConfigStorageConfiguration extends AbstractWxMaConfigStorageConfiguration {
private final WxMaProperties properties;
@Bean
@ConditionalOnMissingBean(WxMaConfig.class)
public WxMaConfig wxMaConfig() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
return this.config(config, properties);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInRedisTemplateConfigStorageConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInRedisTemplateConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.redis.RedisTemplateWxRedisOps;
import me.chanjar.weixin.common.redis.WxRedisOps;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
* @author yl TaoYu
*/
@Configuration
@ConditionalOnProperty(prefix = WxMaProperties.PREFIX + ".config-storage", name = "type", havingValue = "redistemplate")
@ConditionalOnClass(StringRedisTemplate.class)
@RequiredArgsConstructor
public class WxMaInRedisTemplateConfigStorageConfiguration extends AbstractWxMaConfigStorageConfiguration {
private final WxMaProperties properties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxMaConfig.class)
public WxMaConfig wxMaConfig() {
WxMaRedisBetterConfigImpl config = getWxMaInRedisTemplateConfigStorage();
return this.config(config, properties);
}
private WxMaRedisBetterConfigImpl getWxMaInRedisTemplateConfigStorage() {
StringRedisTemplate redisTemplate = applicationContext.getBean(StringRedisTemplate.class);
WxRedisOps redisOps = new RedisTemplateWxRedisOps(redisTemplate);
return new WxMaRedisBetterConfigImpl(redisOps, properties.getConfigStorage().getKeyPrefix());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInJedisConfigStorageConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInJedisConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedisBetterConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.RedisProperties;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.common.redis.JedisWxRedisOps;
import me.chanjar.weixin.common.redis.WxRedisOps;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
* @author yl TaoYu
*/
@Configuration
@ConditionalOnProperty(prefix = WxMaProperties.PREFIX + ".config-storage", name = "type", havingValue = "jedis")
@ConditionalOnClass({JedisPool.class, JedisPoolConfig.class})
@RequiredArgsConstructor
public class WxMaInJedisConfigStorageConfiguration extends AbstractWxMaConfigStorageConfiguration {
private final WxMaProperties properties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxMaConfig.class)
public WxMaConfig wxMaConfig() {
WxMaRedisBetterConfigImpl config = getWxMaRedisBetterConfigImpl();
return this.config(config, properties);
}
private WxMaRedisBetterConfigImpl getWxMaRedisBetterConfigImpl() {
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
JedisPool jedisPool;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
jedisPool = getJedisPool();
} else {
jedisPool = applicationContext.getBean(JedisPool.class);
}
WxRedisOps redisOps = new JedisWxRedisOps(jedisPool);
return new WxMaRedisBetterConfigImpl(redisOps, properties.getConfigStorage().getKeyPrefix());
}
private JedisPool getJedisPool() {
WxMaProperties.ConfigStorage storage = properties.getConfigStorage();
RedisProperties redis = storage.getRedis();
JedisPoolConfig config = new JedisPoolConfig();
if (redis.getMaxActive() != null) {
config.setMaxTotal(redis.getMaxActive());
}
if (redis.getMaxIdle() != null) {
config.setMaxIdle(redis.getMaxIdle());
}
if (redis.getMaxWaitMillis() != null) {
config.setMaxWaitMillis(redis.getMaxWaitMillis());
}
if (redis.getMinIdle() != null) {
config.setMinIdle(redis.getMinIdle());
}
config.setTestOnBorrow(true);
config.setTestWhileIdle(true);
return new JedisPool(config, redis.getHost(), redis.getPort(), redis.getTimeout(), redis.getPassword(), redis.getDatabase());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInRedissonConfigStorageConfiguration.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/config/storage/WxMaInRedissonConfigStorageConfiguration.java | package com.binarywang.spring.starter.wxjava.miniapp.config.storage;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.impl.WxMaRedissonConfigImpl;
import com.binarywang.spring.starter.wxjava.miniapp.properties.RedisProperties;
import com.binarywang.spring.starter.wxjava.miniapp.properties.WxMaProperties;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.redisson.config.TransportMode;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author yl TaoYu
*/
@Configuration
@ConditionalOnProperty(prefix = WxMaProperties.PREFIX + ".config-storage", name = "type", havingValue = "redisson")
@ConditionalOnClass({Redisson.class, RedissonClient.class})
@RequiredArgsConstructor
public class WxMaInRedissonConfigStorageConfiguration extends AbstractWxMaConfigStorageConfiguration {
private final WxMaProperties properties;
private final ApplicationContext applicationContext;
@Bean
@ConditionalOnMissingBean(WxMaConfig.class)
public WxMaConfig wxMaConfig() {
WxMaRedissonConfigImpl config = getWxMaInRedissonConfigStorage();
return this.config(config, properties);
}
private WxMaRedissonConfigImpl getWxMaInRedissonConfigStorage() {
RedisProperties redisProperties = properties.getConfigStorage().getRedis();
RedissonClient redissonClient;
if (redisProperties != null && StringUtils.isNotEmpty(redisProperties.getHost())) {
redissonClient = getRedissonClient();
} else {
redissonClient = applicationContext.getBean(RedissonClient.class);
}
return new WxMaRedissonConfigImpl(redissonClient, properties.getConfigStorage().getKeyPrefix());
}
private RedissonClient getRedissonClient() {
WxMaProperties.ConfigStorage storage = properties.getConfigStorage();
RedisProperties redis = storage.getRedis();
Config config = new Config();
config.useSingleServer()
.setAddress("redis://" + redis.getHost() + ":" + redis.getPort())
.setDatabase(redis.getDatabase())
.setPassword(redis.getPassword());
config.setTransportMode(TransportMode.NIO);
return Redisson.create(config);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/enums/HttpClientType.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/enums/HttpClientType.java | package com.binarywang.spring.starter.wxjava.miniapp.enums;
/**
* httpclient类型.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-05-25
*/
public enum HttpClientType {
/**
* HttpClient.
*/
HttpClient,
/**
* OkHttp.
*/
OkHttp,
/**
* JoddHttp.
*/
JoddHttp,
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/enums/StorageType.java | spring-boot-starters/wx-java-miniapp-spring-boot-starter/src/main/java/com/binarywang/spring/starter/wxjava/miniapp/enums/StorageType.java | package com.binarywang.spring.starter.wxjava.miniapp.enums;
/**
* storage类型.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-05-25
*/
public enum StorageType {
/**
* 内存.
*/
Memory,
/**
* redis(JedisClient).
*/
Jedis,
/**
* redis(Redisson).
*/
Redisson,
/**
* redis(RedisTemplate).
*/
RedisTemplate
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/test/ApiTestModule.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/test/ApiTestModule.java | package me.chanjar.weixin.open.test;
import com.google.inject.Binder;
import com.google.inject.Module;
import com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.error.WxRuntimeException;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.api.WxOpenMaService;
import me.chanjar.weixin.open.api.WxOpenMpService;
import me.chanjar.weixin.open.api.WxOpenService;
import me.chanjar.weixin.open.api.impl.WxOpenServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.InputStream;
public class ApiTestModule implements Module {
private final Logger log = LoggerFactory.getLogger(this.getClass());
private static final String TEST_CONFIG_XML = "test-config.xml";
@Override
public void configure(Binder binder) {
try (InputStream inputStream = ClassLoader.getSystemResourceAsStream(TEST_CONFIG_XML)) {
if (inputStream == null) {
throw new WxRuntimeException("测试配置文件【" + TEST_CONFIG_XML + "】未找到,请参照test-config-sample.xml文件生成");
}
TestConfigStorage config = this.fromXml(TestConfigStorage.class, inputStream);
WxOpenService service = new WxOpenServiceImpl();
service.setWxOpenConfigStorage(config);
binder.bind(TestConfigStorage.class).toInstance(config);
binder.bind(WxOpenService.class).toInstance(service);
binder.bind(WxOpenComponentService.class).toInstance(service.getWxOpenComponentService());
if (config.getTestMpAppId() != null && !config.getTestMpAppId().isEmpty()) {
//如果配置了测试公众号,则构建公众号服务依赖
binder.bind(WxOpenMpService.class).toInstance(service.getWxOpenComponentService().getWxMpServiceByAppid(config.getTestMpAppId()));
} else {
log.warn("建议参照参照 test-config-sample.xml 配置测试公众号");
}
if (config.getTestMaAppId() != null && !config.getTestMaAppId().isEmpty()) {
//如果配置了测试小程序,则构建小程序服务依赖
binder.bind(WxOpenMaService.class).toInstance(service.getWxOpenComponentService().getWxMaServiceByAppid(config.getTestMaAppId()));
} else {
log.warn("建议参照参照 test-config-sample.xml 配置测试小程序");
}
} catch (IOException e) {
this.log.error(e.getMessage(), e);
}
}
@SuppressWarnings("unchecked")
private <T> T fromXml(Class<T> clazz, InputStream is) {
XStream xstream = XStreamInitializer.getInstance();
xstream.alias("xml", clazz);
xstream.processAnnotations(clazz);
return (T) xstream.fromXML(is);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/test/TestConfigStorage.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/test/TestConfigStorage.java | package me.chanjar.weixin.open.test;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.Getter;
import lombok.Setter;
import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage;
@Getter
@Setter
@XStreamAlias("xml")
public class TestConfigStorage extends WxOpenInMemoryConfigStorage {
private String testMpAppId;
private String testMaAppId;
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenComponentServiceImplTest.java | package me.chanjar.weixin.open.api.impl;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.api.WxOpenComponentService;
import me.chanjar.weixin.open.bean.result.WxOpenHaveResult;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvRequest;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvResponse;
import me.chanjar.weixin.open.bean.tcbComponent.GetShareCloudBaseEnvResponse;
import me.chanjar.weixin.open.bean.tcbComponent.GetTcbEnvListResponse;
import me.chanjar.weixin.open.test.ApiTestModule;
import org.testng.Assert;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.Arrays;
/**
* 单元测试类.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-06-06
*/
@Guice(modules = ApiTestModule.class)
public class WxOpenComponentServiceImplTest {
@Inject
WxOpenComponentService wxOpenComponentService;
@Test
public void testGetWxMpServiceByAppid() {
}
@Test
public void testGetWxMaServiceByAppid() {
}
@Test
public void testGetWxFastMaServiceByAppid() {
}
@Test
public void testGetWxOpenService() {
}
@Test
public void testGetWxOpenConfigStorage() {
}
@Test
public void testCheckSignature() {
}
@Test
public void testGetComponentAccessToken() {
}
@Test
public void testPost() {
}
@Test
public void testTestPost() {
}
@Test
public void testGet() {
}
@Test
public void testTestGet() {
}
@Test
public void testGetPreAuthUrl() {
}
@Test
public void testTestGetPreAuthUrl() {
}
@Test
public void testGetMobilePreAuthUrl() {
}
@Test
public void testTestGetMobilePreAuthUrl() {
}
@Test
public void testRoute() {
}
@Test
public void testGetQueryAuth() {
}
@Test
public void testGetAuthorizerInfo() {
}
@Test
public void testGetAuthorizerList() {
}
@Test
public void testGetAuthorizerOption() {
}
@Test
public void testSetAuthorizerOption() {
}
@Test
public void testGetAuthorizerAccessToken() {
}
@Test
public void testOauth2getAccessToken() {
}
@Test
public void testTestCheckSignature() {
}
@Test
public void testOauth2refreshAccessToken() {
}
@Test
public void testOauth2buildAuthorizationUrl() {
}
@Test
public void testMiniappJscode2Session() {
}
@Test
public void testGetTemplateDraftList() {
}
@Test
public void testGetTemplateList() {
}
@Test
public void testAddToTemplate() {
}
@Test
public void testDeleteTemplate() {
}
@Test
public void testCreateOpenAccount() {
}
@Test
public void testBindOpenAccount() {
}
@Test
public void testUnbindOpenAccount() {
}
@Test
public void testGetOpenAccount() {
}
@Test
public void testHaveOpen() throws WxErrorException {
WxOpenHaveResult wxOpenHaveResult = wxOpenComponentService.haveOpen();
Assert.assertNotNull(wxOpenHaveResult);
}
@Test
public void testFastRegisterWeapp() {
}
@Test
public void testFastRegisterWeappSearch() {
}
@Test
public void testStartPushTicket() throws WxErrorException {
wxOpenComponentService.startPushTicket();
}
@Test
public void testGetShareCloudBaseEnv() throws WxErrorException {
GetShareCloudBaseEnvResponse response = wxOpenComponentService.getShareCloudBaseEnv(Arrays.asList("wxad2ee6fa2df2c46d"));
Assert.assertNotNull(response);
}
@Test
public void testGetTcbEnvListv() throws WxErrorException {
GetTcbEnvListResponse response = wxOpenComponentService.getTcbEnvList();
Assert.assertNotNull(response);
}
@Test
public void testChangeTcbEnv() throws WxErrorException {
WxOpenResult response = wxOpenComponentService.changeTcbEnv("test");
Assert.assertNotNull(response);
}
@Test
public void testShareCloudBaseEnv() throws WxErrorException {
ShareCloudBaseEnvRequest request = ShareCloudBaseEnvRequest.builder()
.data(Arrays.asList(ShareCloudBaseEnvRequest.DataDTO.builder()
.env("test-env-6gni9ity244a6ea3").appids(Arrays.asList("wx5fe6bb43205e9e07")).build()))
.build();
ShareCloudBaseEnvResponse response = wxOpenComponentService.shareCloudBaseEnv(request);
Assert.assertNotNull(response);
}
@Test
public void testClearQuotaV2() throws WxErrorException {
WxOpenResult wxOpenResult = wxOpenComponentService.clearQuotaV2("");
Assert.assertNotNull(wxOpenResult);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenMpOAuth2ServiceImplTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenMpOAuth2ServiceImplTest.java | package me.chanjar.weixin.open.api.impl;
import com.google.inject.Inject;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.api.WxOpenMpService;
import me.chanjar.weixin.open.test.ApiTestModule;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@Guice(modules = ApiTestModule.class)
public class WxOpenMpOAuth2ServiceImplTest {
@Inject
protected WxOpenMpService wxOpenMpService;
@Test
public void buildAuthorizationUrl() {
String url = wxOpenMpService.getOAuth2Service().buildAuthorizationUrl("https://t.aaxp.cn/api/base/mp/showCode", "snsapi_userinfo", "");
System.out.println(url);
}
@Test
public void getAccessToken() throws WxErrorException {
WxOAuth2AccessToken result = wxOpenMpService.getOAuth2Service().getAccessToken("041crm0005iFJL1b2l400I0s0k4crm0z");
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-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImplTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenFastMaServiceImplTest.java | package me.chanjar.weixin.open.api.impl;
import org.testng.annotations.Test;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-06-06
*/
public class WxOpenFastMaServiceImplTest {
@Test
public void testInitHttp() {
}
@Test
public void testGetRequestHttpClient() {
}
@Test
public void testGetRequestHttpProxy() {
}
@Test
public void testGetRequestType() {
}
@Test
public void testDoGetAccessTokenRequest() {
}
@Test
public void testGetRequestHttp() {
}
@Test
public void testGetPaidUnionId() {
}
@Test
public void testJsCode2SessionInfo() {
}
@Test
public void testSetDynamicData() {
}
@Test
public void testCheckSignature() {
}
@Test
public void testGetAccessToken() {
}
@Test
public void testTestGetAccessToken() {
}
@Test
public void testGet() {
}
@Test
public void testPost() {
}
@Test
public void testTestPost() {
}
@Test
public void testExecute() {
}
@Test
public void testExtractAccessToken() {
}
@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() {
}
@Test
public void testGetLiveService() {
}
@Test
public void testTestGetWxMaConfig() {
}
@Test
public void testTestGetAccessToken1() {
}
@Test
public void testGetAccountBasicInfo() {
}
@Test
public void testSetNickname() {
}
@Test
public void testQuerySetNicknameStatus() {
}
@Test
public void testCheckWxVerifyNickname() {
}
@Test
public void testModifyHeadImage() {
}
@Test
public void testModifySignature() {
}
@Test
public void testComponentRebindAdmin() {
}
@Test
public void testGetAllCategories() {
}
@Test
public void testAddCategory() {
}
@Test
public void testDeleteCategory() {
}
@Test
public void testGetCategory() {
}
@Test
public void testModifyCategory() {
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenInRedisConfigStorageTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenInRedisConfigStorageTest.java | package me.chanjar.weixin.open.api.impl;
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import redis.clients.jedis.JedisPool;
public class WxOpenInRedisConfigStorageTest {
private WxOpenConfigStorage wxOpenConfigStorage;
private JedisPool pool;
@BeforeClass
public void setWxOpenConfigStorage(){
pool = new JedisPool("127.0.0.1", 6379);
this.wxOpenConfigStorage = new WxOpenInRedisConfigStorage(pool);
this.wxOpenConfigStorage.setWxOpenInfo("ComponentAppId", "ComponentAppSecret", "ComponentToken","ComponentAesKey");
this.wxOpenConfigStorage.setComponentVerifyTicket("ComponentVerifyTicket");
}
@AfterClass
public void clearResource(){
pool.close();
}
@Test
public void testGetComponentVerifyTicket() {
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "ComponentVerifyTicket");
}
@Test
public void testSetComponentVerifyTicket() {
this.wxOpenConfigStorage.setComponentVerifyTicket("new ComponentVerifyTicket");
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "new ComponentVerifyTicket");
}
@Test
public void testIsComponentAccessTokenExpired() {
String responseContent = "{\"component_access_token\": \"new componentAccessToken\", \"expires_in\": 10000}";
WxOpenComponentAccessToken componentAccessToken = WxOpenComponentAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateComponentAccessToken(componentAccessToken);
boolean expired = this.wxOpenConfigStorage.isComponentAccessTokenExpired();
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireComponentAccessToken();
expired = this.wxOpenConfigStorage.isComponentAccessTokenExpired();
Assert.assertEquals(expired, true);
}
@Test
public void testGetAuthorizerRefreshToken() {
String appid = "appid1";
this.wxOpenConfigStorage.setAuthorizerRefreshToken(appid, "AuthorizerRefreshToken 1");
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerRefreshToken(appid);
Assert.assertEquals(authorizerAccessToken, "AuthorizerRefreshToken 1");
this.wxOpenConfigStorage.setAuthorizerRefreshToken(appid, "AuthorizerRefreshToken 2");
authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerRefreshToken(appid);
Assert.assertEquals(authorizerAccessToken, "AuthorizerRefreshToken 2");
}
@Test
public void testGetAuthorizerAccessToken() {
String appid = "appid1";
String responseContent = "{\"authorizer_access_token\": \"new authorizer_access_token\",\"expires_in\": 100000}";
WxOpenAuthorizerAccessToken wxOpenAuthorizerAccessToken = WxOpenAuthorizerAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateAuthorizerAccessToken(appid, wxOpenAuthorizerAccessToken);
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerAccessToken(appid);
Assert.assertEquals(authorizerAccessToken, "new authorizer_access_token");
}
@Test
public void testIsAuthorizerAccessTokenExpired() {
String appid = "appid1";
String responseContent = "{\"authorizer_access_token\": \"new authorizer_access_token\",\"expires_in\": 100000}";
WxOpenAuthorizerAccessToken wxOpenAuthorizerAccessToken = WxOpenAuthorizerAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateAuthorizerAccessToken(appid, wxOpenAuthorizerAccessToken);
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerAccessToken(appid);
Assert.assertEquals(authorizerAccessToken, "new authorizer_access_token");
boolean expired = this.wxOpenConfigStorage.isAuthorizerAccessTokenExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireAuthorizerAccessToken(appid);
expired = this.wxOpenConfigStorage.isAuthorizerAccessTokenExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testGetJsapiTicket() {
String appid = "appid1";
this.wxOpenConfigStorage.updateJsapiTicket(appid, "jsapiTicket", 100000);
String jsapiTicket = this.wxOpenConfigStorage.getJsapiTicket(appid);
Assert.assertEquals(jsapiTicket, "jsapiTicket");
boolean expired = this.wxOpenConfigStorage.isJsapiTicketExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireJsapiTicket(appid);
jsapiTicket = this.wxOpenConfigStorage.getJsapiTicket(appid);
Assert.assertEquals(jsapiTicket, null);
expired = this.wxOpenConfigStorage.isJsapiTicketExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testGetCardApiTicket() {
String appid = "appid1";
this.wxOpenConfigStorage.updateCardApiTicket(appid, "new CardApiTicket", 10000);
String cardApiTicket = this.wxOpenConfigStorage.getCardApiTicket(appid);
Assert.assertEquals(cardApiTicket, "new CardApiTicket");
boolean expired = this.wxOpenConfigStorage.isCardApiTicketExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireCardApiTicket(appid);
expired = this.wxOpenConfigStorage.isCardApiTicketExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testComponentVerifyTicketExpiration() {
// Test that ComponentVerifyTicket is set correctly
this.wxOpenConfigStorage.setComponentVerifyTicket("test_ticket_for_expiration");
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "test_ticket_for_expiration");
// This test verifies that setComponentVerifyTicket now uses 43200 seconds (12 hours)
// instead of Integer.MAX_VALUE for expiration. The actual expiration test would
// require waiting or mocking time, which is not practical in unit tests.
// The change is validated by code inspection and the fact that other tokens
// use similar expiration patterns with specific timeouts.
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenOAuth2ServiceImplTest.java | package me.chanjar.weixin.open.api.impl;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
/**
* 单元测试.
*
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-10-19
*/
public class WxOpenOAuth2ServiceImplTest {
private final WxOpenOAuth2ServiceImpl service = new WxOpenOAuth2ServiceImpl("123", "",
new WxOpenInMemoryConfigStorage());
@BeforeTest
public void init() {
// this.service.setWxOpenConfigStorage(new WxOpenInMemoryConfigStorage());
}
@Test
public void testBuildAuthorizationUrl() {
this.service.buildAuthorizationUrl("", "", "");
}
@Test
public void testGetAccessToken() throws WxErrorException {
this.service.getAccessToken("a");
}
@Test
public void testTestGetAccessToken() throws WxErrorException {
this.service.getAccessToken("", "", "");
}
@Test
public void testRefreshAccessToken() throws WxErrorException {
this.service.refreshAccessToken("");
}
@Test
public void testGetUserInfo() throws WxErrorException {
this.service.getUserInfo(new WxOAuth2AccessToken(), "");
}
@Test
public void testValidateAccessToken() {
this.service.validateAccessToken(new WxOAuth2AccessToken());
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenInRedissonConfigStorageTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenInRedissonConfigStorageTest.java | package me.chanjar.weixin.open.api.impl;
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
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.BeforeClass;
import org.testng.annotations.Test;
public class WxOpenInRedissonConfigStorageTest {
private WxOpenConfigStorage wxOpenConfigStorage;
@BeforeClass
public void setWxOpenConfigStorage(){
Config config = new Config();
config.useSingleServer().setAddress("redis://127.0.0.1:6379")
.setDatabase(0);
config.setTransportMode(TransportMode.NIO);
RedissonClient redisson = Redisson.create(config);
this.wxOpenConfigStorage = new WxOpenInRedissonConfigStorage(redisson);
this.wxOpenConfigStorage.setWxOpenInfo("ComponentAppId", "ComponentAppSecret", "ComponentToken","ComponentAesKey");
this.wxOpenConfigStorage.setComponentVerifyTicket("ComponentVerifyTicket");
}
@Test
public void testGetComponentVerifyTicket() {
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "ComponentVerifyTicket");
}
@Test
public void testSetComponentVerifyTicket() {
this.wxOpenConfigStorage.setComponentVerifyTicket("new ComponentVerifyTicket");
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "new ComponentVerifyTicket");
}
@Test
public void testIsComponentAccessTokenExpired() {
String responseContent = "{\"component_access_token\": \"new componentAccessToken\", \"expires_in\": 10000}";
WxOpenComponentAccessToken componentAccessToken = WxOpenComponentAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateComponentAccessToken(componentAccessToken);
boolean expired = this.wxOpenConfigStorage.isComponentAccessTokenExpired();
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireComponentAccessToken();
expired = this.wxOpenConfigStorage.isComponentAccessTokenExpired();
Assert.assertEquals(expired, true);
}
@Test
public void testGetAuthorizerRefreshToken() {
String appid = "appid1";
this.wxOpenConfigStorage.setAuthorizerRefreshToken(appid, "AuthorizerRefreshToken 1");
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerRefreshToken(appid);
Assert.assertEquals(authorizerAccessToken, "AuthorizerRefreshToken 1");
this.wxOpenConfigStorage.setAuthorizerRefreshToken(appid, "AuthorizerRefreshToken 2");
authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerRefreshToken(appid);
Assert.assertEquals(authorizerAccessToken, "AuthorizerRefreshToken 2");
}
@Test
public void testGetAuthorizerAccessToken() {
String appid = "appid1";
String responseContent = "{\"authorizer_access_token\": \"new authorizer_access_token\",\"expires_in\": 100000}";
WxOpenAuthorizerAccessToken wxOpenAuthorizerAccessToken = WxOpenAuthorizerAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateAuthorizerAccessToken(appid, wxOpenAuthorizerAccessToken);
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerAccessToken(appid);
Assert.assertEquals(authorizerAccessToken, "new authorizer_access_token");
}
@Test
public void testIsAuthorizerAccessTokenExpired() {
String appid = "appid1";
String responseContent = "{\"authorizer_access_token\": \"new authorizer_access_token\",\"expires_in\": 100000}";
WxOpenAuthorizerAccessToken wxOpenAuthorizerAccessToken = WxOpenAuthorizerAccessToken.fromJson(responseContent);
this.wxOpenConfigStorage.updateAuthorizerAccessToken(appid, wxOpenAuthorizerAccessToken);
String authorizerAccessToken = this.wxOpenConfigStorage.getAuthorizerAccessToken(appid);
Assert.assertEquals(authorizerAccessToken, "new authorizer_access_token");
boolean expired = this.wxOpenConfigStorage.isAuthorizerAccessTokenExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireAuthorizerAccessToken(appid);
expired = this.wxOpenConfigStorage.isAuthorizerAccessTokenExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testGetJsapiTicket() {
String appid = "appid1";
this.wxOpenConfigStorage.updateJsapiTicket(appid, "jsapiTicket", 100000);
String jsapiTicket = this.wxOpenConfigStorage.getJsapiTicket(appid);
Assert.assertEquals(jsapiTicket, "jsapiTicket");
boolean expired = this.wxOpenConfigStorage.isJsapiTicketExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireJsapiTicket(appid);
jsapiTicket = this.wxOpenConfigStorage.getJsapiTicket(appid);
Assert.assertEquals(jsapiTicket, null);
expired = this.wxOpenConfigStorage.isJsapiTicketExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testGetCardApiTicket() {
String appid = "appid1";
this.wxOpenConfigStorage.updateCardApiTicket(appid, "new CardApiTicket", 10000);
String cardApiTicket = this.wxOpenConfigStorage.getCardApiTicket(appid);
Assert.assertEquals(cardApiTicket, "new CardApiTicket");
boolean expired = this.wxOpenConfigStorage.isCardApiTicketExpired(appid);
Assert.assertEquals(expired, false);
this.wxOpenConfigStorage.expireCardApiTicket(appid);
expired = this.wxOpenConfigStorage.isCardApiTicketExpired(appid);
Assert.assertEquals(expired, true);
}
@Test
public void testComponentVerifyTicketExpiration() {
// Test that ComponentVerifyTicket is set correctly
this.wxOpenConfigStorage.setComponentVerifyTicket("test_ticket_for_expiration");
String componentVerifyTicket = this.wxOpenConfigStorage.getComponentVerifyTicket();
Assert.assertEquals(componentVerifyTicket, "test_ticket_for_expiration");
// This test verifies that setComponentVerifyTicket now uses 43200 seconds (12 hours)
// instead of Integer.MAX_VALUE for expiration. The actual expiration test would
// require waiting or mocking time, which is not practical in unit tests.
// The change is validated by code inspection and the fact that other tokens
// use similar expiration patterns with specific timeouts.
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImplTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/api/impl/WxOpenMaServiceImplTest.java | package me.chanjar.weixin.open.api.impl;
import org.testng.annotations.Test;
/**
* @author <a href="https://github.com/binarywang">Binary Wang</a>
* created on 2020-06-06
*/
public class WxOpenMaServiceImplTest {
@Test
public void testInitHttp() {
}
@Test
public void testGetRequestHttpClient() {
}
@Test
public void testGetRequestHttpProxy() {
}
@Test
public void testGetRequestType() {
}
@Test
public void testDoGetAccessTokenRequest() {
}
@Test
public void testGetRequestHttp() {
}
@Test
public void testGetPaidUnionId() {
}
@Test
public void testJsCode2SessionInfo() {
}
@Test
public void testSetDynamicData() {
}
@Test
public void testCheckSignature() {
}
@Test
public void testGetAccessToken() {
}
@Test
public void testTestGetAccessToken() {
}
@Test
public void testGet() {
}
@Test
public void testPost() {
}
@Test
public void testTestPost() {
}
@Test
public void testExecute() {
}
@Test
public void testExtractAccessToken() {
}
@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() {
}
@Test
public void testGetLiveService() {
}
@Test
public void testTestJsCode2SessionInfo() {
}
@Test
public void testTestGetWxMaConfig() {
}
@Test
public void testTestGetAccessToken1() {
}
@Test
public void testGetDomain() {
}
@Test
public void testModifyDomain() {
}
@Test
public void testGetWebViewDomain() {
}
@Test
public void testGetWebViewDomainInfo() {
}
@Test
public void testSetWebViewDomain() {
}
@Test
public void testSetWebViewDomainInfo() {
}
@Test
public void testGetAccountBasicInfo() {
}
@Test
public void testBindTester() {
}
@Test
public void testUnbindTester() {
}
@Test
public void testUnbindTesterByUserStr() {
}
@Test
public void testGetTesterList() {
}
@Test
public void testChangeWxaSearchStatus() {
}
@Test
public void testGetWxaSearchStatus() {
}
@Test
public void testGetShowWxaItem() {
}
@Test
public void testUpdateShowWxaItem() {
}
@Test
public void testCodeCommit() {
}
@Test
public void testGetTestQrcode() {
}
@Test
public void testGetCategoryList() {
}
@Test
public void testGetPageList() {
}
@Test
public void testSubmitAudit() {
}
@Test
public void testGetAuditStatus() {
}
@Test
public void testGetLatestAuditStatus() {
}
@Test
public void testReleaseAudited() {
}
@Test
public void testChangeVisitStatus() {
}
@Test
public void testRevertCodeRelease() {
}
@Test
public void testUndoCodeAudit() {
}
@Test
public void testGetSupportVersion() {
}
@Test
public void testGetSupportVersionInfo() {
}
@Test
public void testSetSupportVersion() {
}
@Test
public void testSetSupportVersionInfo() {
}
@Test
public void testGrayRelease() {
}
@Test
public void testRevertGrayRelease() {
}
@Test
public void testGetGrayReleasePlan() {
}
@Test
public void testQueryQuota() {
// 此测试方法演示如何使用审核额度查询功能
// 注意:实际运行需要真实的微信 API 凭据
/*
try {
// 查询当前审核额度
WxOpenMaQueryQuotaResult quota = wxOpenMaService.queryQuota();
System.out.println("审核额度信息:");
System.out.println(" 当月剩余提交审核次数: " + quota.getRest());
System.out.println(" 当月提交审核额度上限: " + quota.getLimit());
System.out.println(" 剩余加急次数: " + quota.getSpeedupRest());
System.out.println(" 加急额度上限: " + quota.getSpeedupLimit());
// 检查额度是否充足
if (quota.getRest() <= 0) {
System.err.println("警告:审核额度已用尽!");
} else if (quota.getRest() <= 5) {
System.out.println("提示:审核额度即将用尽,请注意!");
}
} catch (WxErrorException e) {
e.printStackTrace();
}
*/
}
/**
* 演示提交审核前检查额度的最佳实践
* <p>
* 这是一个完整的示例,展示如何在提交审核前检查额度,避免额度不足导致的失败
* </p>
*/
@Test
public void testSubmitAuditWithQuotaCheck() {
// 此测试方法演示提交审核前的额度检查最佳实践
// 注意:实际运行需要真实的微信 API 凭据
/*
try {
// 步骤1:检查审核额度
WxOpenMaQueryQuotaResult quota = wxOpenMaService.queryQuota();
System.out.println("当前剩余审核额度: " + quota.getRest());
if (quota.getRest() <= 0) {
throw new RuntimeException("审核额度不足,无法提交审核。剩余额度: " + quota.getRest());
}
// 步骤2:准备审核数据
WxMaCodeSubmitAuditItem item = new WxMaCodeSubmitAuditItem();
item.setAddress("index");
item.setTag("工具");
item.setFirstClass("工具");
item.setSecondClass("效率");
item.setTitle("首页");
WxOpenMaSubmitAuditMessage message = new WxOpenMaSubmitAuditMessage();
message.setItemList(Collections.singletonList(item));
message.setVersionDesc("修复若干已知问题,优化用户体验");
// 步骤3:提交审核
WxOpenMaSubmitAuditResult result = wxOpenMaService.submitAudit(message);
System.out.println("提交审核成功,审核ID: " + result.getAuditId());
// 步骤4:再次查询额度,确认已消耗
quota = wxOpenMaService.queryQuota();
System.out.println("提交后剩余审核额度: " + quota.getRest());
} catch (WxErrorException e) {
System.err.println("提交审核失败: " + e.getMessage());
e.printStackTrace();
}
*/
}
/**
* 演示批量提交审核时的额度管理策略
* <p>
* 当需要为多个小程序提交审核时,应该先统一检查额度是否充足
* </p>
*/
@Test
public void testBatchSubmitAuditWithQuotaManagement() {
// 此测试方法演示批量提交审核时的额度管理策略
// 注意:实际运行需要真实的微信 API 凭据,以及 WxOpenComponentService 实例
/*
// 假设已经初始化了 wxOpenComponentService
// WxOpenComponentService wxOpenComponentService = ...;
try {
// 假设需要为多个小程序提交审核
List<String> appIds = Arrays.asList("appid1", "appid2", "appid3");
// 步骤1:通过任意一个小程序服务查询总体额度
// 注意:审核额度是第三方平台级别的,所有授权小程序共享
WxOpenMaService firstMaService = wxOpenComponentService.getWxMaServiceByAppid(appIds.get(0));
WxOpenMaQueryQuotaResult quota = firstMaService.queryQuota();
System.out.println("当前剩余审核额度: " + quota.getRest());
if (quota.getRest() < appIds.size()) {
System.err.println("警告:审核额度不足!");
System.err.println(" 需要提交: " + appIds.size() + " 个");
System.err.println(" 剩余额度: " + quota.getRest());
System.err.println(" 缺少额度: " + (appIds.size() - quota.getRest()));
return;
}
// 步骤2:依次提交审核
int successCount = 0;
for (String appId : appIds) {
try {
WxOpenMaService maService = wxOpenComponentService.getWxMaServiceByAppid(appId);
WxOpenMaSubmitAuditMessage message = new WxOpenMaSubmitAuditMessage();
// ... 设置审核信息
WxOpenMaSubmitAuditResult result = maService.submitAudit(message);
System.out.println("AppId: " + appId + " 提交成功,审核ID: " + result.getAuditId());
successCount++;
} catch (WxErrorException e) {
System.err.println("AppId: " + appId + " 提交失败: " + e.getMessage());
}
}
// 步骤3:输出统计信息
System.out.println("批量提交完成:");
System.out.println(" 成功: " + successCount);
System.out.println(" 失败: " + (appIds.size() - successCount));
// 步骤4:查询剩余额度
quota = firstMaService.queryQuota();
System.out.println(" 剩余额度: " + quota.getRest());
} catch (Exception e) {
e.printStackTrace();
}
*/
}
@Test
public void testSpeedAudit() {
}
@Test
public void testAddQrcodeJump() {
}
@Test
public void testGetQrcodeJump() {
}
@Test
public void testDownloadQrcodeJump() {
}
@Test
public void testDeleteQrcodeJump() {
}
@Test
public void testPublishQrcodeJump() {
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxOpenAuthorizerInfoResultTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxOpenAuthorizerInfoResultTest.java | package me.chanjar.weixin.open.bean.result;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.testng.annotations.Test;
/**
* @title: 获取授权帐号详情 信息反序列化测试
* @author: trifolium
* created on : 2022/6/7
* @modified :
*/
public class WxOpenAuthorizerInfoResultTest {
@Test
public void testDeserialization() {
String json = "{\n" +
" \"authorizer_info\": {\n" +
" \"nick_name\": \"美妆饰品\",\n" +
" \"head_img\": \"http:\\/\\/wx.qlogo.cn\\/mmopen\\/jJSbu4Te5iuiaM0dFnKVUEE83n2yH5cQStb\\/0\",\n" +
" \"service_type_info\": {\n" +
" \"id\": 0\n" +
" },\n" +
" \"verify_type_info\": {\n" +
" \"id\": -1\n" +
" },\n" +
" \"user_name\": \"gh_c43395cb652e\",\n" +
" \"alias\": \"\",\n" +
" \"qrcode_url\": \"http:\\/\\/mmbiz.qpic.cn\\/mmbiz_jpg\\/kPmmhe6g\\/0\",\n" +
" \"business_info\": {\n" +
" \"open_pay\": 0,\n" +
" \"open_shake\": 0,\n" +
" \"open_scan\": 0,\n" +
" \"open_card\": 0,\n" +
" \"open_store\": 0\n" +
" },\n" +
" \"idc\": 1,\n" +
" \"principal_name\": \"个人\",\n" +
" \"signature\": \"做美装,精美饰品等搭配教学\",\n" +
" \"MiniProgramInfo\": {\n" +
" \"network\": {\n" +
" \"RequestDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"WsRequestDomain\": [\"wss:\\/\\/weixin.qq.com\"],\n" +
" \"UploadDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"DownloadDomain\": [\"https:\\/\\/weixin.qq.com\"],\n" +
" \"BizDomain\": [],\n" +
" \"UDPDomain\": [],\n" +
" \"TCPDomain\": [],\n" +
" \"PrefetchDNSDomain\": [],\n" +
" \"NewRequestDomain\": [],\n" +
" \"NewWsRequestDomain\": [],\n" +
" \"NewUploadDomain\": [],\n" +
" \"NewDownloadDomain\": [],\n" +
" \"NewBizDomain\": [],\n" +
" \"NewUDPDomain\": [],\n" +
" \"NewTCPDomain\": [],\n" +
" \"NewPrefetchDNSDomain\": []\n" +
" },\n" +
" \"categories\": [{\n" +
" \"first\": \"生活服务\",\n" +
" \"second\": \"丽人服务\"\n" +
" }, {\n" +
" \"first\": \"旅游服务\",\n" +
" \"second\": \"旅游资讯\"\n" +
" }, {\n" +
" \"first\": \"物流服务\",\n" +
" \"second\": \"查件\"\n" +
" }],\n" +
" \"visit_status\": 0\n" +
" },\n" +
" \"register_type\": 0,\n" +
" \"account_status\": 1,\n" +
" \"basic_config\": {\n" +
" \"is_phone_configured\": true,\n" +
" \"is_email_configured\": true\n" +
" }\n" +
" },\n" +
" \"authorization_info\": {\n" +
" \"authorizer_appid\": \"wx326eecacf7370d4e\",\n" +
" \"authorizer_refresh_token\": \"refreshtoken@@@RU0Sgi7bD6apS7frS9gj8Sbws7OoDejK9Z-cm0EnCzg\",\n" +
" \"func_info\": [{\n" +
" \"funcscope_category\": {\n" +
" \"id\": 3\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 7\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 17\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 18\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 19\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 30\n" +
" },\n" +
" \"confirm_info\": {\n" +
" \"need_confirm\": 0,\n" +
" \"already_confirm\": 0,\n" +
" \"can_confirm\": 0\n" +
" }\n" +
" }, {\n" +
" \"funcscope_category\": {\n" +
" \"id\": 115\n" +
" }\n" +
" }]\n" +
" }\n" +
"}\n";
System.out.println(WxOpenGsonBuilder.create().fromJson(json, WxOpenAuthorizerInfoResult.class));
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaCanSetCategoryResultTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaCanSetCategoryResultTest.java | package me.chanjar.weixin.open.bean.result;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
public class WxFastMaCanSetCategoryResultTest {
@Test
public void testFromJson() throws Exception {
String json = "{\n" +
" \"errcode\": 0, \n" +
" \"errmsg\": \"ok\", \n" +
" \"categories_list\": {\n" +
" \"categories\": [\n" +
" {\n" +
" \"id\": 1, \n" +
" \"name\": \"快递业与邮政\", \n" +
" \"level\": 1, \n" +
" \"father\": 0, \n" +
" \"children\": [\n" +
" 2, \n" +
" 5, \n" +
" 556, \n" +
" 558, \n" +
" 1033\n" +
" ], \n" +
" \"sensitive_type\": 0, \n" +
" \"type_list\": [ ], \n" +
" \"qualify\": {\n" +
" \"exter_list\": [ ], \n" +
" \"remark\": \"\"\n" +
" }, \n" +
" \"available_api_list\": [ ], \n" +
" \"apis\": [ ], \n" +
" \"available_for_plugin\": true\n" +
" }, \n" +
" {\n" +
" \"id\": 8, \n" +
" \"name\": \"教育\", \n" +
" \"level\": 1, \n" +
" \"father\": 0, \n" +
" \"children\": [\n" +
" 9, \n" +
" 590, \n" +
" 592, \n" +
" 27, \n" +
" 32, \n" +
" 37, \n" +
" 39, \n" +
" 578, \n" +
" 580, \n" +
" 582, \n" +
" 1043\n" +
" ], \n" +
" \"sensitive_type\": 0, \n" +
" \"type_list\": [ ], \n" +
" \"qualify\": {\n" +
" \"exter_list\": [ ], \n" +
" \"remark\": \"\"\n" +
" }, \n" +
" \"is_hidden\": false, \n" +
" \"available_api_list\": [ ], \n" +
" \"type\": \"NORMAL\", \n" +
" \"apis\": [ ], \n" +
" \"available_for_plugin\": true\n" +
" }\n" +
" ]\n" +
" }\n" +
"}";
WxFastMaCanSetCategoryResult res = WxOpenGsonBuilder.create().fromJson(json, WxFastMaCanSetCategoryResult.class);
assertNotNull(res);
assertNotNull(res.getCategoriesList());
System.out.println(res);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaBeenSetCategoryResultTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaBeenSetCategoryResultTest.java | package me.chanjar.weixin.open.bean.result;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
public class WxFastMaBeenSetCategoryResultTest {
@Test
public void testFromJson() throws Exception {
String json = "{\n" +
" \"errcode\": 0,\n" +
" \"errmsg\":\"ok\",\n" +
" \"categories\": [\n" +
" {\n" +
" \"first\": 8,\n" +
" \"first_name\": \"教育\",\n" +
" \"second\": 39,\n" +
" \"second_name\": \"出国移民\",\n" +
" \"audit_status\": 1,\n" +
" \"audit_reason\": \"不通过啊啊\"\n" +
" }\n" +
" ],\n" +
"\t\"limit\": 5,\n" +
" \"quota\": 4,\n" +
" \"category_limit\": 20\n" +
"}";
WxFastMaBeenSetCategoryResult res = WxOpenGsonBuilder.create().fromJson(json, WxFastMaBeenSetCategoryResult.class);
assertNotNull(res);
assertTrue(res.getCategories().size() > 0);
assertNotNull(res.getCategories().get(0));
assertNotNull(res.getCategories().get(0).getFirstName());
System.out.println(res);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java | weixin-java-open/src/test/java/me/chanjar/weixin/open/bean/result/WxFastMaAccountBasicInfoResultTest.java | package me.chanjar.weixin.open.bean.result;
import me.chanjar.weixin.open.util.json.WxOpenGsonBuilder;
import org.testng.annotations.Test;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
public class WxFastMaAccountBasicInfoResultTest {
@Test
public void testFromJson() throws Exception {
String json = "{\n" +
" \"errcode\": 0,\n" +
" \"errmsg\": \"ok\",\n" +
"\t\"appid\": \"wxdc685123d955453\",\n" +
" \"account_type\": 2,\n" +
"\t\"principal_type\": 1,\n" +
"\t\"principal_name\": \"深圳市腾讯计算机系统有限公司\",\n" +
" \"realname_status\": 1,\n" +
" \"wx_verify_info\": {\n" +
" \"qualification_verify\": true,\n" +
" \"naming_verify\": true,\n" +
" \"annual_review\": true,\n" +
" \"annual_review_begin_time\": 1550490981,\n" +
" \"annual_review_end_time\": 1558266981\n" +
" },\n" +
" \"signature_info\": {\n" +
" \"signature\": \"功能介绍\",\n" +
" \"modify_used_count\": 1,\n" +
" \"modify_quota\": 5\n" +
" },\n" +
"\t\"head_image_info\": {\n" +
" \"head_image_url\": \"http://mmbiz.qpic.cn/mmbiz/a5icZrUmbV8p5jb6RZ8aYfjfS2AVle8URwBt8QIu6XbGewB9wiaWYWkPwq4R7pfdsFibuLkic16UcxDSNYtB8HnC1Q/0\",\n" +
" \"modify_used_count\": 3,\n" +
" \"modify_quota\": 5\n" +
" },\n" +
"\t\"nickname_info\": {\n" +
" \"nickname\": \"nickey\",\n" +
" \"modify_used_count\": 2,\n" +
" \"modify_quota\": 2\n" +
" },\n" +
" \"nickname\": \"nickeyInfo\"\n" +
"}";
WxFastMaAccountBasicInfoResult res = WxOpenGsonBuilder.create().fromJson(json, WxFastMaAccountBasicInfoResult.class);
assertNotNull(res);
assertNotNull(res.getAppId());
assertNotNull(res.getSignatureInfo().getModifyQuota());
assertNotNull(res.getHeadImageInfo().getHeadImageUrl());
assertNotNull(res.getWxVerifyInfo().getNamingVerify());
assertTrue(res.getWxVerifyInfo().getNamingVerify());
assertNotNull(res.getNicknameInfo().getNickname());
assertNotNull(res.getNickname());
System.out.println(res);
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/WxOpenCryptUtil.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/WxOpenCryptUtil.java | package me.chanjar.weixin.open.util;
import me.chanjar.weixin.open.api.WxOpenConfigStorage;
import org.apache.commons.lang3.StringUtils;
import java.util.Base64;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenCryptUtil extends me.chanjar.weixin.common.util.crypto.WxCryptUtil {
/**
* 构造函数
*
* @param wxOpenConfigStorage
*/
public WxOpenCryptUtil(WxOpenConfigStorage wxOpenConfigStorage) {
/*
* @param token 公众平台上,开发者设置的token
* @param encodingAesKey 公众平台上,开发者设置的EncodingAESKey
* @param appId 公众平台appid
*/
String encodingAesKey = wxOpenConfigStorage.getComponentAesKey();
String token = wxOpenConfigStorage.getComponentToken();
String appId = wxOpenConfigStorage.getComponentAppId();
this.token = token;
this.appidOrCorpid = appId;
this.aesKey = Base64.getDecoder().decode(StringUtils.remove(encodingAesKey, " "));
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/xml/XStreamTransformer.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/xml/XStreamTransformer.java | package me.chanjar.weixin.open.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 com.thoughtworks.xstream.XStream;
import me.chanjar.weixin.common.util.xml.XStreamInitializer;
import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class XStreamTransformer {
private static final Map<Class<?>, XStream> CLASS_2_XSTREAM_INSTANCE = new HashMap<>();
static {
registerClass(WxOpenXmlMessage.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);
}
/**
* 会自动注册该类及其子类.
*
* @param clz 要注册的类
*/
private static void registerClass(Class<?> clz) {
XStream xstream = XStreamInitializer.getInstance();
xstream.processAnnotations(clz);
xstream.processAnnotations(getInnerClasses(clz));
if (clz.equals(WxOpenXmlMessage.class)) {
// 操蛋的微信,模板消息推送成功的消息是MsgID,其他消息推送过来是MsgId
xstream.aliasField("MsgID", WxOpenXmlMessage.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-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenComponentAccessTokenGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenComponentAccessTokenGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
import java.lang.reflect.Type;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenComponentAccessTokenGsonAdapter implements JsonDeserializer<WxOpenComponentAccessToken> {
@Override
public WxOpenComponentAccessToken deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenComponentAccessToken componentAccessToken = new WxOpenComponentAccessToken();
JsonObject jsonObject = jsonElement.getAsJsonObject();
componentAccessToken.setComponentAccessToken(GsonHelper.getString(jsonObject, "component_access_token"));
componentAccessToken.setExpiresIn(GsonHelper.getPrimitiveInteger(jsonObject, "expires_in"));
return componentAccessToken;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerInfoResultGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerInfoResultGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import java.lang.reflect.Type;
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 com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizerInfo;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerInfoResult;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenAuthorizerInfoResultGsonAdapter implements JsonDeserializer<WxOpenAuthorizerInfoResult> {
@Override
public WxOpenAuthorizerInfoResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenAuthorizerInfoResult authorizerInfoResult = new WxOpenAuthorizerInfoResult();
JsonObject jsonObject = jsonElement.getAsJsonObject();
WxOpenAuthorizationInfo authorizationInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("authorization_info"),
new TypeToken<WxOpenAuthorizationInfo>() {
}.getType());
authorizerInfoResult.setAuthorizationInfo(authorizationInfo);
WxOpenAuthorizerInfo authorizerInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("authorizer_info"),
new TypeToken<WxOpenAuthorizerInfo>() {
}.getType());
authorizerInfoResult.setAuthorizerInfo(authorizerInfo);
return authorizerInfoResult;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenQueryAuthResultGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenQueryAuthResultGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import java.lang.reflect.Type;
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 com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
import me.chanjar.weixin.open.bean.result.WxOpenQueryAuthResult;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenQueryAuthResultGsonAdapter implements JsonDeserializer<WxOpenQueryAuthResult> {
@Override
public WxOpenQueryAuthResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenQueryAuthResult queryAuthResult = new WxOpenQueryAuthResult();
JsonObject jsonObject = jsonElement.getAsJsonObject();
WxOpenAuthorizationInfo authorizationInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("authorization_info"),
new TypeToken<WxOpenAuthorizationInfo>() {
}.getType());
queryAuthResult.setAuthorizationInfo(authorizationInfo);
return queryAuthResult;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizationInfoGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizationInfoGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenAuthorizationInfoGsonAdapter implements JsonDeserializer<WxOpenAuthorizationInfo> {
@Override
public WxOpenAuthorizationInfo deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenAuthorizationInfo authorizationInfo = new WxOpenAuthorizationInfo();
JsonObject jsonObject = jsonElement.getAsJsonObject();
authorizationInfo.setAuthorizerAppid(GsonHelper.getString(jsonObject, "authorizer_appid"));
authorizationInfo.setAuthorizerAccessToken(GsonHelper.getString(jsonObject, "authorizer_access_token"));
authorizationInfo.setExpiresIn(GsonHelper.getPrimitiveInteger(jsonObject, "expires_in"));
authorizationInfo.setAuthorizerRefreshToken(GsonHelper.getString(jsonObject, "authorizer_refresh_token"));
List<Integer> funcInfo = new ArrayList<>();
JsonArray jsonArray = GsonHelper.getAsJsonArray(jsonObject.get("func_info"));
if (jsonArray != null && !jsonArray.isJsonNull()) {
for (int i = 0; i < jsonArray.size(); i++) {
jsonObject = jsonArray.get(i).getAsJsonObject();
if (jsonObject == null || jsonObject.isJsonNull()) {
continue;
}
jsonObject = jsonObject.getAsJsonObject("funcscope_category");
if (jsonObject == null || jsonObject.isJsonNull()) {
continue;
}
Integer id = GsonHelper.getInteger(jsonObject, "id");
if (id == null) {
continue;
}
funcInfo.add(id);
}
}
authorizationInfo.setFuncInfo(funcInfo);
return authorizationInfo;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenGsonBuilder.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenGsonBuilder.java | package me.chanjar.weixin.open.util.json;
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 me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizationInfo;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizerInfo;
import me.chanjar.weixin.open.bean.result.*;
import java.io.File;
import java.util.Objects;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenGsonBuilder {
private static final GsonBuilder INSTANCE = new GsonBuilder();
private static volatile Gson GSON_INSTANCE;
static {
INSTANCE.disableHtmlEscaping();
INSTANCE.registerTypeAdapter(WxOpenComponentAccessToken.class, new WxOpenComponentAccessTokenGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerAccessToken.class, new WxOpenAuthorizerAccessTokenGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizationInfo.class, new WxOpenAuthorizationInfoGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerInfo.class, new WxOpenAuthorizerInfoGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenQueryAuthResult.class, new WxOpenQueryAuthResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerInfoResult.class, new WxOpenAuthorizerInfoResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerOptionResult.class, new WxOpenAuthorizerOptionResultGsonAdapter());
INSTANCE.registerTypeAdapter(WxOpenAuthorizerListResult.class, new WxOpenAuthorizerListResultGsonAdapter());
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-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerOptionResultGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerOptionResultGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerOptionResult;
import java.lang.reflect.Type;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenAuthorizerOptionResultGsonAdapter implements JsonDeserializer<WxOpenAuthorizerOptionResult> {
@Override
public WxOpenAuthorizerOptionResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenAuthorizerOptionResult authorizerOptionResult = new WxOpenAuthorizerOptionResult();
JsonObject jsonObject = jsonElement.getAsJsonObject();
authorizerOptionResult.setAuthorizerAppid(GsonHelper.getString(jsonObject, "authorizer_appid"));
authorizerOptionResult.setOptionName(GsonHelper.getString(jsonObject, "option_name"));
authorizerOptionResult.setOptionValue(GsonHelper.getString(jsonObject, "option_value"));
return authorizerOptionResult;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerInfoGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerInfoGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import com.google.gson.reflect.TypeToken;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.auth.WxOpenAuthorizerInfo;
import java.lang.reflect.Type;
import java.util.Map;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenAuthorizerInfoGsonAdapter implements JsonDeserializer<WxOpenAuthorizerInfo> {
private static final String VERIFY_TYPE_INFO = "verify_type_info";
private static final String SERVICE_TYPE_INFO = "service_type_info";
private static final String MINI_PROGRAM_INFO = "MiniProgramInfo";
private static final String BASIC_CONFIG = "basic_config";
@Override
public WxOpenAuthorizerInfo deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenAuthorizerInfo authorizationInfo = new WxOpenAuthorizerInfo();
JsonObject jsonObject = jsonElement.getAsJsonObject();
authorizationInfo.setNickName(GsonHelper.getString(jsonObject, "nick_name"));
authorizationInfo.setHeadImg(GsonHelper.getString(jsonObject, "head_img"));
authorizationInfo.setUserName(GsonHelper.getString(jsonObject, "user_name"));
authorizationInfo.setPrincipalName(GsonHelper.getString(jsonObject, "principal_name"));
authorizationInfo.setAlias(GsonHelper.getString(jsonObject, "alias"));
authorizationInfo.setQrcodeUrl(GsonHelper.getString(jsonObject, "qrcode_url"));
authorizationInfo.setAccountStatus(GsonHelper.getInteger(jsonObject, "account_status"));
authorizationInfo.setSignature(GsonHelper.getString(jsonObject, "signature"));
authorizationInfo.setRegisterType(GsonHelper.getInteger(jsonObject, "register_type"));
if (jsonObject.has(SERVICE_TYPE_INFO)) {
authorizationInfo.setServiceTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject(SERVICE_TYPE_INFO), "id"));
}
if (jsonObject.has(VERIFY_TYPE_INFO)) {
authorizationInfo.setVerifyTypeInfo(GsonHelper.getInteger(jsonObject.getAsJsonObject(VERIFY_TYPE_INFO), "id"));
}
if(jsonObject.has(BASIC_CONFIG)){
authorizationInfo.setBasicConfig(WxOpenGsonBuilder.create().fromJson(jsonObject.get(BASIC_CONFIG),
new TypeToken<WxOpenAuthorizerInfo.BasicConfig>(){
}.getType()));
}
Map<String, Integer> businessInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get("business_info"),
new TypeToken<Map<String, Integer>>() {
}.getType());
authorizationInfo.setBusinessInfo(businessInfo);
if (jsonObject.has(MINI_PROGRAM_INFO)) {
WxOpenAuthorizerInfo.MiniProgramInfo miniProgramInfo = WxOpenGsonBuilder.create().fromJson(jsonObject.get(MINI_PROGRAM_INFO),
new TypeToken<WxOpenAuthorizerInfo.MiniProgramInfo>() {
}.getType());
authorizationInfo.setMiniProgramInfo(miniProgramInfo);
}
return authorizationInfo;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerAccessTokenGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerAccessTokenGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import java.lang.reflect.Type;
/**
* @author <a href="https://github.com/007gzs">007</a>
*/
public class WxOpenAuthorizerAccessTokenGsonAdapter implements JsonDeserializer<WxOpenAuthorizerAccessToken> {
@Override
public WxOpenAuthorizerAccessToken deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
WxOpenAuthorizerAccessToken authorizerAccessToken = new WxOpenAuthorizerAccessToken();
JsonObject jsonObject = jsonElement.getAsJsonObject();
authorizerAccessToken.setAuthorizerAccessToken(GsonHelper.getString(jsonObject, "authorizer_access_token"));
authorizerAccessToken.setAuthorizerRefreshToken(GsonHelper.getString(jsonObject, "authorizer_refresh_token"));
authorizerAccessToken.setExpiresIn(GsonHelper.getPrimitiveInteger(jsonObject, "expires_in"));
return authorizerAccessToken;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerListResultGsonAdapter.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/util/json/WxOpenAuthorizerListResultGsonAdapter.java | package me.chanjar.weixin.open.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.open.bean.result.WxOpenAuthorizerListResult;
import java.lang.reflect.Type;
import java.util.*;
/**
* @author robgao Email 315789501@qq.com
*/
public class WxOpenAuthorizerListResultGsonAdapter implements JsonDeserializer<WxOpenAuthorizerListResult> {
private static final String AUTHORIZER_APPID = "authorizer_appid";
private static final String REFRESH_TOKEN = "refresh_token";
private static final String AUTH_TIME = "auth_time";
@Override
public WxOpenAuthorizerListResult deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) throws JsonParseException {
JsonObject jsonObject = jsonElement.getAsJsonObject();
WxOpenAuthorizerListResult wxOpenAuthorizerListResult = new WxOpenAuthorizerListResult();
wxOpenAuthorizerListResult.setTotalCount(GsonHelper.getInteger(jsonObject, "total_count").intValue());
List<Map<String, String>> list = new ArrayList<>();
for (JsonElement element : jsonObject.getAsJsonArray("list")) {
JsonObject authorizer = element.getAsJsonObject();
Map<String, String> authorizerMap = new HashMap<>(10);
authorizerMap.put(AUTHORIZER_APPID, GsonHelper.getString(authorizer, AUTHORIZER_APPID));
authorizerMap.put(REFRESH_TOKEN, GsonHelper.getString(authorizer, REFRESH_TOKEN));
authorizerMap.put(AUTH_TIME, GsonHelper.getString(authorizer, AUTH_TIME));
list.add(authorizerMap);
}
wxOpenAuthorizerListResult.setList(list);
return wxOpenAuthorizerListResult;
}
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaBasicService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.WxFastMaCategory;
import me.chanjar.weixin.open.bean.result.*;
import java.io.UnsupportedEncodingException;
import java.util.List;
/**
* 微信第三方平台 小程序基础信息接口 (小程序名称、头像、描述、类目等信息设置)
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/category/getallcategories.html
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
*/
public interface WxOpenMaBasicService {
/**
* 1 获取帐号基本信息.
*/
String OPEN_GET_ACCOUNT_BASIC_INFO = "https://api.weixin.qq.com/cgi-bin/account/getaccountbasicinfo";
/**
* 2 小程序名称设置及改名.
*/
String OPEN_SET_NICKNAME = "https://api.weixin.qq.com/wxa/setnickname";
/**
* 3 小程序改名审核状态查询.
*/
String OPEN_API_WXA_QUERYNICKNAME = "https://api.weixin.qq.com/wxa/api_wxa_querynickname";
/**
* 4 微信认证名称检测.
*/
String OPEN_CHECK_WX_VERIFY_NICKNAME = "https://api.weixin.qq.com/cgi-bin/wxverify/checkwxverifynickname";
/**
* 5 修改头像.
*/
String OPEN_MODIFY_HEADIMAGE = "https://api.weixin.qq.com/cgi-bin/account/modifyheadimage";
/**
* 6修改功能介绍.
*/
String OPEN_MODIFY_SIGNATURE = "https://api.weixin.qq.com/cgi-bin/account/modifysignature";
/**
* 7 换绑小程序管理员接口.
*/
String OPEN_COMPONENT_REBIND_ADMIN = "https://api.weixin.qq.com/cgi-bin/account/componentrebindadmin";
/**
* 8.1 获取账号可以设置的所有类目
*/
String OPEN_GET_ALL_CATEGORIES = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategories";
/**
* 8.2 获取不同类型主体可设置的类目
*/
String OPEN_GET_ALL_CATEGORIES_BY_TYPE = "https://api.weixin.qq.com/cgi-bin/wxopen/getcategoriesbytype";
/**
* 8.3 添加类目
*/
String OPEN_ADD_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/addcategory";
/**
* 8.4 删除类目
*/
String OPEN_DELETE_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/deletecategory";
/**
* 8.5 获取账号已经设置的所有类目
*/
String OPEN_GET_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/getcategory";
/**
* 8.6 修改类目
*/
String OPEN_MODIFY_CATEGORY = "https://api.weixin.qq.com/cgi-bin/wxopen/modifycategory";
/**
* 8.7 获取类目名称信息
*/
String OPEN_GET_ALL_CATEGORY_NAME = "https://api.weixin.qq.com/cgi-bin/wxopen/getallcategorynamelist";
/**
* 获取订单页path信息
*/
String OPEN_GET_ORDER_PATH_INFO = "https://api.weixin.qq.com/wxa/security/getorderpathinfo";
String URL_COMPONENT_REBIND_ADMIN = "https://mp.weixin.qq.com/wxopen/componentrebindadmin?appid=%s&component_appid=%s&redirect_uri=%s";
/**
* 1.获取小程序的信息
*
* @return .
* @throws WxErrorException .
*/
WxFastMaAccountBasicInfoResult getAccountBasicInfo() throws WxErrorException;
/**
* 2.小程序名称设置及改名
* <pre>
* 若接口未返回audit_id,说明名称已直接设置成功,无需审核;若返回audit_id则名称正在审核中。
* </pre>
*
* @param nickname 昵称
* @param idCard 身份证照片–临时素材mediaid(个人号必填)
* @param license 组织机构代码证或营业执照–临时素材mediaid(组织号必填)
* @param namingOtherStuff1 其他证明材料---临时素材 mediaid
* @param namingOtherStuff2 其他证明材料---临时素材 mediaid
* @return .
* @throws WxErrorException .
*/
WxFastMaSetNickameResult setNickname(String nickname, String idCard, String license, String namingOtherStuff1,
String namingOtherStuff2) throws WxErrorException;
/**
* 3 小程序改名审核状态查询
*
* @param auditId 审核单id
* @return .
* @throws WxErrorException .
*/
WxFastMaQueryNicknameStatusResult querySetNicknameStatus(String auditId) throws WxErrorException;
/**
* 4. 微信认证名称检测
*
* @param nickname 名称
* @return .
* @throws WxErrorException .
*/
WxFastMaCheckNickameResult checkWxVerifyNickname(String nickname) throws WxErrorException;
/**
* 5.修改头像
* <pre>
* 图片格式只支持:BMP、JPEG、JPG、GIF、PNG,大小不超过2M
* 注:实际头像始终为正方形
* </pre>
*
* @param headImgMediaId 头像素材media_id
* @param x1 裁剪框左上角x坐标(取值范围:[0, 1])
* @param y1 裁剪框左上角y坐标(取值范围:[0, 1])
* @param x2 裁剪框右下角x坐标(取值范围:[0, 1])
* @param y2 裁剪框右下角y坐标(取值范围:[0, 1])
* @return .
* @throws WxErrorException .
*/
WxOpenResult modifyHeadImage(String headImgMediaId, float x1, float y1, float x2, float y2) throws WxErrorException;
/**
* 6.修改功能介绍
*
* @param signature 简介:4-120字
* @return .
* @throws WxErrorException .
*/
WxOpenResult modifySignature(String signature) throws WxErrorException;
/**
* 7.1 获取换绑管理员URL
* @param redirectUri 跳转URL
* @param appId 公众号的 appid
* @return 换绑管理员URL
*/
String getComponentRebindAdminUrl(String redirectUri, String appId) throws UnsupportedEncodingException;
/**
* 7.3 管理员换绑
*
* @param taskId 换绑管理员任务序列号(公众平台最终点击提交回跳到第三方平台时携带)
* @return .
* @throws WxErrorException .
*/
WxOpenResult componentRebindAdmin(String taskId) throws WxErrorException;
/**
* 8.1 获取账号可以设置的所有类目
* <pre>
* 因为不同类目含有特定字段
* 目前没有完整的类目信息数据
* 为保证兼容性,放弃将response转换为实体
* </pre>
*
* @return .
* @throws WxErrorException .
*/
String getAllCategories() throws WxErrorException;
/**
* 8.2获取不同类型主体可设置的类目
*/
WxOpenGetAllCategoriesByTypeResult getAllCategoriesByType(String verifyType) throws WxErrorException;
/**
* 8.3添加类目
*
* @param categoryList 类目列表
* @return .
* @throws WxErrorException .
*/
WxOpenResult addCategory(List<WxFastMaCategory> categoryList) throws WxErrorException;
/**
* 8.4删除类目
*
* @param first 一级类目ID
* @param second 二级类目ID
* @return .
* @throws WxErrorException .
*/
WxOpenResult deleteCategory(int first, int second) throws WxErrorException;
/**
* 8.5获取账号已经设置的所有类目
*
* @return .
* @throws WxErrorException .
*/
WxFastMaBeenSetCategoryResult getCategory() throws WxErrorException;
/**
* 8.6修改类目
*
* @param category 实体
* @return .
* @throws WxErrorException .
*/
WxOpenResult modifyCategory(WxFastMaCategory category) throws WxErrorException;
/**
* 8.7 获取类目名称信息
* <pre>
* 获取所有类目名称信息,用于给用户展示选择
* https://developers.weixin.qq.com/doc/oplatform/openApi/miniprogram-management/category-management/api_getallcategoryname.html
* </pre>
*
* @return 类目名称列表
* @throws WxErrorException .
*/
WxOpenMaCategoryNameListResult getAllCategoryName() throws WxErrorException;
/**
* 获取订单页Path信息
*
* @param infoType 0:线上版,1:审核版
* @return 订单页Path信息
* @throws WxErrorException .
*/
WxOpenMaGetOrderPathResult getOrderPathInfo(int infoType) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMinishopGoodsService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMinishopGoodsService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.minishopgoods.AddMinishopGoodsSPU;
import me.chanjar.weixin.open.bean.minishopgoods.GoodsCatList;
import me.chanjar.weixin.open.bean.minishopgoods.ParentCatId;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
/**
* 微信小商城 商品
* @author xiaojintao
*/
public interface WxOpenMinishopGoodsService {
/**
* 获取类目详情 接入商品前必须接口
*/
String getMinishopGoodsCatUrl = "https://api.weixin.qq.com/product/category/get";
/**
* SPU接口(修改需要重新上架商品) 添加商品 POST
*/
String addMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/add";
/**
* SPU接口(修改需要重新上架商品) 删除商品 POST
*/
String delMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/del";
/**
* SPU接口(修改需要重新上架商品) 获取商品 POST
*/
String getMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/get";
/**
* SPU接口(修改需要重新上架商品) 获取商品列表 POST
*/
String getListMinishopGoodsSPUURL = "https://api.weixin.qq.com/product/spu/get_list";
/**
* SPU接口(修改需要重新上架商品) 搜索商品 POST
*/
String searchMinishopGoodsSPUURL = "https://api.weixin.qq.com/product/spu/search";
/**
* SPU接口(修改需要重新上架商品) 更新商品 POST
*/
String updateMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/update";
/**
* SPU接口(修改需要重新上架商品) 上架商品 POST
*/
String listingMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/listing";
/**
* SPU接口(修改需要重新上架商品) 下架商品 POST
*/
String delistingMinishopGoodsSPUUrl = "https://api.weixin.qq.com/product/spu/delisting";
/**
* SKU接口(修改后需重新上架商品) 添加SKU POST
*/
String addMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/add";
/**
* SKU接口(修改后需重新上架商品) 批量添加SKU POST
*/
String batchAddMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/batch_add";
/**
* SKU接口(修改后需重新上架商品) 批量添加SKU POST
*/
String delMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/del";
/**
* SKU接口(修改后需重新上架商品) 获取SKU信息 POST
*/
String getMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/get";
/**
* SKU接口(修改后需重新上架商品) 批量获取SKU信息 POST
*/
String getListMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/get_list";
/**
* SKU接口(修改后需重新上架商品) 批量获取SKU信息 POST
*/
String updateMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/update";
/**
* SKU接口(修改后需重新上架商品) 更新SKU价格 POST
*/
String updatePriceMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/sku/update_price";
/**
* SKU接口(修改后需重新上架商品) 更新库存 POST
*/
String updateStockMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/stock/update";
/**
* SKU接口(修改后需重新上架商品) 获取库存 POST
*/
String getStockMinishopGoodsSKUUrl = "https://api.weixin.qq.com/product/stock/get";
/**
* 获取 商品类目
*/
GoodsCatList getMinishopGoodsCat(ParentCatId fCatId) throws WxErrorException;
/**
* 新增商品SPU
* @param dto
* @return
*/
WxOpenResult addMinishopGoodsSPU(AddMinishopGoodsSPU dto) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import java.io.File;
/**
* The interface Wx open service.
*
* @author <a href="https://github.com/007gzs">007</a>
*/
public interface WxOpenService {
/**
* Gets wx open component service.
*
* @return the wx open component service
*/
WxOpenComponentService getWxOpenComponentService();
/**
* Gets wx open config storage.
*
* @return the wx open config storage
*/
WxOpenConfigStorage getWxOpenConfigStorage();
/**
* Sets wx open config storage.
*
* @param wxOpenConfigStorage the wx open config storage
*/
void setWxOpenConfigStorage(WxOpenConfigStorage wxOpenConfigStorage);
/**
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
*
* @param url the url
* @param queryParam the query param
* @return the string
* @throws WxErrorException the wx error exception
*/
String get(String url, String queryParam) throws WxErrorException;
/**
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的POST请求
*
* @param url the url
* @param postData the post data
* @return the string
* @throws WxErrorException the wx error exception
*/
String post(String url, String postData) throws WxErrorException;
WxMinishopImageUploadResult uploadMinishopMediaFile(String url, File file) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaEmbeddedService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaEmbeddedService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.result.WxOpenMaEmbeddedListResult;
/**
* 半屏小程序管理服务
* <pre>
* <a href="https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/embedded-management/addEmbedded.html">半屏小程序管理</a>
* </pre>
*
* @author Yuan
* @version 1.0.0
* @date 2024-12-04 16:55:19
*/
public interface WxOpenMaEmbeddedService {
/**
* 添加半屏小程序
* <pre>
* 本接口用于添加半屏小程序
* </pre>
*/
String API_ADD_EMBEDDED = "https://api.weixin.qq.com/wxaapi/wxaembedded/add_embedded";
/**
* 删除半屏小程序
* <pre>
* 用本接口可以删除已经获得授权调用的半屏小程序
* 说明:通过add_embedded接口添加半屏小程序后,可通过当前接口删除已经添加到半屏小程序列表的小程序
* </pre>
*/
String API_DELETE_EMBEDDED = "https://api.weixin.qq.com/wxaapi/wxaembedded/del_embedded";
/**
* 获取半屏小程序调用列表
* <pre>
* 调用本接口可以获取半屏小程序调用列表
* 说明:通过addEmbedded接口添加半屏小程序后,可通过当前接口获取半屏小程序调用列表
* </pre>
*/
String API_GET_EMBEDDED_LIST = "https://api.weixin.qq.com/wxaapi/wxaembedded/get_list";
/**
* 取消授权小程序
* <pre>
* 调用本接口可以取消已经授权的小程序
* 说明:可通过get_own_list接口获取当前半屏小程序已经授权的小程序列表,可通过当前接口取消对某个小程序的调用权限
* </pre>
*/
String API_DELETE_AUTHORIZED_EMBEDDED = "https://api.weixin.qq.com/wxaapi/wxaembedded/del_authorize";
/**
* 获取半屏小程序授权列表
* <pre>
* 调用本接口可以获取半屏小程序授权列表
* 说明:一个半屏小程序可授权给1000个小程序调用,通过该接口可获取已经授权的小程序列表
* </pre>
*/
String API_GET_OWN_LIST = "https://api.weixin.qq.com/wxaapi/wxaembedded/get_own_list";
/**
* 设置授权方式
*/
String API_SET_AUTHORIZED_EMBEDDED = "https://api.weixin.qq.com/wxaapi/wxaembedded/set_authorize";
/**
* 添加半屏小程序
*
* @param embeddedAppId 半屏小程序appId
* @param applyReason 申请理由
* @author Yuan
* @date 2024-12-04 17:33:33
*/
void addEmbedded(String embeddedAppId, String applyReason) throws WxErrorException;
/**
* 删除半屏小程序
*
* @param embeddedAppId 半屏小程序appId
* @author Yuan
* @date 2024-12-04 17:33:33
*/
void deleteEmbedded(String embeddedAppId) throws WxErrorException;
/**
* 获取半屏小程序调用列表
*
* @return {@link WxOpenMaEmbeddedListResult }
* @author Yuan
* @date 2024-12-04 17:33:33
*/
WxOpenMaEmbeddedListResult getEmbeddedList() throws WxErrorException;
/**
* 取消授权小程序
*
* @param embeddedAppId 半屏小程序appId
* @author Yuan
* @date 2024-12-04 17:33:33
*/
void deleteAuthorizedEmbedded(String embeddedAppId) throws WxErrorException;
/**
* 获取半屏小程序授权列表,默认分页起始值为0,一次拉取最大值为1000
*
* @return {@link WxOpenMaEmbeddedListResult }
* @author Yuan
* @date 2024-12-04 17:33:33
*/
WxOpenMaEmbeddedListResult getOwnList() throws WxErrorException;
/**
* 获取半屏小程序授权列表
*
* @param start 分页起始值 ,默认值为0
* @param num 一次拉取最大值,最大 1000,默认值为10
* @return {@link WxOpenMaEmbeddedListResult }
* @author Yuan
* @date 2024-12-04 17:33:33
*/
WxOpenMaEmbeddedListResult getOwnList(Integer start, Integer num) throws WxErrorException;
/**
* 设置授权方式
*
* @param flag 半屏小程序授权方式。0表示需要管理员验证;1表示自动通过;2表示自动拒绝。
* @author Yuan
* @date 2024-12-04 17:33:33
*/
void setAuthorizedEmbedded(Integer flag) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaPrivacyService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaPrivacyService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.privacy.*;
/**
* 微信第三方平台 小程序用户隐私保护指引接口 / 申请隐私接口
* (从2022年4月18日开始,部分小程序前端 api 需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。)
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html">配置小程序用户隐私保护指引</a>、<a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">获取接口列表</a>
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
*/
public interface WxOpenMaPrivacyService {
/**
* 1 设置小程序用户隐私保护指引
*/
String OPEN_SET_PRIVACY_SETTING = "https://api.weixin.qq.com/cgi-bin/component/setprivacysetting";
/**
* 2 查询小程序用户隐私保护指引
*/
String OPEN_GET_PRIVACY_SETTING = "https://api.weixin.qq.com/cgi-bin/component/getprivacysetting";
/**
* 3 上传小程序用户隐私保护指引文件
*/
String OPEN_UPLOAD_PRIVACY_FILE = "https://api.weixin.qq.com/cgi-bin/component/uploadprivacyextfile";
/**
* 4 获取接口列表 从2022年4月18日开始,部分小程序前端 api 需申请后
*/
String GET_PRIVATE_INTERFACE = "https://api.weixin.qq.com/wxa/security/get_privacy_interface";
/**
* 5 申请接口 从2022年4月18日开始,部分小程序前端 api 需申请后
*/
String APPLY_PRIVATE_INTERFACE = "https://api.weixin.qq.com/wxa/security/apply_privacy_interface";
/**
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/get_privacy_setting.html">查询小程序用户隐私保护指引</a>
*
* @param privacyVer 1表示现网版本,即,传1则该接口返回的内容是现网版本的;2表示开发版,即,传2则该接口返回的内容是开发版本的。默认是2。
* @return 查询结果
* @throws WxErrorException 如果出错,抛出此异常
*/
GetPrivacySettingResult getPrivacySetting(Integer privacyVer) throws WxErrorException;
/**
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/set_privacy_setting.html">设置小程序用户隐私保护指引</a>
*
* @param dto 参数对象
* @throws WxErrorException 如果出错,抛出此异常
*/
void setPrivacySetting(SetPrivacySetting dto) throws WxErrorException;
/**
* 上传小程序用户隐私保护指引文件
* 本接口用于上传自定义的小程序的用户隐私保护指引
* 仅限文本文件, 限制文件大小为不超过100kb,否则会报错
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/privacy_config/upload_privacy_exfile.html">上传小程序用户隐私保护指引文件</a>
*
* @param content 文本文件内容
* @return 上传结果
* @throws WxErrorException 如果出错,抛出此异常
*/
UploadPrivacyFileResult uploadPrivacyFile(String content) throws WxErrorException;
/**
* 隐私接口-获取接口列表
* 从2022年4月18日开始,部分小程序前端 api 需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">隐私接口-获取接口列表</a>
*
* @return 获取结果
* @throws WxErrorException 如果出错,抛出此异常
*/
GetPrivacyInterfaceResult getPrivacyInterface() throws WxErrorException;
/**
* 隐私接口-申请接口
* 从2022年4月18日开始,部分小程序前端 api 需申请后,方可使用。该接口用于获取“需申请并审核通过”后才可使用的接口列表。
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/apply_api/get_privacy_interface.html">隐私接口-申请接口</a>
*
* @param dto 请求参数
* @return 获取结果
* @throws WxErrorException 如果出错,抛出此异常
*/
ApplyPrivacyInterfaceResult applyPrivacyInterface(ApplyPrivacyInterface dto) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenConfigStorage.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenConfigStorage.java | package me.chanjar.weixin.open.api;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import java.util.concurrent.locks.Lock;
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
import me.chanjar.weixin.mp.config.WxMpConfigStorage;
import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken;
import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken;
/**
* The interface Wx open config storage.
*
* @author <a href="https://github.com/007gzs">007</a>
*/
public interface WxOpenConfigStorage {
/**
* Gets component app id.
*
* @return the component app id
*/
String getComponentAppId();
/**
* Sets component app id.
*
* @param componentAppId the component app id
*/
void setComponentAppId(String componentAppId);
/**
* Gets component app secret.
*
* @return the component app secret
*/
String getComponentAppSecret();
/**
* Sets component app secret.
*
* @param componentAppSecret the component app secret
*/
void setComponentAppSecret(String componentAppSecret);
/**
* Gets component token.
*
* @return the component token
*/
String getComponentToken();
/**
* Sets component token.
*
* @param componentToken the component token
*/
void setComponentToken(String componentToken);
/**
* Gets component aes key.
*
* @return the component aes key
*/
String getComponentAesKey();
/**
* Sets component aes key.
*
* @param componentAesKey the component aes key
*/
void setComponentAesKey(String componentAesKey);
/**
* Gets component verify ticket.
*
* @return the component verify ticket
*/
String getComponentVerifyTicket();
/**
* Sets component verify ticket.
*
* @param componentVerifyTicket the component verify ticket
*/
void setComponentVerifyTicket(String componentVerifyTicket);
/**
* Gets component access token.
*
* @return the component access token
*/
String getComponentAccessToken();
/**
* Is component access token expired boolean.
*
* @return the boolean
*/
boolean isComponentAccessTokenExpired();
/** Expire component access token. */
void expireComponentAccessToken();
/**
* Update component access token.
*
* @param componentAccessToken the component access token
*/
void updateComponentAccessToken(WxOpenComponentAccessToken componentAccessToken);
/**
* Gets http proxy host.
*
* @return the http proxy host
*/
String getHttpProxyHost();
/**
* Gets http proxy port.
*
* @return the http proxy port
*/
int getHttpProxyPort();
/**
* Gets http proxy username.
*
* @return the http proxy username
*/
String getHttpProxyUsername();
/**
* Gets http proxy password.
*
* @return the http proxy password
*/
String getHttpProxyPassword();
/**
* http 请求重试间隔
*
* <pre>
* {@link me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl#setRetrySleepMillis(int)}
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setRetrySleepMillis(int)}
* </pre>
*/
int getRetrySleepMillis();
/**
* http 请求最大重试次数
*
* <pre>
* {@link me.chanjar.weixin.mp.api.impl.BaseWxMpServiceImpl#setMaxRetryTimes(int)}
* {@link cn.binarywang.wx.miniapp.api.impl.BaseWxMaServiceImpl#setMaxRetryTimes(int)}
* </pre>
*/
int getMaxRetryTimes();
/**
* Gets apache http client builder.
*
* @return the apache http client builder
*/
ApacheHttpClientBuilder getApacheHttpClientBuilder();
/**
* Gets wx mp config storage.
*
* @param appId the app id
* @return the wx mp config storage
*/
WxMpConfigStorage getWxMpConfigStorage(String appId);
/**
* Gets wx ma config.
*
* @param appId the app id
* @return the wx ma config
*/
WxMaConfig getWxMaConfig(String appId);
/**
* Gets component access token lock.
*
* @return the component access token lock
*/
Lock getComponentAccessTokenLock();
/**
* Gets lock by key.
*
* @param key the key
* @return the lock by key
*/
Lock getLockByKey(String key);
/**
* 应该是线程安全的
*
* @param componentAccessToken 新的accessToken值
* @param expiresInSeconds 过期时间,以秒为单位
*/
void updateComponentAccessToken(String componentAccessToken, int expiresInSeconds);
/**
* 是否自动刷新token
*
* @return the boolean
*/
boolean autoRefreshToken();
/**
* Gets authorizer refresh token.
*
* @param appId the app id
* @return the authorizer refresh token
*/
String getAuthorizerRefreshToken(String appId);
/**
* Sets authorizer refresh token.
*
* @param appId the app id
* @param authorizerRefreshToken the authorizer refresh token
*/
void setAuthorizerRefreshToken(String appId, String authorizerRefreshToken);
/**
* setAuthorizerRefreshToken(String appId, String authorizerRefreshToken) 方法重载方法
*
* @param appId the app id
* @param authorizerRefreshToken the authorizer refresh token
*/
void updateAuthorizerRefreshToken(String appId, String authorizerRefreshToken);
/**
* Gets authorizer access token.
*
* @param appId the app id
* @return the authorizer access token
*/
String getAuthorizerAccessToken(String appId);
/**
* Is authorizer access token expired boolean.
*
* @param appId the app id
* @return the boolean
*/
boolean isAuthorizerAccessTokenExpired(String appId);
/**
* 强制将access token过期掉
*
* @param appId the app id
*/
void expireAuthorizerAccessToken(String appId);
/**
* 应该是线程安全的
*
* @param appId the app id
* @param authorizerAccessToken 要更新的WxAccessToken对象
*/
void updateAuthorizerAccessToken(String appId, WxOpenAuthorizerAccessToken authorizerAccessToken);
/**
* 应该是线程安全的
*
* @param appId the app id
* @param authorizerAccessToken 新的accessToken值
* @param expiresInSeconds 过期时间,以秒为单位
*/
void updateAuthorizerAccessToken(
String appId, String authorizerAccessToken, int expiresInSeconds);
/**
* Gets jsapi ticket.
*
* @param appId the app id
* @return the jsapi ticket
*/
String getJsapiTicket(String appId);
/**
* Is jsapi ticket expired boolean.
*
* @param appId the app id
* @return the boolean
*/
boolean isJsapiTicketExpired(String appId);
/**
* 强制将jsapi ticket过期掉
*
* @param appId the app id
*/
void expireJsapiTicket(String appId);
/**
* 应该是线程安全的
*
* @param appId the app id
* @param jsapiTicket 新的jsapi ticket值
* @param expiresInSeconds 过期时间,以秒为单位
*/
void updateJsapiTicket(String appId, String jsapiTicket, int expiresInSeconds);
/**
* Gets card api ticket.
*
* @param appId the app id
* @return the card api ticket
*/
String getCardApiTicket(String appId);
/**
* Is card api ticket expired boolean.
*
* @param appId the app id
* @return the boolean
*/
boolean isCardApiTicketExpired(String appId);
/**
* 强制将卡券api ticket过期掉
*
* @param appId the app id
*/
void expireCardApiTicket(String appId);
/**
* 应该是线程安全的
*
* @param appId the app id
* @param cardApiTicket 新的cardApi ticket值
* @param expiresInSeconds 过期时间,以秒为单位
*/
void updateCardApiTicket(String appId, String cardApiTicket, int expiresInSeconds);
/**
* 设置第三方平台基础信息
*
* @param componentAppId 第三方平台 appid
* @param componentAppSecret 第三方平台 appsecret
* @param componentToken 消息校验Token
* @param componentAesKey 消息加解密Key
*/
void setWxOpenInfo(
String componentAppId,
String componentAppSecret,
String componentToken,
String componentAesKey);
/** 第三方平台设置API签名 RSA 私钥 */
String getComponentApiSignatureRsaPrivateKey();
void setComponentApiSignatureRsaPrivateKey(String apiSignatureRsaPrivateKey);
/** 第三方平台设置API签名 AES KEY */
String getComponentApiSignatureAesKey();
void setComponentApiSignatureAesKey(String apiSignatureAesKey);
/** 第三方平台设置API签名 RSA 私钥 序号 */
String getComponentApiSignatureRsaPrivateKeySn();
void setComponentApiSignatureRsaPrivateKeySn(String apiSignatureRsaPrivateKeySn);
/** 第三方平台设置API签名 AES key 序号 */
String getComponentApiSignatureAesKeySn();
void setComponentApiSignatureAesKeySn(String apiSignatureAesKeySn);
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaAuthAndIcpService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaAuthAndIcpService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.authandicp.WxOpenQueryAuthAndIcpResult;
import me.chanjar.weixin.open.bean.authandicp.WxOpenSubmitAuthAndIcpParam;
import me.chanjar.weixin.open.bean.authandicp.WxOpenSubmitAuthAndIcpResult;
/**
* 微信第三方平台 小程序认证及备案
* @author 痴货
* @createTime 2025/06/18 23:00
*/
public interface WxOpenMaAuthAndIcpService {
String QUERY_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/query_auth_and_icp";
String SUBMIT_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/submit_auth_and_icp";
/**
* 查询小程序认证及备案进度。
* @param procedureId 小程序认证及备案任务流程id
* @return 小程序认证及备案进度
*/
WxOpenQueryAuthAndIcpResult queryAuthAndIcp(String procedureId) throws WxErrorException;
/**
* 提交小程序认证及备案信息。
* @param param 提交小程序认证及备案信息参数
* @return 提交结果
*/
WxOpenSubmitAuthAndIcpResult submitAuthAndIcp(WxOpenSubmitAuthAndIcpParam param) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenFastMaService.java | package me.chanjar.weixin.open.api;
import cn.binarywang.wx.miniapp.api.WxMaService;
/**
* <pre>
* 微信开放平台【快速创建小程序】的专用接口
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21528465979XX32V&token=&lang=zh_CN
* 注意:该类的接口仅限通过快速创建小程序接口的小程序使用
* </pre>
*
* @author Hipple
* created on 2019/01/23
* @deprecated 2021-06-23 本接口原有方法并非仅快速创建小程序的专用接口,普通小程序授权到第三方平台皆可使用,所以请使用 {@link WxOpenMaBasicService} 类替代。获取方法: WxOpenComponentService.getWxMaServiceByAppid(maApppId).getBasicService()
*/
@Deprecated
public interface WxOpenFastMaService extends WxOpenMaBasicService, WxMaService {
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaService.java | package me.chanjar.weixin.open.api;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaAuditMediaUploadResult;
import cn.binarywang.wx.miniapp.bean.WxMaUploadAuthMaterialResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.ma.WxMaPrefetchDomain;
import me.chanjar.weixin.open.bean.ma.WxMaScheme;
import me.chanjar.weixin.open.bean.message.WxOpenMaSubmitAuditMessage;
import me.chanjar.weixin.open.bean.message.WxOpenMaVerifyBetaWeappMessage;
import me.chanjar.weixin.open.bean.result.*;
import java.io.File;
import java.util.List;
import java.util.Map;
/**
* <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489144594_DhNoV&token=&lang=zh_CN">微信开放平台代小程序实现服务能力</a>
*
* @author yqx
* created on 2018 /9/12
*/
public interface WxOpenMaService extends WxMaService {
/**
* 设置小程序服务器域名.
*
* <pre>
* 授权给第三方的小程序,其服务器域名只可以为第三方的服务器,当小程序通过第三方发布代码上线后,小程序原先自己配置的服务器域名将被删除,
* 只保留第三方平台的域名,所以第三方平台在代替小程序发布代码之前,需要调用接口为小程序添加第三方自身的域名。
* 提示:需要先将域名登记到第三方平台的小程序服务器域名中,才可以调用接口进行配置
* </pre>
*/
String API_MODIFY_DOMAIN = "https://api.weixin.qq.com/wxa/modify_domain";
/**
* 快速配置小程序服务器域名
*/
String API_MODIFY_DOMAIN_DIRECTLY = "https://api.weixin.qq.com/wxa/modify_domain_directly";
/**
* 设置小程序业务域名(仅供第三方代小程序调用)
* <pre>
* 授权给第三方的小程序,其业务域名只可以为第三方的服务器,当小程序通过第三方发布代码上线后,小程序原先自己配置的业务域名将被删除,
* 只保留第三方平台的域名,所以第三方平台在代替小程序发布代码之前,需要调用接口为小程序添加业务域名。
* 提示:
* 1、需要先将域名登记到第三方平台的小程序业务域名中,才可以调用接口进行配置。
* 2、为授权的小程序配置域名时支持配置子域名,例如第三方登记的业务域名如为qq.com,则可以直接将qq.com及其子域名(如xxx.qq.com)也配置到授权的小程序中。
* </pre>
*/
String API_SET_WEBVIEW_DOMAIN = "https://api.weixin.qq.com/wxa/setwebviewdomain";
/**
* 快速配置小程序业务域名
*/
String API_SET_WEBVIEW_DOMAIN_DIRECTLY = "https://api.weixin.qq.com/wxa/setwebviewdomain_directly";
/**
* 获取业务域名校验文件(仅供第三方代小程序调用)
*/
String API_GET_WEBVIEW_DOMAIN_CONFIRM_FILE = "https://api.weixin.qq.com/wxa/get_webviewdomain_confirmfile";
/**
* 获取帐号基本信息
* <pre>
* GET请求
* 注意:需要使用1.3环节获取到的新创建小程序appid及authorization_code换取authorizer_refresh_token进而得到authorizer_access_token。
* </pre>
*/
String API_GET_ACCOUNT_BASICINFO = "https://api.weixin.qq.com/cgi-bin/account/getaccountbasicinfo";
/**
* 绑定微信用户为小程序体验者
*/
String API_BIND_TESTER = "https://api.weixin.qq.com/wxa/bind_tester";
/**
* 解除绑定微信用户为小程序体验者
*/
String API_UNBIND_TESTER = "https://api.weixin.qq.com/wxa/unbind_tester";
/**
* 获取体验者列表
*/
String API_GET_TESTERLIST = "https://api.weixin.qq.com/wxa/memberauth";
/**
* 以下接口基础信息设置
* <p>
* <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21517799059ZSEMr&token=6f965b5daf30a98a6bbd2a386faea5c934e929bf&lang=zh_CN">...</a>
* </p>
* 1. 设置小程序隐私设置(是否可被搜索)
*/
String API_CHANGE_WXA_SEARCH_STATUS = "https://api.weixin.qq.com/wxa/changewxasearchstatus";
/**
* 2. 查询小程序当前隐私设置(是否可被搜索)
*/
String API_GET_WXA_SEARCH_STATUS = "https://api.weixin.qq.com/wxa/getwxasearchstatus";
/**
* 3.1. 获取展示的公众号信息
*/
String API_GET_SHOW_WXA_ITEM = "https://api.weixin.qq.com/wxa/getshowwxaitem";
/**
* 3.2 设置展示的公众号
*/
String API_UPDATE_SHOW_WXA_ITEM = "https://api.weixin.qq.com/wxa/updateshowwxaitem";
/**
* 以下接口为三方平台代小程序实现的代码管理功能
* <p>
* <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489140610_Uavc4&token=fe774228c66725425675810097f9e48d0737a4bf&lang=zh_CN">...</a>
* </p>
* 1. 为授权的小程序帐号上传小程序代码
*/
String API_CODE_COMMIT = "https://api.weixin.qq.com/wxa/commit";
/**
* 2. 获取体验小程序的体验二维码
*/
String API_TEST_QRCODE = "https://api.weixin.qq.com/wxa/get_qrcode";
/**
* 3. 试用小程序快速认证
*/
String API_VERIFY_BETA_WEAPP = "https://api.weixin.qq.com/wxa/verifybetaweapp";
/**
* 4. 获取授权小程序帐号的可选类目
*/
String API_GET_CATEGORY = "https://api.weixin.qq.com/wxa/get_category";
/**
* 5. 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用)
*/
String API_GET_PAGE = "https://api.weixin.qq.com/wxa/get_page";
/**
* 6. 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用)
*/
String API_SUBMIT_AUDIT = "https://api.weixin.qq.com/wxa/submit_audit";
/**
* 7. 查询某个指定版本的审核状态(仅供第三方代小程序调用)
*/
String API_GET_AUDIT_STATUS = "https://api.weixin.qq.com/wxa/get_auditstatus";
/**
* 8. 查询最新一次提交的审核状态(仅供第三方代小程序调用)
*/
String API_GET_LATEST_AUDIT_STATUS = "https://api.weixin.qq.com/wxa/get_latest_auditstatus";
/**
* 9. 发布已通过审核的小程序(仅供第三方代小程序调用)
*/
String API_RELEASE = "https://api.weixin.qq.com/wxa/release";
/**
* 10.1 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
*/
String API_CHANGE_VISITSTATUS = "https://api.weixin.qq.com/wxa/change_visitstatus";
/**
* 10.2 查询小程序线上代码的可见状态(仅供第三方代小程序调用)
*/
String API_GET_VISITSTATUS = "https://api.weixin.qq.com/wxa/getvisitstatus";
/**
* 11.小程序版本回退(仅供第三方代小程序调用)
*/
String API_REVERT_CODE_RELEASE = "https://api.weixin.qq.com/wxa/revertcoderelease";
/**
* 12.查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
*/
String API_GET_WEAPP_SUPPORT_VERSION = "https://api.weixin.qq.com/cgi-bin/wxopen/getweappsupportversion";
/**
* 13.设置最低基础库版本(仅供第三方代小程序调用)
*/
String API_SET_WEAPP_SUPPORT_VERSION = "https://api.weixin.qq.com/cgi-bin/wxopen/setweappsupportversion";
/**
* 14.设置小程序“扫普通链接二维码打开小程序”能力
* <p>
* <a href="https://mp.weixin.qq.com/debug/wxadoc/introduction/qrcode.html">...</a>
* 14.1 增加或修改二维码规则
*/
String API_QRCODE_JUMP_ADD = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpadd";
/**
* 14.2 获取已设置的二维码规则
*/
String API_QRCODE_JUMP_GET = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpget";
/**
* 14.3 获取校验文件名称及内容
*/
String API_QRCODE_JUMP_DOWNLOAD = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdownload";
/**
* 14.4 删除已设置的二维码规则
*/
String API_QRCODE_JUMP_DELETE = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumpdelete";
/**
* 14.5 发布已设置的二维码规则
*/
String API_QRCODE_JUMP_PUBLISH = "https://api.weixin.qq.com/cgi-bin/wxopen/qrcodejumppublish";
/**
* 15.小程序审核撤回
* <p>
* 单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次。
* </p>
*/
String API_UNDO_CODE_AUDIT = "https://api.weixin.qq.com/wxa/undocodeaudit";
/**
* 16.1 小程序分阶段发布-分阶段发布接口
*/
String API_GRAY_RELEASE = "https://api.weixin.qq.com/wxa/grayrelease";
/**
* 16.2 小程序分阶段发布-取消分阶段发布
*/
String API_REVERT_GRAY_RELEASE = "https://api.weixin.qq.com/wxa/revertgrayrelease";
/**
* 16.3 小程序分阶段发布-查询当前分阶段发布详情
*/
String API_GET_GRAY_RELEASE_PLAN = "https://api.weixin.qq.com/wxa/getgrayreleaseplan";
/**
* 17 获取隐私接口检测结果
*/
String API_GET_CODE_PRIVACY_INFO = "https://api.weixin.qq.com/wxa/security/get_code_privacy_info";
/**
* 查询服务商的当月提审限额和加急次数(Quota)
*/
String API_QUERY_QUOTA = "https://api.weixin.qq.com/wxa/queryquota";
/**
* 加急审核申请
*/
String API_SPEED_AUDIT = "https://api.weixin.qq.com/wxa/speedupaudit";
/**
* 获取小程序scheme码
*/
String API_GENERATE_SCHEME = "https://api.weixin.qq.com/wxa/generatescheme";
/**
* 通过此接口开通自定义版交易组件,将同步返回接入结果,不再有异步事件回调。
*/
String API_REGISTER_SHOP_COMPONENT = "https://api.weixin.qq.com/shop/register/apply";
/**
* 小程序审核 提审素材上传接口
*/
String API_AUDIT_UPLOAD_MEDIA = "https://api.weixin.qq.com/wxa/uploadmedia";
/**
* 小程序管理-查询小程序版本信息
*/
String API_GET_VERSION_INFO = "https://api.weixin.qq.com/wxa/getversioninfo";
/**
* 设置DNS预解析域名
*/
String API_WX_SET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/set_prefetchdnsdomain";
/**
* 获取DNS预解析域名
*/
String API_GET_PREFETCH_DOMAIN = "https://api.weixin.qq.com/wxa/get_prefetchdnsdomain";
/**
* 申请开通直播
*/
String API_WX_APPLY_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/applyliveinfo";
/**
* 小程序认证上传补充材料
*/
String API_UPLOAD_AUTH_MATERIAL = "https://api.weixin.qq.com/wxa/sec/uploadauthmaterial";
/**
* 获得小程序的域名配置信息
*
* @return the domain
* @throws WxErrorException the wx error exception
*/
WxOpenMaDomainResult getDomain() throws WxErrorException;
/**
* 修改域名
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/Server_Address_Configuration.html">文档地址</a>
*
* @param action delete删除, set覆盖, get获取
* @param requestDomains request 合法域名;当 action 是 get 时不需要此字段
* @param wsRequestDomains socket 合法域名;当 action 是 get 时不需要此字段
* @param uploadDomains uploadFile 合法域名;当 action 是 get 时不需要此字段
* @param downloadDomains downloadFile 合法域名;当 action 是 get 时不需要此字段
* @param tcpDomains tcp 合法域名;当 action 是 get 时不需要此字段
* @param udpDomains udp 合法域名;当 action 是 get 时不需要此字段
* @return the wx open ma domain result
* @throws WxErrorException the wx error exception
*/
WxOpenMaDomainResult modifyDomain(String action, List<String> requestDomains, List<String> wsRequestDomains,
List<String> uploadDomains, List<String> downloadDomains,
List<String> udpDomains, List<String> tcpDomains) throws WxErrorException;
/**
* 快速配置小程序服务器域名
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/modify_domain_directly.html">文档地址</a>
*
* @param action add添加, delete删除, set覆盖, get获取
* @param requestDomains request 合法域名;当 action 是 get 时不需要此字段
* @param wsRequestDomains socket 合法域名;当 action 是 get 时不需要此字段
* @param uploadDomains uploadFile 合法域名;当 action 是 get 时不需要此字段
* @param downloadDomains downloadFile 合法域名;当 action 是 get 时不需要此字段
* @param tcpDomains tcp 合法域名;当 action 是 get 时不需要此字段
* @param udpDomains udp 合法域名;当 action 是 get 时不需要此字段
* @return the wx open ma domain result
* @throws WxErrorException the wx error exception
*/
WxOpenMaDomainResult modifyDomainDirectly(String action, List<String> requestDomains, List<String> wsRequestDomains,
List<String> uploadDomains, List<String> downloadDomains,
List<String> udpDomains, List<String> tcpDomains) throws WxErrorException;
/**
* 获取小程序的业务域名
*
* @return 直接返回字符串 web view domain
* @throws WxErrorException the wx error exception
*/
String getWebViewDomain() throws WxErrorException;
/**
* 获取小程序的业务域名
*
* @return web view domain info
* @throws WxErrorException the wx error exception
*/
WxOpenMaWebDomainResult getWebViewDomainInfo() throws WxErrorException;
/**
* 设置小程序的业务域名
*
* @param action add添加, delete删除, set覆盖
* @param domainList the domain list
* @return 直接返回字符串 web view domain
* @throws WxErrorException the wx error exception
*/
String setWebViewDomain(String action, List<String> domainList) throws WxErrorException;
/**
* 设置小程序的业务域名
*
* @param action add添加, delete删除, set覆盖
* @param domainList the domain list
* @return web view domain info
* @throws WxErrorException the wx error exception
*/
WxOpenMaWebDomainResult setWebViewDomainInfo(String action, List<String> domainList) throws WxErrorException;
/**
* 快速配置小程序业务域名
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/setwebviewdomain_directly.html">文档地址</a>
*
* @param action add添加, delete删除, set覆盖, get获取
* @param domainList the domain list
* @return 直接返回字符串
* @throws WxErrorException the wx error exception
*/
String setWebViewDomainDirectly(String action, List<String> domainList) throws WxErrorException;
/**
* 快速配置小程序业务域名
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/setwebviewdomain_directly.html">文档地址</a>
*
* @param action add添加, delete删除, set覆盖, get获取
* @param domainList the domain list
* @return web view domain info
* @throws WxErrorException the wx error exception
*/
WxOpenMaWebDomainResult setWebViewDomainDirectlyInfo(String action, List<String> domainList) throws WxErrorException;
/**
* 获取业务域名校验文件
*
* @return 业务域名校验文件信息
* @throws WxErrorException 操作失败时抛出,具体错误码请看文档
*/
WxOpenMaDomainConfirmFileResult getWebviewDomainConfirmFile() throws WxErrorException;
/**
* 获取小程序的信息
*
* @return the account basic info
* @throws WxErrorException the wx error exception
*/
String getAccountBasicInfo() throws WxErrorException;
/**
* 绑定小程序体验者
*
* @param wechatId 体验者微信号(不是openid)
* @return wx open ma bind tester result
* @throws WxErrorException the wx error exception
*/
WxOpenMaBindTesterResult bindTester(String wechatId) throws WxErrorException;
/**
* 解除绑定小程序体验者
*
* @param wechatId 体验者微信号(不是openid)
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult unbindTester(String wechatId) throws WxErrorException;
/**
* 解除绑定小程序体验者,其他平台绑定的体验者无法获取到wechatid,可用此方法解绑,详见文档
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/unbind_tester.html
*
* @param userStr 人员对应的唯一字符串, 可通过获取已绑定的体验者列表获取人员对应的字符串
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult unbindTesterByUserStr(String userStr) throws WxErrorException;
/**
* 获得体验者列表
*
* @return the tester list
* @throws WxErrorException the wx error exception
*/
WxOpenMaTesterListResult getTesterList() throws WxErrorException;
/**
* 设置小程序隐私设置(是否可被搜索)
*
* @param status 1表示不可搜索,0表示可搜索
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult changeWxaSearchStatus(Integer status) throws WxErrorException;
/**
* 2. 查询小程序当前隐私设置(是否可被搜索)
*
* @return the wxa search status
* @throws WxErrorException the wx error exception
*/
WxOpenMaSearchStatusResult getWxaSearchStatus() throws WxErrorException;
/**
* 3.1 获取展示的公众号信息
*
* @return the show wxa item
* @throws WxErrorException the wx error exception
*/
WxOpenMaShowItemResult getShowWxaItem() throws WxErrorException;
/**
* 3.2 设置展示的公众号
*
* @param flag 0 关闭,1 开启
* @param mpAppId 如果开启,需要传新的公众号appid
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult updateShowWxaItem(Integer flag, String mpAppId) throws WxErrorException;
/**
* 1、为授权的小程序帐号上传小程序代码
*
* @param templateId 代码模板ID
* @param userVersion 用户定义版本
* @param userDesc 用户定义版本描述
* @param extJsonObject 为了方便第三方平台的开发者引入 extAppid 的开发调试工作,引入ext.json配置文件概念,该参数则是用于控制ext.json配置文件的内容。
* 如果是普通模板可以使用 WxMaOpenCommitExtInfo 类构造参数,
* 如果是标准模板可支持的参数为:{"extAppid":'', "ext": {}, "window": {}} 所以可以使用 WxMaOpenCommitStandardExt 构造参数
* @return the wx open result
* @throws WxErrorException the wx error exception
* @see me.chanjar.weixin.open.bean.ma.WxMaOpenCommitStandardExt
* @see me.chanjar.weixin.open.bean.ma.WxMaOpenCommitExtInfo
*/
WxOpenResult codeCommit(Long templateId, String userVersion, String userDesc, Object extJsonObject) throws WxErrorException;
/**
* 获取体验小程序的体验二维码
*
* @param pagePath the page path
* @param params the params
* @return the test qrcode
* @throws WxErrorException the wx error exception
*/
File getTestQrcode(String pagePath, Map<String, String> params) throws WxErrorException;
/**
* 试用小程序快速认证
*
* @param verifyBetaWeappMessage the verify mini program message
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult verifyBetaWeapp(WxOpenMaVerifyBetaWeappMessage verifyBetaWeappMessage) throws WxErrorException;
/**
* 获取授权小程序帐号的可选类目
* <p>
* 注意:该接口可获取已设置的二级类目及用于代码审核的可选三级类目。
* </p>
*
* @return the category list
* @throws WxErrorException the wx error exception
*/
WxOpenMaCategoryListResult getCategoryList() throws WxErrorException;
/**
* 获取小程序的第三方提交代码的页面配置(仅供第三方开发者代小程序调用)
*
* @return page list
* @throws WxErrorException the wx error exception
*/
WxOpenMaPageListResult getPageList() throws WxErrorException;
/**
* 将第三方提交的代码包提交审核(仅供第三方开发者代小程序调用)
* <p>
* <b>重要提示:审核额度限制</b>
* </p>
* <ul>
* <li>每个第三方平台账号每月有审核额度限制(默认20次,可通过 {@link #queryQuota()} 查询)</li>
* <li>每次调用 submitAudit 提交一个小程序审核时,会消耗1个审核额度</li>
* <li>建议在提交审核前,先调用 {@link #queryQuota()} 检查剩余额度</li>
* <li>如需增加额度,请联系微信开放平台客服</li>
* </ul>
* <p>
* <b>最佳实践:</b>
* </p>
* <pre>{@code
* // 1. 先查询剩余额度
* WxOpenMaQueryQuotaResult quota = wxOpenMaService.queryQuota();
* if (quota.getRest() <= 0) {
* throw new RuntimeException("审核额度不足,剩余:" + quota.getRest());
* }
*
* // 2. 提交审核
* WxOpenMaSubmitAuditMessage message = new WxOpenMaSubmitAuditMessage();
* message.setItemList(itemList);
* WxOpenMaSubmitAuditResult result = wxOpenMaService.submitAudit(message);
* }</pre>
*
* @param submitAuditMessage the submit audit message
* @return the wx open ma submit audit result
* @throws WxErrorException the wx error exception
* @see #queryQuota() 查询审核额度
* @see #speedAudit(Long) 加急审核
*/
WxOpenMaSubmitAuditResult submitAudit(WxOpenMaSubmitAuditMessage submitAuditMessage) throws WxErrorException;
/**
* 查询某个指定版本的审核状态(仅供第三方代小程序调用)
*
* @param auditId the auditid
* @return the audit status
* @throws WxErrorException the wx error exception
*/
WxOpenMaQueryAuditResult getAuditStatus(Long auditId) throws WxErrorException;
/**
* 8. 查询最新一次提交的审核状态(仅供第三方代小程序调用)
*
* @return 。
* @throws WxErrorException 。
*/
WxOpenMaQueryAuditResult getLatestAuditStatus() throws WxErrorException;
/**
* 9. 发布已通过审核的小程序(仅供第三方代小程序调用)
* <p>
* 请填写空的数据包,POST的json数据包为空即可。
* </p>
*
* @return 。
* @throws WxErrorException 。
*/
WxOpenResult releaseAudited() throws WxErrorException;
/**
* 10.1 修改小程序线上代码的可见状态(仅供第三方代小程序调用)
*
* @param action the action
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult changeVisitStatus(String action) throws WxErrorException;
/**
* 10.2 查询小程序服务状态(仅供第三方代小程序调用)
*
* @return 小程序服务状态
* @throws WxErrorException 查询失败时返回,具体错误码请看此接口的注释文档
*/
WxOpenMaVisitStatusResult getVisitStatus() throws WxErrorException;
/**
* 11. 小程序版本回退(仅供第三方代小程序调用)
*
* @return 。
* @throws WxErrorException 。
*/
WxOpenResult revertCodeRelease() throws WxErrorException;
/**
* 获取可回退的小程序版本
* 调用本接口可以获取可回退的小程序版本(最多保存最近发布或回退的5个版本
* 文档地址: https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/code/get_history_version.html
*
* @return 历史版本信息
* @throws WxErrorException 如果调用微信接口失败抛出此异常
*/
WxOpenMaHistoryVersionResult getHistoryVersion() throws WxErrorException;
/**
* 15. 小程序审核撤回
* <p>
* 单个帐号每天审核撤回次数最多不超过1次,一个月不超过10次。
* </p>
*
* @return 。
* @throws WxErrorException 。
*/
WxOpenResult undoCodeAudit() throws WxErrorException;
/**
* 12. 查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
*
* @return 。
* @throws WxErrorException 。
*/
String getSupportVersion() throws WxErrorException;
/**
* 12. 查询当前设置的最低基础库版本及各版本用户占比 (仅供第三方代小程序调用)
*
* @return . support version info
* @throws WxErrorException .
*/
WxOpenMaWeappSupportVersionResult getSupportVersionInfo() throws WxErrorException;
/**
* 设置最低基础库版本(仅供第三方代小程序调用)
*
* @param version the version
* @return the support version
* @throws WxErrorException the wx error exception
*/
String setSupportVersion(String version) throws WxErrorException;
/**
* 13. 设置最低基础库版本(仅供第三方代小程序调用)
*
* @param version the version
* @return support version info
* @throws WxErrorException the wx error exception
*/
WxOpenResult setSupportVersionInfo(String version) throws WxErrorException;
/**
* 16. 小程序分阶段发布 - 1)分阶段发布接口
*
* @param grayPercentage 灰度的百分比,1到100的整数
* @return . wx open result
* @throws WxErrorException .
*/
WxOpenResult grayRelease(Integer grayPercentage) throws WxErrorException;
/**
* 16. 小程序分阶段发布 - 2)取消分阶段发布
*
* @return . wx open result
* @throws WxErrorException .
*/
WxOpenResult revertGrayRelease() throws WxErrorException;
/**
* 16. 小程序分阶段发布 - 3)查询当前分阶段发布详情
*
* @return . gray release plan
* @throws WxErrorException .
*/
WxOpenMaGrayReleasePlanResult getGrayReleasePlan() throws WxErrorException;
/**
* 17. 获取隐私接口检测结果
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/code-management/getCodePrivacyInfo.html
*
* @return {@link WxOpenMaGetCodePrivacyInfoResult }
* @throws WxErrorException wx错误异常
* @author Yuan
*/
WxOpenMaGetCodePrivacyInfoResult getCodePrivacyInfo() throws WxErrorException;
/**
* 查询服务商的当月提交审核限额和加急次数(Quota)
* <p>
* 文档地址:
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Mini_Programs/code/query_quota.html">查询额度</a>
* </p>
* <p>
* <b>返回字段说明:</b>
* </p>
* <ul>
* <li>rest: 当月剩余提交审核次数</li>
* <li>limit: 当月提交审核额度上限(默认20次)</li>
* <li>speedup_rest: 剩余加急次数</li>
* <li>speedup_limit: 加急额度上限</li>
* </ul>
* <p>
* <b>重要说明:</b>
* </p>
* <ul>
* <li>每个第三方平台账号每月初会重置审核额度</li>
* <li>每次调用 {@link #submitAudit} 提交审核会消耗1个额度</li>
* <li>审核撤回不会返还额度</li>
* <li>建议在批量提交审核前,先调用此接口检查额度是否充足</li>
* </ul>
* <p>
* <b>使用示例:</b>
* </p>
* <pre>{@code
* WxOpenMaQueryQuotaResult quota = wxOpenMaService.queryQuota();
* System.out.println("剩余审核次数:" + quota.getRest());
* System.out.println("审核额度上限:" + quota.getLimit());
* System.out.println("剩余加急次数:" + quota.getSpeedupRest());
* }</pre>
*
* @return 审核额度信息
* @throws WxErrorException 调用微信接口失败时抛出
* @see #submitAudit(WxOpenMaSubmitAuditMessage) 提交审核
* @see #speedAudit(Long) 加急审核
*/
WxOpenMaQueryQuotaResult queryQuota() throws WxErrorException;
/**
* 加急审核申请
* 有加急次数的第三方可以通过该接口,对已经提审的小程序进行加急操作,加急后的小程序预计2-12小时内审完。
*
* @param auditId the auditid
* @return the boolean
* @throws WxErrorException the wx error exception
*/
Boolean speedAudit(Long auditId) throws WxErrorException;
/**
* (1)增加或修改二维码规则
*
* @param wxQrcodeJumpRule the wx qrcode jump rule
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult addQrcodeJump(WxQrcodeJumpRule wxQrcodeJumpRule) throws WxErrorException;
/**
* (2)获取已设置的二维码规则
*
* @return the qrcode jump
* @throws WxErrorException the wx error exception
*/
WxGetQrcodeJumpResult getQrcodeJump() throws WxErrorException;
/**
* (3)获取校验文件名称及内容
*
* @return the wx downlooad qrcode jump result
* @throws WxErrorException the wx error exception
*/
WxDownlooadQrcodeJumpResult downloadQrcodeJump() throws WxErrorException;
/**
* (4)删除已设置的二维码规则
*
* @param prefix the prefix
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult deleteQrcodeJump(String prefix) throws WxErrorException;
/**
* (5)发布已设置的二维码规则
*
* @param prefix the prefix
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenResult publishQrcodeJump(String prefix) throws WxErrorException;
WxMaScheme generateMaScheme(String jumpWxaPath, String jumpWxaQuery, Boolean isExpire, Long expireTime) throws WxErrorException;
/**
* 为小程序开通小商店组件
*
* @return
*/
WxOpenResult registerShopComponent() throws WxErrorException;
/**
* 小程序基础信息服务 (小程序名称、头像、描述、类目等信息设置)
*
* @return 小程序基础信息服务
*/
WxOpenMaBasicService getBasicService();
/**
* 小程序认证(年审)服务
*
* @return 小程序认证(年审)服务
*/
WxOpenMaAuthService getAuthService();
/**
* 小程序备案服务
*
* @return 小程序备案服务
*/
WxOpenMaIcpService getIcpService();
/**
* 小程序认证及备案服务
*
* @return 小程序认证及备案服务
*/
WxOpenMaAuthAndIcpService getAuthAndIcpService();
/**
* 小程序用户隐私保护指引服务
*
* @return 小程序用户隐私保护指引服务
*/
WxOpenMaPrivacyService getPrivacyService();
/**
* 半屏小程序服务
*
* @return {@link WxOpenMaEmbeddedService }
* @author Yuan
* @date 2024-12-04 18:42:21
*/
WxOpenMaEmbeddedService getEmbeddedService();
/**
* 购物订单
*
* @return 购物订单服务
*/
WxOpenMaShoppingOrdersService getShoppingOrdersService();
/**
* 小程序审核 提审素材上传接口
*
* @return 结果
*/
WxMaAuditMediaUploadResult uploadMedia(File file) throws WxErrorException;
/**
* 查询小程序版本信息
*
* @return the wx open result
* @throws WxErrorException the wx error exception
*/
WxOpenVersioninfoResult getVersionInfo() throws WxErrorException;
/**
* 设置DNS预解析域名
*
* @param domain 预解析域名列表
* @return {@link WxOpenResult}
* @throws WxErrorException the wx error exception
*/
WxOpenResult setPrefetchDomain(WxMaPrefetchDomain domain) throws WxErrorException;
/**
* 获取DNS预解析域名
*
* @return {@link WxOpenMaPrefetchDomainResult}
* @throws WxErrorException he wx error exception
*/
WxOpenMaPrefetchDomainResult getPrefetchDomain() throws WxErrorException;
/**
* 申请开通直播
* 文档地址:
* <a href="https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/live-player/applyLivelnfo.html">https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/live-player/applyLivelnfo.html</a>
*
* @return {@link WxOpenMaApplyLiveInfoResult}
* @throws WxErrorException the wx error exception
*/
WxOpenMaApplyLiveInfoResult applyLiveInfo() throws WxErrorException;
/**
* 小程序认证上传补充材料
*
* @return 结果
* @see #getAuthService() 应使用此处方法处理小程序认证相关业务
*/
@Deprecated
WxMaUploadAuthMaterialResult uploadAuthMaterial(File file) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMpService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMpService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.open.bean.mp.FastRegisterResult;
import me.chanjar.weixin.open.bean.result.WxAmpLinkResult;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
/**
* <pre>
* 微信开放平台代公众号实现服务能力
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1489144594_DhNoV&token=&lang=zh_CN
* </pre>
* <p>
* Created by zpf on 2020/10/15
*/
public interface WxOpenMpService extends WxMpService {
/**
* 取复用公众号快速注册小程序的授权链接.
*/
String URL_FAST_REGISTER_AUTH = "https://mp.weixin.qq.com/cgi-bin/fastregisterauth?appid=%s&component_appid=%s©_wx_verify=%s&redirect_uri=%s";
/**
* 复用公众号快速注册小程序
*/
String API_FAST_REGISTER = "https://api.weixin.qq.com/cgi-bin/account/fastregister";
/**
* 小程序管理-获取公众号关联的小程序
*/
String API_WX_AMP_LINK_GET = "https://api.weixin.qq.com/cgi-bin/wxopen/wxamplinkget";
/**
* 小程序管理-关联小程序
*/
String API_WX_AMP_LINK_CREATE = "https://api.weixin.qq.com/cgi-bin/wxopen/wxamplink";
/**
* 小程序管理-解除已关联的小程序
*/
String API_WX_AMP_LINK_UN = "https://api.weixin.qq.com/cgi-bin/wxopen/wxampunlink";
/**
* 取复用公众号快速注册小程序的授权链接
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Official_Accounts/fast_registration_of_mini_program.html
*
* @param redirectUri 用户扫码授权后,MP 扫码页面将跳转到该地址(注:1.链接需 urlencode 2.Host 需和第三方平台在微信开放平台上面填写的登 录授权的发起页域名一致)
* @param copyWxVerify 是否复用公众号的资质进行微信认证,可空,默认false
* @return 返回授权链接 ,注意:由于微信开放平台限制,此链接直接使用后端301重定向微信会报错,必须是在第三方平台所在域名的页面的html或js触发跳转才能成功
*/
String getFastRegisterAuthUrl(String redirectUri, Boolean copyWxVerify);
/**
* 复用公众号快速注册小程序
* 注意:调用本接口的第三方平台必须是已经全网发布的,否则微信会报-1服务器繁忙错误,然后再报ticket无效错误,并且接口的使用次数会增加,同时还会生成一个废小程序
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/Official_Accounts/fast_registration_of_mini_program.html
*
* @param ticket 公众号扫码授权的凭证(公众平台扫码页面回跳到第三方平台时携带)
* @return 返回授权码, 然后请使用第三方平台的sdk获得授权, 参考: WxOpenService.getWxOpenComponentService().getQueryAuth( fastRegisterResult.getAuthorizationCode() );
* @throws WxErrorException the wx error exception
*/
FastRegisterResult fastRegister(String ticket) throws WxErrorException;
/**
* <pre>
* 获取公众号关联的小程序
* 请求方式:POST(HTTPS)
* 请求地址:
* <a href="https://api.weixin.qq.com/cgi-bin/wxopen/wxamplinkget?access_token=TOKEN">https://api.weixin.qq.com/cgi-bin/wxopen/wxamplinkget?access_token=TOKEN</a>
* 文档地址:
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html">https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html</a>
* <pre>
* @return 公众号关联的小程序
*/
WxAmpLinkResult getWxAmpLink() throws WxErrorException;
/**
* <pre>
* 关联小程序
* 关联流程(需要公众号和小程序管理员双方确认):
* 1、第三方平台调用接口发起关联
* 2、公众号管理员收到模板消息,同意关联小程序。
* 3、小程序管理员收到模板消息,同意关联公众号。
* 4、关联成功
* 等待管理员同意的中间状态可使用“获取公众号关联的小程序”接口进行查询。
* 请求方式:POST(HTTPS)
* 请求地址:
* <a href="https://api.weixin.qq.com/cgi-bin/wxopen/wxamplink?access_token=TOKEN">https://api.weixin.qq.com/cgi-bin/wxopen/wxamplink?access_token=TOKEN</a>
* 文档地址:
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html">https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html</a>
* <pre>
* @param appid 小程序 appid
* @param notifyUsers 是否发送模板消息通知公众号粉丝
* @param showProfile 是否展示公众号主页中
* @return 响应结果
*/
WxOpenResult wxAmpLink(String appid, String notifyUsers, String showProfile) throws WxErrorException;
/**
* <pre>
* 解除已关联的小程序
* 请求方式:POST(HTTPS)
* 请求地址:
* <a href="https://api.weixin.qq.com/cgi-bin/wxopen/wxampunlink?access_token=TOKEN">https://api.weixin.qq.com/cgi-bin/wxopen/wxampunlink?access_token=TOKEN</a>
* 文档地址:
* <a href="https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html">https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Official__Accounts/Mini_Program_Management_Permission.html</a>
* <pre>
* @param appid 小程序 appid
* @return 响应结果
*/
WxOpenResult wxAmpUnLink(String appid) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaAuthService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaAuthService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.bean.CommonUploadData;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.auth.*;
/**
* 微信第三方平台 小程序认证接口 (年审)
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/product/weapp_wxverify.html
*
* @author <a href="https://www.sacoc.cn">广州跨界</a>
* created on 2024/01/11
*/
public interface WxOpenMaAuthService {
/**
* 1 小程程序认证
*/
String OPEN_MA_AUTH_SUBMIT = "https://api.weixin.qq.com/wxa/sec/wxaauth";
/**
* 2 小程程序认证任务进度查询.
*/
String OPEN_MA_AUTH_QUERY = "https://api.weixin.qq.com/wxa/sec/queryauth";
/**
* 3 小程序认证上传补充材料.
*/
String OPEN_MA_AUTH_UPLOAD = "https://api.weixin.qq.com/wxa/sec/uploadauthmaterial";
/**
* 4 小程序认证重新提审.
*/
String OPEN_MA_AUTH_RESUBMIT = "https://api.weixin.qq.com/wxa/sec/reauth";
/**
* 5 查询个人认证身份选项列表.
*/
String OPEN_MA_AUTH_IDENTITY = "https://api.weixin.qq.com/wxa/sec/authidentitytree";
/**
* 小程序认证(提审)
*
* @param param 参数
* @return 提交结果,须保存任务ID 和 授权链接
*/
MaAuthSubmitResult submit(MaAuthSubmitParam param) throws WxErrorException;
/**
* 进度查询
*
* @param taskId 任务ID,提交任务时返回
*/
MaAuthQueryResult query(String taskId) throws WxErrorException;
/**
* 上传补充材料
*
* @param data 上传数据,仅支持png\jpeg\jpg\gif格式,文件后缀名如果填写不对会导致上传失败,建议写死1.jpg
*/
MaAuthUploadResult upload(CommonUploadData data) throws WxErrorException;
/**
* 重新提审
*
* @param param 参数
* @return 提交结果
*/
MaAuthSubmitResult resubmit(MaAuthResubmitParam param) throws WxErrorException;
/**
* 查询个人认证身份选项列表
*
* @return 职业身份认证树
*/
MaAuthQueryIdentityTreeResult queryIdentityTree() 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaShoppingOrdersService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaShoppingOrdersService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import me.chanjar.weixin.open.bean.shoppingOrders.*;
/**
* @author xzh
* created on 2023/5/17 16:49
*/
public interface WxOpenMaShoppingOrdersService {
/**
* 上传购物详情
*/
String UPLOAD_SHOPPING_INFO = "https://api.weixin.qq.com/user-order/orders";
/**
* 上传物流信息
*/
String UPLOAD_SHIPPING_INFO = "https://api.weixin.qq.com/user-order/orders/shippings";
/**
* 上传合单购物详情
*/
String UPLOAD_COMBINED_SHOPPING_INFO = "https://api.weixin.qq.com/user-order/combine-orders";
/**
* 上传合单物流信息
*/
String UPLOAD_COMBINED_SHIPPING_INFO = "https://api.weixin.qq.com/user-order/combine-orders/shippings";
/**
* 开通购物订单产品权限
*/
String OPEN_SHOPPING_ORDER_PRODUCT_PERMISSION = "https://api.weixin.qq.com/user-order/orders-permission/open";
/**
* 提交购物订单接入审核
*/
String CONFIRM_PRODUCT_PERMISSION = "https://api.weixin.qq.com/user-order/orders-permission/confirm";
/**
* 验证购物订单上传结果
*/
String SHOPPING_INFO_VERIFY_UPLOAD_RESULT = "https://api.weixin.qq.com/user-order/shoppinginfo/verify";
/**
* 上传购物详情
*
* @param info 购物详情
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenResult upload(ShoppingInfo info) throws WxErrorException;
/**
* 上传物流信息
*
* @param info 物流信息
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenResult upload(ShippingInfo info) throws WxErrorException;
/**
* 上传合单购物详情
*
* @param info 购物详情
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenResult upload(CombinedShoppingInfo info) throws WxErrorException;
/**
* 上传合单物流信息
*
* @param info 物流信息
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenResult upload(CombinedShippingInfo info) throws WxErrorException;
/**
* 开通购物订单产品权限
*
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenResult openShoppingOrderProductPermission() throws WxErrorException;
/**
* 提交购物订单接入审核
*
* @return WxOpenShoppingOrdersConfirmResult
* @throws WxErrorException
*/
WxOpenShoppingOrdersConfirmResult confirmProductPermission() throws WxErrorException;
/**
* 验证购物订单上传结果
*
* @param info 信息
* @return WxOpenResult
* @throws WxErrorException
*/
WxOpenShoppingInfoVerifyUploadResult verifyUploadResult(ShoppingInfoVerifyUpload info) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMaIcpService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.icp.*;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import java.io.File;
/**
* @author xzh
* @Description 小程序备案
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpVerifyTask.html
* @createTime 2024/08/14 10:52
*/
public interface WxOpenMaIcpService {
/**
* 查询人脸核身任务状态
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpVerifyTask.html
*/
String QUERY_ICP_VERIFY_TASK = "https://api.weixin.qq.com/wxa/icp/query_icp_verifytask";
/**
* 发起小程序管理员人脸核身
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/createIcpVerifyTask.html
*/
String CREATE_ICP_VERIFY_TASK = "https://api.weixin.qq.com/wxa/icp/create_icp_verifytask";
/**
* 上传小程序备案媒体材料
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/uploadIcpMedia.html
*/
String UPLOAD_ICP_MEDIA = "https://api.weixin.qq.com/wxa/icp/upload_icp_media";
/**
* 撤回小程序备案申请
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/cancelApplyIcpFiling.html
*/
String CANCEL_APPLY_ICP_FILING = "https://api.weixin.qq.com/wxa/icp/cancel_apply_icp_filing";
/**
* 申请小程序备案
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/applyIcpFiling.html
*/
String APPLY_ICP_FILING = "https://api.weixin.qq.com/wxa/icp/apply_icp_filing";
/**
* 注销小程序备案
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/cancelIcpfiling.html
*/
String CANCEL_ICP_FILING = "https://api.weixin.qq.com/wxa/icp/cancel_icp_filing";
/**
* 获取小程序备案状态及驳回原因
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/getIcpEntranceInfo.html
*/
String GET_ICP_ENTRANCE_INFO = "https://api.weixin.qq.com/wxa/icp/get_icp_entrance_info";
/**
* 获取小程序已备案详情
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/getOnlineIcpOrder.html
*/
String GET_ONLINE_ICP_ORDER = "https://api.weixin.qq.com/wxa/icp/get_online_icp_order";
/**
* 获取小程序服务内容类型
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpServiceContentTypes.html
*/
String QUERY_ICP_SERVICE_CONTENT_TYPES = "https://api.weixin.qq.com/wxa/icp/query_icp_service_content_types";
/**
* 获取证件类型
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpCertificateTypes.html
*/
String QUERY_ICP_CERTIFICATE_TYPES = "https://api.weixin.qq.com/wxa/icp/query_icp_certificate_types";
/**
* 获取区域信息
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpDistrictCode.html
*/
String QUERY_ICP_DISTRICT_CODE = "https://api.weixin.qq.com/wxa/icp/query_icp_district_code";
/**
* 获取前置审批项类型
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpNrlxTypes.html
*/
String QUERY_ICP_NRLX_TYPES = "https://api.weixin.qq.com/wxa/icp/query_icp_nrlx_types";
/**
* 获取单位性质
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/queryIcpSubjectTypes.html
*/
String QUERY_ICP_SUBJECT_TYPES = "https://api.weixin.qq.com/wxa/icp/query_icp_subject_types";
/**
* 获取小程序备案媒体材料
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/record/getIcpMedia.html
*/
String GET_ICP_MEDIA = "https://api.weixin.qq.com/wxa/icp/get_icp_media";
/**
* 申请小程序认证及备案
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/submitAuthAndIcp.html
*/
String SUBMIT_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/submit_auth_and_icp";
/**
* 查询小程序认证及备案进度
* https://developers.weixin.qq.com/doc/oplatform/openApi/OpenApiDoc/miniprogram-management/wxverifyicp/queryAuthAndIcp.html
*/
String QUERY_AUTH_AND_ICP = "https://api.weixin.qq.com/wxa/sec/query_auth_and_icp";
/**
* 查询人脸核身任务状态
*
* @param taskId 任务id
* @return 人脸核身任务的状态和结果
* @throws WxErrorException e
*/
WxOpenIcpVerifyTaskResult queryIcpVerifyTask(String taskId) throws WxErrorException;
/**
* 发起小程序管理员人脸核身
*
* @param alongWithAuth 小程序认证及备案二合一场景,填 true,否则为小程序备案场景。默认值为 false。
* @return 人脸核验任务结果
* @throws WxErrorException e
*/
WxOpenIcpCreateIcpVerifyTaskResult createIcpVerifyTask(boolean alongWithAuth) throws WxErrorException;
/**
* 上传小程序备案媒体材料
*
* @param param 备案媒体材料
* @return 备案媒体材料结果
* @throws WxErrorException e
*/
WxOpenUploadIcpMediaResult uploadIcpMedia(WxOpenUploadIcpMediaParam param) throws WxErrorException;
/**
* 撤回小程序备案申请
*
* @return r
* @throws WxErrorException e
*/
WxOpenResult cancelApplyIcpFiling() throws WxErrorException;
/**
* 申请小程序备案
*
* @param param 参数
* @return r
* @throws WxErrorException e
*/
WxOpenApplyIcpFilingResult applyIcpFiling(WxOpenApplyIcpFilingParam param) throws WxErrorException;
/**
* 注销小程序备案
* @param cancelType 注销类型:1 -- 注销主体, 2 -- 注销小程序, 3 -- 注销微信小程序
* @return r
* @throws WxErrorException e
*/
WxOpenResult cancelIcpFiling(Integer cancelType) throws WxErrorException;
/**
* 获取小程序备案状态及驳回原因
* @return r
* @throws WxErrorException e
*/
WxOpenIcpEntranceInfoResult getIcpEntranceInfo() throws WxErrorException;
/**
* 获取小程序已备案详情
* @return 已备案详情
* @throws WxErrorException e
*/
WxOpenOnlineIcpOrderResult getOnlineIcpOrder() throws WxErrorException;
/**
* 获取小程序服务内容类型
* @return 小程序服务内容类型定义
* @throws WxErrorException e
*/
WxOpenQueryIcpServiceContentTypesResult queryIcpServiceContentTypes() throws WxErrorException;
/**
* 获取证件类型
* @return 证件类型定义
* @throws WxErrorException e
*/
WxOpenQueryIcpCertificateTypeResult queryIcpCertificateTypes() throws WxErrorException;
/**
* 获取区域信息
* @return 省市区的区域信息
* @throws WxErrorException e
*/
WxOpenQueryIcpDistrictCodeResult queryIcpDistrictCode() throws WxErrorException;
/**
* 获取前置审批项类型
* @return 小程序备案前置审批项类型定义
* @throws WxErrorException e
*/
WxOpenQueryIcpNrlxTypesResult queryIcpNrlxTypes() throws WxErrorException;
/**
* 获取单位性质
* @return 单位性质定义
* @throws WxErrorException e
*/
WxOpenQueryIcpSubjectTypeResult queryIcpSubjectTypes() throws WxErrorException;
/**
* 获取小程序备案媒体材料
* @param mediaId 上传小程序备案媒体材料接口返回的 media_id,示例值:4ahCGpd3CYkE6RpkNkUR5czt3LvG8xDnDdKAz6bBKttSfM8p4k5Rj6823HXugPwQBurgMezyib7
* @return 所上传的图片或视频媒体材料
* @throws WxErrorException e
*/
File getIcpMedia(String mediaId) 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-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenComponentService.java | package me.chanjar.weixin.open.api;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.bean.result.WxMinishopImageUploadResult;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.open.bean.WxOpenCreateResult;
import me.chanjar.weixin.open.bean.WxOpenGetResult;
import me.chanjar.weixin.open.bean.WxOpenMaCodeTemplate;
import me.chanjar.weixin.open.bean.ma.WxOpenMaApplyOrderPathInfo;
import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage;
import me.chanjar.weixin.open.bean.minishop.*;
import me.chanjar.weixin.open.bean.minishop.coupon.WxMinishopCoupon;
import me.chanjar.weixin.open.bean.minishop.coupon.WxMinishopCouponStock;
import me.chanjar.weixin.open.bean.minishop.goods.*;
import me.chanjar.weixin.open.bean.minishop.limitdiscount.LimitDiscountGoods;
import me.chanjar.weixin.open.bean.result.*;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvRequest;
import me.chanjar.weixin.open.bean.tcb.ShareCloudBaseEnvResponse;
import me.chanjar.weixin.open.bean.tcbComponent.GetShareCloudBaseEnvResponse;
import me.chanjar.weixin.open.bean.tcbComponent.GetTcbEnvListResponse;
import java.io.File;
import java.util.List;
/**
* .
*
* @author <a href="https://github.com/007gzs">007</a>
*/
public interface WxOpenComponentService {
/**
* The constant API_COMPONENT_TOKEN_URL.
*/
String API_COMPONENT_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_component_token";
/**
* 启动ticket推送服务
*/
String API_START_PUSH_TICKET = "https://api.weixin.qq.com/cgi-bin/component/api_start_push_ticket";
/**
* The constant API_CREATE_PREAUTHCODE_URL.
*/
String API_CREATE_PREAUTHCODE_URL = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode";
/**
* The constant API_QUERY_AUTH_URL.
*/
String API_QUERY_AUTH_URL = "https://api.weixin.qq.com/cgi-bin/component/api_query_auth";
/**
* The constant API_AUTHORIZER_TOKEN_URL.
*/
String API_AUTHORIZER_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/component/api_authorizer_token";
/**
* The constant API_GET_AUTHORIZER_INFO_URL.
*/
String API_GET_AUTHORIZER_INFO_URL = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info";
/**
* The constant GET_AUTHORIZER_OPTION_URL.
*/
String GET_AUTHORIZER_OPTION_URL = "https://api.weixin.qq.com/cgi-bin/component/get_authorizer_option";
/**
* The constant SET_AUTHORIZER_OPTION_URL.
*/
String SET_AUTHORIZER_OPTION_URL = "https://api.weixin.qq.com/cgi-bin/component/set_authorizer_option";
/**
* The constant API_GET_AUTHORIZER_LIST.
*/
String API_GET_AUTHORIZER_LIST = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_list";
/**
* The constant COMPONENT_LOGIN_PAGE_URL.
*/
String COMPONENT_LOGIN_PAGE_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=xxx&biz_appid=xxx";
/**
* 手机端打开授权链接.
*/
String COMPONENT_MOBILE_LOGIN_PAGE_URL = "https://open.weixin.qq.com/wxaopen/safe/bindcomponent?action=bindcomponent&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s&auth_type=xxx&biz_appid=xxx#wechat_redirect";
/**
* The constant CONNECT_OAUTH2_AUTHORIZE_URL.
*/
String CONNECT_OAUTH2_AUTHORIZE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=%s&component_appid=%s#wechat_redirect";
/**
* 用code换取oauth2的access token.
*/
String OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/component/access_token?appid=%s&code=%s&grant_type=authorization_code&component_appid=%s";
/**
* 刷新oauth2的access token.
*/
String OAUTH2_REFRESH_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/component/refresh_token?appid=%s&grant_type=refresh_token&refresh_token=%s&component_appid=%s";
/**
* The constant MINIAPP_JSCODE_2_SESSION.
*/
String MINIAPP_JSCODE_2_SESSION = "https://api.weixin.qq.com/sns/component/jscode2session?appid=%s&js_code=%s&grant_type=authorization_code&component_appid=%s";
/**
* The constant CREATE_OPEN_URL.
*/
String CREATE_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/create";
/**
* The constant BIND_OPEN_URL.
*/
String BIND_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/bind";
/**
* The constant UNBIND_OPEN_URL.
*/
String UNBIND_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/unbind";
/**
* The constant GET_OPEN_URL.
*/
String GET_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/get";
/**
* 查询公众号/小程序是否绑定 open 帐号
*/
String HAVE_OPEN_URL = "https://api.weixin.qq.com/cgi-bin/open/have";
/**
* 快速创建小程序接口.
*/
String FAST_REGISTER_WEAPP_URL = "https://api.weixin.qq.com/cgi-bin/component/fastregisterweapp?action=create";
/**
* The constant FAST_REGISTER_WEAPP_SEARCH_URL.
*/
String FAST_REGISTER_WEAPP_SEARCH_URL = "https://api.weixin.qq.com/cgi-bin/component/fastregisterweapp?action=search";
/**
* 快速创建个人小程序接口.
*/
String FAST_REGISTER_PERSONAL_WEAPP_URL = "https://api.weixin.qq.com/wxa/component/fastregisterpersonalweapp?action=create";
/**
* 查询快速创建个人小程序任务状态接口.
*/
String FAST_REGISTER_PERSONAL_WEAPP_SEARCH_URL = "https://api.weixin.qq.com/wxa/component/fastregisterpersonalweapp?action=query";
/**
* 快速创建试用小程序接口.
*/
String FAST_REGISTER_BETA_WEAPP_URL = "https://api.weixin.qq.com/wxa/component/fastregisterbetaweapp";
/**
* 代小程序实现业务.
* 小程序代码模版库管理:https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1506504150_nMMh6&token=&lang=zh_CN
* access_token 为 component_access_token
*/
String GET_TEMPLATE_DRAFT_LIST_URL = "https://api.weixin.qq.com/wxa/gettemplatedraftlist";
/**
* The constant GET_TEMPLATE_LIST_URL.
*/
String GET_TEMPLATE_LIST_URL = "https://api.weixin.qq.com/wxa/gettemplatelist";
/**
* The constant ADD_TO_TEMPLATE_URL.
*/
String ADD_TO_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/addtotemplate";
/**
* The constant DELETE_TEMPLATE_URL.
*/
String DELETE_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/deletetemplate";
String REGISTER_SHOP_URL = "https://api.weixin.qq.com/product/register/register_shop";
String CHECK_SHOP_AUDITSTATUS_URL = "https://api.weixin.qq.com/product/register/check_audit_status";
String SUBMIT_MERCHANTINFO_URL = "https://api.weixin.qq.com/product/register/submit_merchantinfo";
String SUBMIT_BASICINFO_URL = "https://api.weixin.qq.com/product/register/submit_basicinfo";
String UPLOAD_IMAGE_URL = "https://api.weixin.qq.com/product/img/upload";
String MINISHOP_CATEGORY_GET_URL = "https://api.weixin.qq.com/product/category/get";
String MINISHOP_BRAND_GET_URL = "https://api.weixin.qq.com/product/brand/get";
String MINISHOP_DELIVERY_TEMPLATE_GET_URL = "https://api.weixin.qq.com/product/delivery/get_freight_template";
String MINISHOP_SHOPCATEGORY_GET_URL = "https://api.weixin.qq.com/product/store/get_shopcat";
String MINISHOP_CREATE_COUPON_URL = "https://api.weixin.qq.com/product/coupon/create";
String MINISHOP_GET_COUPON_LIST = "https://api.weixin.qq.com/product/coupon/get_list";
String MINISHOP_PUSH_COUPON = "https://api.weixin.qq.com/product/coupon/push";
String MINISHOP_UPDATE_COUPON_URL = "https://api.weixin.qq.com/product/coupon/update";
String MINISHOP_UPDATE_COUPON_STATUS_URL = "https://api.weixin.qq.com/product/coupon/update_status";
String MINISHOP_GET_DELIVERY_COMPANY_URL = "https://api.weixin.qq.com/product/delivery/get_company_list";
String BATCH_GET_ENVID_URL = "https://api.weixin.qq.com/componenttcb/batchgetenvid";
String DESCRIBE_ENVS_URL = "https://api.weixin.qq.com/componenttcb/describeenvs";
String MODIFY_ENV_URL = "https://api.weixin.qq.com/tcb/modifyenv";
String BATCH_SHARE_ENV = "https://api.weixin.qq.com/componenttcb/batchshareenv";
String COMPONENT_CLEAR_QUOTA_URL = "https://api.weixin.qq.com/cgi-bin/component/clear_quota/v2";
/**
* 设置第三方平台服务器域名
*/
String API_MODIFY_WXA_SERVER_DOMAIN = "https://api.weixin.qq.com/cgi-bin/component/modify_wxa_server_domain";
/**
* 获取第三方平台业务域名校验文件
*/
String API_GET_DOMAIN_CONFIRM_FILE = "https://api.weixin.qq.com/cgi-bin/component/get_domain_confirmfile";
/**
* 设置第三方平台业务域名
*/
String API_MODIFY_WXA_JUMP_DOMAIN = "https://api.weixin.qq.com/cgi-bin/component/modify_wxa_jump_domain";
/**
* Gets wx mp service by appid.
*
* @param appid the appid
* @return the wx mp service by appid
*/
WxOpenMpService getWxMpServiceByAppid(String appid);
/**
* 获取指定appid的开放平台小程序服务(继承一般小程序服务能力).
*
* @param appid .
* @return . wx ma service by appid
*/
WxOpenMaService getWxMaServiceByAppid(String appid);
/**
* 获取指定appid的快速创建的小程序服务.
*
* @param appid .
* @return . wx fast ma service by appid
* @deprecated 2021-06-23 本接口原有方法并非仅快速创建小程序的专用接口,普通小程序授权到第三方平台皆可使用,所以请使用 {@link WxOpenMaBasicService} 类替代。获取方法: WxOpenMaService.getBasicService()
*/
@Deprecated
WxOpenFastMaService getWxFastMaServiceByAppid(String appid);
/**
* 获取指定appid的小商店服务
*
* @param appid
* @return
*/
WxOpenMinishopService getWxMinishopServiceByAppid(String appid);
/**
* Gets wx open config storage.
*
* @return the wx open config storage
*/
WxOpenConfigStorage getWxOpenConfigStorage();
/**
* Check signature boolean.
*
* @param timestamp the timestamp
* @param nonce the nonce
* @param signature the signature
* @return the boolean
*/
boolean checkSignature(String timestamp, String nonce, String signature);
/**
* 启动ticket推送服务 该 API 用于启动ticket推送服务
*
* @throws WxErrorException 如果调用失败返回此异常
*/
void startPushTicket() throws WxErrorException;
/**
* Gets component access token.
*
* @param forceRefresh the force refresh
* @return the component access token
* @throws WxErrorException the wx error exception
*/
String getComponentAccessToken(boolean forceRefresh) throws WxErrorException;
/**
* Post string.
*
* @param uri the uri
* @param postData the post data
* @return the string
* @throws WxErrorException the wx error exception
*/
String post(String uri, String postData) throws WxErrorException;
/**
* Post string.
*
* @param uri the uri
* @param postData the post data
* @param accessTokenKey the access token key
* @return the string
* @throws WxErrorException the wx error exception
*/
String post(String uri, String postData, String accessTokenKey) throws WxErrorException;
String post(String uri, String postData, String accessTokenKey, String accessToken) throws WxErrorException;
/**
* Get string.
*
* @param uri the uri
* @return the string
* @throws WxErrorException the wx error exception
*/
String get(String uri) throws WxErrorException;
/**
* Get string.
*
* @param uri the uri
* @param accessTokenKey the access token key
* @return the string
* @throws WxErrorException the wx error exception
*/
String get(String uri, String accessTokenKey) throws WxErrorException;
/**
* 获取用户授权页URL(来路URL和成功跳转URL 的域名都需要为三方平台设置的 登录授权的发起页域名).
*
* @param redirectUri the redirect uri
* @return the pre auth url
* @throws WxErrorException the wx error exception
*/
String getPreAuthUrl(String redirectUri) throws WxErrorException;
/**
* .
*
* @param redirectUri the redirect uri
* @param authType 要授权的帐号类型:1则商户点击链接后,手机端仅展示公众号、2表示仅展示小程序,3表示公众号和小程序都展示。如果为未指定,则默认小程序和公众号都展示。第三方平台开发者可以使用本字段来控制授权的帐号类型。
* @param bizAppid 指定授权唯一的小程序或公众号 注:authType、bizAppid 互斥。
* @return the pre auth url
* @throws WxErrorException the wx error exception
*/
String getPreAuthUrl(String redirectUri, String authType, String bizAppid) throws WxErrorException;
/**
* 获取预授权链接(手机端预授权).
*
* @param redirectUri .
* @return . mobile pre auth url
* @throws WxErrorException .
*/
String getMobilePreAuthUrl(String redirectUri) throws WxErrorException;
/**
* 获取预授权链接(手机端预授权).
*
* @param redirectUri .
* @param authType .
* @param bizAppid .
* @return . mobile pre auth url
* @throws WxErrorException .
*/
String getMobilePreAuthUrl(String redirectUri, String authType, String bizAppid) throws WxErrorException;
/**
* Route string.
*
* @param wxMessage the wx message
* @return the string
* @throws WxErrorException the wx error exception
*/
String route(WxOpenXmlMessage wxMessage) throws WxErrorException;
/**
* 使用授权码换取公众号或小程序的接口调用凭据和授权信息.
*
* @param authorizationCode the authorization code
* @return the query auth
* @throws WxErrorException the wx error exception
*/
WxOpenQueryAuthResult getQueryAuth(String authorizationCode) throws WxErrorException;
/**
* 获取授权方的帐号基本信息.
*
* @param authorizerAppid the authorizer appid
* @return the authorizer info
* @throws WxErrorException the wx error exception
*/
WxOpenAuthorizerInfoResult getAuthorizerInfo(String authorizerAppid) throws WxErrorException;
/**
* 获取授权方的选项设置信息.
*
* @param authorizerAppid the authorizer appid
* @param optionName the option name
* @return the authorizer option
* @throws WxErrorException the wx error exception
*/
WxOpenAuthorizerOptionResult getAuthorizerOption(String authorizerAppid, String optionName) throws WxErrorException;
/**
* 获取所有授权方列表.
*
* @param begin the begin
* @param len the len
* @return the authorizer list
* @throws WxErrorException the wx error exception
*/
WxOpenAuthorizerListResult getAuthorizerList(int begin, int len) throws WxErrorException;
/**
* 设置授权方的选项信息.
*
* @param authorizerAppid the authorizer appid
* @param optionName the option name
* @param optionValue the option value
* @throws WxErrorException the wx error exception
*/
void setAuthorizerOption(String authorizerAppid, String optionName, String optionValue) throws WxErrorException;
/**
* Gets authorizer access token.
*
* @param appid the appid
* @param forceRefresh the force refresh
* @return the authorizer access token
* @throws WxErrorException the wx error exception
*/
String getAuthorizerAccessToken(String appid, boolean forceRefresh) throws WxErrorException;
/**
* Oauth 2 get access token wx mp o auth 2 access token.
*
* @param appid the appid
* @param code the code
* @return the wx mp o auth 2 access token
* @throws WxErrorException the wx error exception
* @see WxMpService#getOAuth2Service()
* @deprecated 2021-05-21: 已修正公众号相关接口,请使用:WxOpenComponentService.getWxMpServiceByAppid(mpAppId).getOAuth2Service().getAccessToken(code)
*/
@Deprecated
WxOAuth2AccessToken oauth2getAccessToken(String appid, String code) throws WxErrorException;
/**
* Check signature boolean.
*
* @param appId the app id
* @param timestamp the timestamp
* @param nonce the nonce
* @param signature the signature
* @return the boolean
*/
boolean checkSignature(String appId, String timestamp, String nonce, String signature);
/**
* Oauth 2 refresh access token wx mp o auth 2 access token.
*
* @param appid the appid
* @param refreshToken the refresh token
* @return the wx mp o auth 2 access token
* @throws WxErrorException the wx error exception
*/
WxOAuth2AccessToken oauth2refreshAccessToken(String appid, String refreshToken) throws WxErrorException;
/**
* Oauth 2 build authorization url string.
*
* @param appid the appid
* @param redirectUri the redirect uri
* @param scope the scope
* @param state the state
* @return the string
* @see WxMpService#getOAuth2Service()
* @deprecated 2021-05-21: 已修正公众号相关接口,请使用:WxOpenCommpentService.getWxMpServiceByAppid(mpAppId).getOAuth2Service().buildAuthorizationUrl(redirectUri, scope, state)
*/
@Deprecated
String oauth2buildAuthorizationUrl(String appid, String redirectUri, String scope, String state);
/**
* Miniapp jscode 2 session wx ma jscode 2 session result.
*
* @param appId the app id
* @param jsCode the js code
* @return the wx ma jscode 2 session result
* @throws WxErrorException the wx error exception
*/
WxMaJscode2SessionResult miniappJscode2Session(String appId, String jsCode) throws WxErrorException;
/**
* 获取草稿箱内的所有临时代码草稿.
*
* @return 草稿箱代码模板列表 (draftId)
* @throws WxErrorException 获取失败时返回,具体错误码请看此接口的注释文档
*/
List<WxOpenMaCodeTemplate> getTemplateDraftList() throws WxErrorException;
/**
* 获取代码模版库中的所有小程序代码模版.
*
* @return 小程序代码模版列表 (templateId)
* @throws WxErrorException 获取失败时返回,具体错误码请看此接口的注释文档
* @see #getTemplateList(Integer)
*/
@Deprecated
List<WxOpenMaCodeTemplate> getTemplateList() throws WxErrorException;
/**
* 获取代码模版库中的所有小程序代码模版.
* 文档:https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/gettemplatelist.html
*
* @param templateType 模板类型,可空,默认全部,填0普通模,1标准模板
* @return 小程序代码模版列表 (templateId)
* @throws WxErrorException 获取失败时返回,具体错误码请看此接口的注释文档
*/
List<WxOpenMaCodeTemplate> getTemplateList(Integer templateType) throws WxErrorException;
/**
* 请参考并使用 {@link #addToTemplate(long, int)}.
* 将草稿箱的草稿选为小程序代码模版.
*
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
* @see #getTemplateDraftList #getTemplateDraftList
*/
@Deprecated
void addToTemplate(long draftId) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/ThirdParty/code_template/addtotemplate.html
* 将草稿添加到代码模板库.
*
* @param draftId 草稿ID,本字段可通过“获取草稿箱内的所有临时代码草稿”接口获得
* @param templateType 代码模版类型,【普通模板:0, 标准模板:1】
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
* @see #getTemplateDraftList #getTemplateDraftList
*/
void addToTemplate(long draftId, int templateType) throws WxErrorException;
/**
* 删除指定小程序代码模版.
*
* @param templateId 要删除的模版ID
* @throws WxErrorException 操作失败时抛出,具体错误码请看此接口的注释文档
* @see #getTemplateList #getTemplateList
*/
void deleteTemplate(long templateId) throws WxErrorException;
/**
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1498704199_1bcax&token=6df5e3650041eff2cd3ec3662425ad8d7beec8d9&lang=zh_CN
* 创建 开放平台帐号并绑定公众号/小程序.
* https://api.weixin.qq.com/cgi-bin/open/create
*
* @param appId 公众号/小程序的appId
* @param appIdType appId类型 me.chanjar.weixin.common.api.WxConsts.AppIdType mp-公众号 mini-小程序
* @return . wx open create result
* @throws WxErrorException .
*/
WxOpenCreateResult createOpenAccount(String appId, String appIdType) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/account/bind.html
* 将公众号/小程序绑定到开放平台帐号下
*
* @param appId 公众号/小程序的appId
* @param appIdType appId类型 me.chanjar.weixin.common.api.WxConsts.AppIdType mp-公众号 mini-小程序
* @param openAppid 开放平台帐号 appid,由创建开发平台帐号接口返回
* @return the boolean
* @throws WxErrorException the wx error exception
*/
Boolean bindOpenAccount(String appId, String appIdType, String openAppid) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/account/unbind.html
* 将公众号/小程序从开放平台帐号下解绑
*
* @param appId 公众号/小程序的appId
* @param appIdType appId类型 me.chanjar.weixin.common.api.WxConsts.AppIdType mp-公众号 mini-小程序
* @param openAppid 开放平台帐号 appid,由创建开发平台帐号接口返回
* @return the boolean
* @throws WxErrorException the wx error exception
*/
Boolean unbindOpenAccount(String appId, String appIdType, String openAppid) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/api/account/get.html
* 获取公众号/小程序所绑定的开放平台帐号
*
* @param appId 公众号/小程序的appId
* @param appIdType appId类型 me.chanjar.weixin.common.api.WxConsts.AppIdType mp-公众号 mini-小程序
* @return 开放平台帐号 appid,由创建开发平台帐号接口返回
* @throws WxErrorException the wx error exception
*/
WxOpenGetResult getOpenAccount(String appId, String appIdType) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Mini_Program_Basic_Info/getbindopeninfo.html
* 查询公众号/小程序是否绑定 open 帐号
*
* @return 是否绑定 open 帐号,true表示绑定;false表示未绑定任何 open 帐号
* @throws WxErrorException the wx error exception
*/
WxOpenHaveResult haveOpen() throws WxErrorException;
/**
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
* 第三方平台快速创建小程序.
* 注意:创建任务逻辑串行,单次任务结束后才可以使用相同信息下发第二次任务,请注意规避任务阻塞
*
* @param name 企业名(需与工商部门登记信息一致)
* @param code 企业代码
* @param codeType 企业代码类型 1:统一社会信用代码(18位) 2:组织机构代码(9位xxxxxxxx-x) 3:营业执照注册号(15位)
* @param legalPersonaWechat 法人微信号
* @param legalPersonaName 法人姓名(绑定银行卡)
* @param componentPhone 第三方联系电话(方便法人与第三方联系)
* @return . wx open result
* @throws WxErrorException .
*/
WxOpenResult fastRegisterWeapp(String name, String code, String codeType, String legalPersonaWechat, String legalPersonaName, String componentPhone) throws WxErrorException;
/**
* https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=21538208049W8uwq&token=&lang=zh_CN
* 查询第三方平台快速创建小程序的任务状态
* 注意:该接口只提供当下任务结果查询,不建议过分依赖该接口查询所创建小程序。
* 小程序的成功状态可在第三方服务器中自行对账、查询。
* 不要频繁调用search接口,消息接收需通过服务器查看。调用search接口会消耗接口整体调用quato
*
* @param name 企业名(需与工商部门登记信息一致)
* @param legalPersonaWechat 法人微信号
* @param legalPersonaName 法人姓名(绑定银行卡)
* @return the wx open result
* @throws WxErrorException .
*/
WxOpenResult fastRegisterWeappSearch(String name, String legalPersonaWechat, String legalPersonaName) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Register_Mini_Programs/fastregisterpersonalweapp.html
* 快速创建个人小程序
*
* @param idname 个人用户名字
* @param wxuser 个人用户微信号
* @param componentPhone 第三方联系电话
* @return the wx open result
* @throws WxErrorException
*/
WxOpenRegisterPersonalWeappResult fastRegisterPersonalWeapp(String idname, String wxuser, String componentPhone) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Register_Mini_Programs/fastregisterpersonalweapp.html
* 查询个人小程序注册任务状态
*
* @param taskid 任务ID
* @return the wx open result
* @throws WxErrorException
*/
WxOpenRegisterPersonalWeappResult fastRegisterPersonalWeappSearch(String taskid) throws WxErrorException;
/**
* https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/beta_Mini_Programs/fastregister.html
* 注册试用小程序
*
* @param name 小程序名称
* @param openid 微信用户的openid(不是微信号)
* @return the wx open result
* @throws WxErrorException
*/
WxOpenRegisterBetaWeappResult fastRegisterBetaWeapp(String name, String openid) throws WxErrorException;
/**
* https://api.weixin.qq.com/product/register/register_shop?component_access_token=xxxxxxxxx
* 注册小商店账号
*
* @param wxName 微信号(必填)
* @param idCardName 身份证姓名(必填)
* @param idCardNumber 身份证号(必填)
* @param channelId 渠道号,服务商后台生成渠道信息。(选填)
* @param apiOpenstoreType 1-整店打包(开通小商店),2-组件开放(开通小程序,并且已经完整的嵌入电商功能)(必填)
* @param authPageUrl 授权url(选填)
* @return the wx open result
* @throws WxErrorException
*/
WxOpenResult registerShop(String wxName, String idCardName, String idCardNumber, String channelId, Integer apiOpenstoreType, String authPageUrl) throws WxErrorException;
/**
* https://api.weixin.qq.com/product/register/check_audit_status
* 异步状态查询
*
* @param wxName 微信号
* @return
*/
String checkAuditStatus(String wxName) throws WxErrorException;
/**
* 已经获取到小商店的appId,那么需要通过accesstoken来获取该小商店的状态
*
* @param appId
* @param wxName
* @return
* @throws WxErrorException
*/
String checkAuditStatus(String appId, String wxName) throws WxErrorException;
/**
* @param appId
* @param subjectType
* @param busiLicense
* @param organizationCodeInfo
* @param idcardInfo
* @param superAdministratorInfo
* @param merchantShoprtName
* @return
*/
WxOpenResult submitMerchantInfo(String appId, String subjectType, MinishopBusiLicense busiLicense, MinishopOrganizationCodeInfo organizationCodeInfo, MinishopIdcardInfo idcardInfo, MinishopSuperAdministratorInfo superAdministratorInfo, String merchantShoprtName) throws WxErrorException;
/**
* @param appId
* @param nameInfo
* @param returnInfo
* @return
* @throws WxErrorException
*/
WxOpenResult submitBasicInfo(String appId, MinishopNameInfo nameInfo, MinishopReturnInfo returnInfo) throws WxErrorException;
/**
* @param height
* @param width
* @param file
* @return
* @throws WxErrorException
*/
WxMinishopImageUploadResult uploadMinishopImagePicFile(String appId, Integer height, Integer width, File file) throws WxErrorException;
/**
* 获取小商店的类目详情
*
* @param appId:小商店APPID
* @param fCatId:父类目ID,可先填0获取根部类目
* @return 小商店类目信息列表
*/
MinishopCategories getMinishopCategories(String appId, Integer fCatId) throws WxErrorException;
/**
* 获取小商店品牌信息
*
* @param appId:小商店appID
* @return
*/
MinishopBrandList getMinishopBrands(String appId) throws WxErrorException;
/**
* 获取小商店运费模版信息
*
* @param appId:小商店appID
* @return
*/
MinishopDeliveryTemplateResult getMinishopDeliveryTemplate(String appId) throws WxErrorException;
/**
* 获取小商店商品分类信息
*
* @param appId
* @return
*/
MinishopShopCatList getMinishopCatList(String appId) throws WxErrorException;
/**
* 获取小商店的快递公司列表
*
* @param appId
* @return
* @throws WxErrorException
*/
WxMinishopAddGoodsSpuResult<List<WxMinishopDeliveryCompany>> getMinishopDeliveryCompany(String appId) throws WxErrorException;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//小商店优惠券接口
/**
* 创建小商店优惠券
*
* @param appId:小商店的appId
* @param couponInfo: 优惠券信息
* @return couponId: 优惠券ID
* @throws WxErrorException
*/
Integer minishopCreateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
/**
* 与小商店对接,获取小商店的优惠券信息
*
* @param appId:小商店的appId
* @param startCreateTime:优惠券创建时间的搜索开始时间
* @param endCreateTime:优惠券创建时间的搜索结束时间
* @param status:优惠券状态
* @param page:第几页(最小填1)
* @param pageSize:每页数量(不超过10,000)
* @return
* @throws WxErrorException
*/
WxMinishopCouponStock minishopGetCouponList(String appId, String startCreateTime, String endCreateTime, Integer status, Integer page, Integer pageSize) throws WxErrorException;
/**
* 与小商店对接,将优惠券发送给某人
*
* @param appid:小商店appId
* @param openId:优惠券接收人的openId
* @param couponId: 优惠券ID
* @return
*/
WxOpenResult minishopPushCouponToUser(String appid, String openId, Integer couponId) throws WxErrorException;
/**
* 与小商店对接,更新商城优惠券
*
* @param appId
* @param couponInfo
* @return
* @throws WxErrorException
*/
Integer minishopUpdateCoupon(String appId, WxMinishopCoupon couponInfo) throws WxErrorException;
/**
* 从优惠券创建后status=1,可流转到2,4,5, COUPON_STATUS_VALID = 2 ;//生效 COUPON_STATUS_INVALID = 4 ;//已作废 COUPON_STATUS_DEL = 5;//删除
*
* @param appId
* @param couponId
* @param status
* @return
* @throws WxErrorException
*/
WxOpenResult minishopUpdateCouponStatus(String appId, Integer couponId, Integer status) throws WxErrorException;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//小商店spu接口
String MINISHOP_ADD_SPU_URL = "https://api.weixin.qq.com/product/spu/add";
String MINISHOP_DEL_SPU_URL = "https://api.weixin.qq.com/product/spu/del";
String MINISHOP_UPDATE_SPU_URL = "https://api.weixin.qq.com/product/spu/update";
String MINISHOP_LISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/listing";
String MINISHOP_DELISTING_SPU_URL = "https://api.weixin.qq.com/product/spu/delisting";
/**
* 小商店添加商品接口,添加商品后只是添加到草稿箱,需要通过调用上架商品,并通过审核才能在商城中显示。
*
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | true |
binarywang/WxJava | https://github.com/binarywang/WxJava/blob/84b5c4d2d0774f800237634e5d0336f53c004fe3/weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMinishopService.java | weixin-java-open/src/main/java/me/chanjar/weixin/open/api/WxOpenMinishopService.java | package me.chanjar.weixin.open.api;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.open.bean.minishop.*;
import me.chanjar.weixin.open.bean.result.WxOpenResult;
import java.io.File;
/**
* 微信小商店开店接口
* add by kelven 2021-01-29
*/
public interface WxOpenMinishopService {
String submitMerchantInfoUrl = "https://api.weixin.qq.com/product/register/submit_merchantinfo";
String submitBasicInfoUrl = "https://api.weixin.qq.com/product/register/submit_basicinfo";
String UPLOAD_IMG_MINISHOP_FILE_URL = "https://api.weixin.qq.com/product/img/upload";
String getCategoryUrl = "https://api.weixin.qq.com/product/category/get";
String getBrandsUrl = "https://api.weixin.qq.com/product/brand/get";
String getDeliveryUrl = "https://api.weixin.qq.com/product/delivery/get_freight_template";
/**
* 获取店铺的商品分类
*/
String getShopCatUrl = "https://api.weixin.qq.com/product/store/get_shopcat";
/**
* @param appId
* @param subjectType
* @param busiLicense
* @param organizationCodeInfo
* @param idcardInfo
* @param superAdministratorInfo
* @param merchantShoprtName
* @return
*/
WxOpenResult submitMerchantInfo(String appId, String subjectType, MinishopBusiLicense busiLicense, MinishopOrganizationCodeInfo organizationCodeInfo, MinishopIdcardInfo idcardInfo, MinishopSuperAdministratorInfo superAdministratorInfo, String merchantShoprtName) throws WxErrorException;
WxOpenResult submitBasicInfo(String appId, MinishopNameInfo nameInfo, MinishopReturnInfo returnInfo);
MinishopAuditStatus checkAuditStatus(String wxName) throws WxErrorException;
String uploadImagePicFile(Integer height, Integer width, File file) throws WxErrorException;
MinishopCategories getCategory(Integer fCatId);
MinishopBrandList getBrands();
MinishopShopCatList getShopCat();
}
| java | Apache-2.0 | 84b5c4d2d0774f800237634e5d0336f53c004fe3 | 2026-01-04T14:46:39.499027Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.