|
|
|
@@ -5,6 +5,8 @@ import com.iformall.service.wechat.FmOpenService; |
|
|
|
import me.chanjar.weixin.mp.api.WxMpMessageRouter; |
|
|
|
import me.chanjar.weixin.mp.api.WxMpService; |
|
|
|
import me.chanjar.weixin.mp.constant.WxMpEventConstants; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@@ -21,6 +23,8 @@ import static me.chanjar.weixin.common.api.WxConsts.*; |
|
|
|
@Service |
|
|
|
public class WxMpManager { |
|
|
|
|
|
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass()); |
|
|
|
|
|
|
|
private static Map<String, WxMpMessageRouter> myRouterMap = new ConcurrentHashMap<String, WxMpMessageRouter>(); |
|
|
|
|
|
|
|
|
|
|
|
@@ -52,8 +56,10 @@ public class WxMpManager { |
|
|
|
public WxMpMessageRouter getRouter(WxMpService mpService) { |
|
|
|
String appId = mpService.getWxMpConfigStorage().getAppId(); |
|
|
|
if (myRouterMap.containsKey(appId)) { |
|
|
|
logger.info("found appId : ", appId); |
|
|
|
return myRouterMap.get(appId); |
|
|
|
} else { |
|
|
|
logger.info("found new appId : ", appId); |
|
|
|
return newRouter(mpService); |
|
|
|
} |
|
|
|
} |
|
|
|
|