mitao
2025-01-17 afa0dbb4f54e7244835dd67ec33c3e545f122f71
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/config/WxCpConfiguration.java
@@ -27,26 +27,38 @@
    private WxCpProperties properties;
    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnMissingBean(name = "wxService")
    public WxCpService wxService() {
        WxCpDefaultConfigImpl wxCpConfigStorage = new WxCpDefaultConfigImpl();
        wxCpConfigStorage.setCorpId(properties.getCorpId());
        wxCpConfigStorage.setAgentId(properties.getAgentId());
        wxCpConfigStorage.setCorpSecret(properties.getAgentSecret());
        wxCpConfigStorage.setAesKey(properties.getEncodingAESKey());
        wxCpConfigStorage.setToken(properties.getToken());
        WxCpService wxService = new WxCpServiceImpl();
        wxService.setWxCpConfigStorage(wxCpConfigStorage);
        return wxService;
    }
    @Bean
    @ConditionalOnMissingBean(name = "adWxService")
    public WxCpService adWxService() {
        WxCpDefaultConfigImpl wxAdCpConfigStorage = new WxCpDefaultConfigImpl();
        wxAdCpConfigStorage.setCorpId(properties.getCorpId());
        wxAdCpConfigStorage.setAgentId(properties.getAgentId());
        wxAdCpConfigStorage.setCorpSecret(properties.getAddressSecret());
        wxAdCpConfigStorage.setAesKey(properties.getEncodingAESKey());
        wxAdCpConfigStorage.setToken(properties.getToken());
        WxCpService adWxService = new WxCpServiceImpl();
        adWxService.setWxCpConfigStorage(wxAdCpConfigStorage);
        return adWxService;
    }
    @Bean
    @ConditionalOnMissingBean
    public WxCryptUtil wxCryptUtil() {
        WxCryptUtil wxCryptUtil = new WxCryptUtil("", "", properties.getCorpId());
        WxCryptUtil wxCryptUtil = new WxCryptUtil(properties.getToken(), properties.getEncodingAESKey(), properties.getCorpId());
        return wxCryptUtil;
    }
}