mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-03-31 13:33:42 +08:00
feat: 移除微信支付
This commit is contained in:
@@ -32,12 +32,6 @@
|
||||
<version>${zxing.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.stripe</groupId>
|
||||
<artifactId>stripe-java</artifactId>
|
||||
<version>${stripe.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -5,8 +5,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
|
||||
/**
|
||||
* 支付配置信息
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
package org.ruoyi.common.config;
|
||||
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
|
||||
|
||||
import org.ruoyi.common.core.service.ConfigService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author Binary Wang
|
||||
*/
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class WxPayConfiguration {
|
||||
|
||||
private final ConfigService configService;
|
||||
|
||||
private WxPayService wxPayService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
WxPayConfig payConfig = new WxPayConfig();
|
||||
payConfig.setAppId(StringUtils.trimToNull(getKey("appId")));
|
||||
payConfig.setMchId(StringUtils.trimToNull(getKey("mchId")));
|
||||
payConfig.setMchKey(StringUtils.trimToNull(getKey("appSecret")));
|
||||
payConfig.setUseSandboxEnv(false);
|
||||
wxPayService = new WxPayServiceImpl();
|
||||
wxPayService.setConfig(payConfig);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WxPayService wxService() {
|
||||
return wxPayService;
|
||||
}
|
||||
|
||||
public String getKey(String key) {
|
||||
return configService.getConfigValue("weixin", key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package org.ruoyi.common.listener;
|
||||
|
||||
import com.github.binarywang.wxpay.config.WxPayConfig;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import org.ruoyi.common.core.event.ConfigChangeEvent;
|
||||
import org.ruoyi.common.core.service.ConfigService;
|
||||
import org.ruoyi.common.core.utils.StringUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 创建一个监听器,用于处理配置变化事件
|
||||
*
|
||||
* @author ageerle@163.com
|
||||
* date 2024/5/19
|
||||
*/
|
||||
@Component
|
||||
public class ConfigChangeListener implements ApplicationListener<ConfigChangeEvent> {
|
||||
private final WxPayService wxPayService;
|
||||
private final ConfigService configService;
|
||||
|
||||
public ConfigChangeListener(WxPayService wxPayService, ConfigService configService) {
|
||||
this.wxPayService = wxPayService;
|
||||
this.configService = configService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(@NotNull ConfigChangeEvent event) {
|
||||
WxPayConfig newConfig = new WxPayConfig();
|
||||
newConfig.setAppId(StringUtils.trimToNull(configService.getConfigValue("weixin", "appId")));
|
||||
newConfig.setMchId(StringUtils.trimToNull(configService.getConfigValue("weixin", "mchId")));
|
||||
newConfig.setMchKey(StringUtils.trimToNull(configService.getConfigValue("weixin", "mchKey")));
|
||||
newConfig.setUseSandboxEnv(false);
|
||||
wxPayService.setConfig(newConfig);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user