123
This commit is contained in:
53
ruoyi-admin/src/main/java/com/ruoyi/proxy/PayProxyInit.java
Normal file
53
ruoyi-admin/src/main/java/com/ruoyi/proxy/PayProxyInit.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.ruoyi.proxy;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.ijpay.core.http.AbstractHttpDelegate;
|
||||
import com.ijpay.core.kit.HttpKit;
|
||||
import com.ruoyi.cai.config.CaiProperties;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Proxy;
|
||||
|
||||
@Component
|
||||
public class PayProxyInit {
|
||||
@Autowired
|
||||
private CaiProperties caiProperties;
|
||||
|
||||
@PostConstruct
|
||||
public void init(){
|
||||
boolean openPayProxy = caiProperties.isOpenPayProxy();
|
||||
if(openPayProxy){
|
||||
String proxyIp = caiProperties.getProxyIp();
|
||||
int proxyHost = caiProperties.getProxyHost();
|
||||
ProxyHttpKit proxyHttpKit = new ProxyHttpKit();
|
||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyIp, proxyHost));
|
||||
proxyHttpKit.setCustomProxy(proxy);
|
||||
HttpKit.setDelegate(proxyHttpKit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Setter
|
||||
public static class ProxyHttpKit extends AbstractHttpDelegate {
|
||||
|
||||
private Proxy customProxy;
|
||||
|
||||
@Override
|
||||
public Proxy getProxy(){
|
||||
return customProxy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String post(String url, String data) {
|
||||
return HttpRequest.post(url)
|
||||
.setProxy(customProxy)
|
||||
.body(data)
|
||||
.execute().body();
|
||||
// return HttpUtil.post(url, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,3 +113,6 @@ knife4j:
|
||||
secret: 0rhEH2ILED2WiVReyXeWEXE5NklDARdWkerW9/IruLY=
|
||||
# 当前服务名称
|
||||
service-name: oneToOne
|
||||
cai:
|
||||
enable-api-encryption: false
|
||||
open-pay-proxy: false
|
||||
|
||||
@@ -101,6 +101,9 @@ yunxin:
|
||||
app-secret: 470345ca2832
|
||||
cai:
|
||||
enable-api-encryption: true
|
||||
open-pay-proxy: false
|
||||
proxy-ip: 159.75.218.177
|
||||
proxy-host: 7693
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: false
|
||||
|
||||
@@ -9,8 +9,13 @@ import org.springframework.stereotype.Component;
|
||||
@ConfigurationProperties(prefix = "cai")
|
||||
public class CaiProperties {
|
||||
|
||||
private boolean openPayProxy;
|
||||
private String proxyIp;
|
||||
private int proxyHost;
|
||||
|
||||
private String homeName = "恋香";
|
||||
private String coinName = "黄钻";
|
||||
private boolean enableApiEncryption = true;
|
||||
private boolean websocket = true;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.cai.pay;
|
||||
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.ijpay.alipay.AliPayApiConfig;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AliPayApiConfigExtend extends AliPayApiConfig {
|
||||
private String proxyIp;
|
||||
private Integer proxyHost;
|
||||
private AlipayClient alipayClient;
|
||||
|
||||
public void init() {
|
||||
alipayClient = new DefaultAlipayClient(getServiceUrl(), getAppId(), getPrivateKey(), getFormat(),
|
||||
getCharset(), getAliPayPublicKey(), getSignType(), proxyIp, proxyHost);
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@@ -24,6 +22,8 @@ public class PayConfigManager {
|
||||
private PayTotalService payTotalService;
|
||||
@Autowired
|
||||
private PayConfigService payConfigService;
|
||||
@Autowired
|
||||
private CaiProperties caiProperties;
|
||||
|
||||
public void deletePayConfigAli(PayConfig payConfig) {
|
||||
if(PayTypeEnum.ALI.getCode().equals(payConfig.getPayType())){
|
||||
|
||||
@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDynamicImageList" resultType="java.lang.String">
|
||||
select t2.url
|
||||
from cai_dynamic t1
|
||||
join cai_dynamic_images t2 on t1.user_id = t2.user_id
|
||||
join cai_dynamic_images t2 on t1.user_id = t2.user_id and t1.id = t2.dynamic_id
|
||||
where t1.audit_status = 2 and t1.user_id = #{userId}
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user