
com.binarywang.spring.starter.wxjava.mp.service.WxMpMultiServicesImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wx-java-mp-multi-spring-boot-starter Show documentation
Show all versions of wx-java-mp-multi-spring-boot-starter Show documentation
微信公众号开发的 Spring Boot Starter::支持多账号配置
The newest version!
package com.binarywang.spring.starter.wxjava.mp.service;
import me.chanjar.weixin.mp.api.WxMpService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 企业微信 {@link WxMpMultiServices} 默认实现
*
* @author yl
* created on 2024/1/23
*/
public class WxMpMultiServicesImpl implements WxMpMultiServices {
private final Map services = new ConcurrentHashMap<>();
@Override
public WxMpService getWxMpService(String tenantId) {
return this.services.get(tenantId);
}
/**
* 根据租户 Id,添加一个 WxMpService 到列表
*
* @param tenantId 租户 Id
* @param wxMpService WxMpService 实例
*/
public void addWxMpService(String tenantId, WxMpService wxMpService) {
this.services.put(tenantId, wxMpService);
}
@Override
public void removeWxMpService(String tenantId) {
this.services.remove(tenantId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy