Commit a4a82dba authored by shiyu's avatar shiyu

登录4

parent 302dda9f
......@@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedHashMap;
......@@ -30,10 +31,10 @@ import java.util.concurrent.TimeUnit;
public class QdWxLoginManager {
private static final Logger logger = LoggerFactory.getLogger(QdWxLoginManager.class);
@Value("${dts.wx.qd_app-id}")
@Value("${dts.qdwx.app-id}")
private String APPLET_APPID;
@Value("${dts.wx.qd_app-secret}")
@Value("${dts.qdwx.app-secret}")
private String APPLET_APP_SECRET;
/**
......@@ -50,8 +51,7 @@ public class QdWxLoginManager {
// 微信小程序获取短链接地址
private static final String GET_LINK_URL = "https://api.weixin.qq.com/wxa/genwxashortlink?access_token=%s";
@Autowired
@Resource(name = "qdWxMaService")
private WxMaService wxMaService;
@Autowired
......
package com.wwdz.ch.core.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.WxMaConfig;
import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig;
import com.github.binarywang.wxpay.config.WxPayConfig;
import com.github.binarywang.wxpay.service.WxPayService;
import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class QdWxConfig {
@Autowired
private QdWxProperties qdWxProperties;
@Bean(name = "qdWxMaConfig")
public WxMaConfig qdWxMaConfig() {
WxMaInMemoryConfig config = new WxMaInMemoryConfig();
config.setAppid(qdWxProperties.getQdAppId());
config.setSecret(qdWxProperties.getAppSecret());
return config;
}
@Bean(name = "qdWxMaService")
public WxMaService qdWxMaService(WxMaConfig qdWxMaConfig) {
WxMaService service = new WxMaServiceImpl();
service.setWxMaConfig(qdWxMaConfig);
return service;
}
@Bean
public WxPayConfig qdWxPayConfig() {
WxPayConfig payConfig = new WxPayConfig();
payConfig.setAppId(qdWxProperties.getQdAppId());
payConfig.setMchId(qdWxProperties.getMchId());
payConfig.setMchKey(qdWxProperties.getMchKey());
payConfig.setNotifyUrl(qdWxProperties.getNotifyUrl());
payConfig.setKeyPath(qdWxProperties.getKeyPath());
payConfig.setTradeType("JSAPI");
payConfig.setSignType("MD5");
return payConfig;
}
@Bean
public WxPayService qdWxPayService(WxPayConfig wxPayConfig) {
WxPayService wxPayService = new WxPayServiceImpl();
wxPayService.setConfig(wxPayConfig);
return wxPayService;
}
}
\ No newline at end of file
package com.wwdz.ch.core.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "dts.qdwx")
public class QdWxProperties {
private String appId;
private String appSecret;
private String mchId;
private String mchKey;
private String notifyUrl;
private String keyPath;
public String getNotifyUrl() {
return notifyUrl;
}
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}
public String getMchKey() {
return mchKey;
}
public void setMchKey(String mchKey) {
this.mchKey = mchKey;
}
public String getQdAppId() {
return appId;
}
public void setQdAppId(String qdAppId) {
this.appId = qdAppId;
}
public String getAppSecret() {
return appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public String getMchId() {
return mchId;
}
public void setMchId(String mchId) {
this.mchId = mchId;
}
public String getKeyPath() {
return keyPath;
}
public void setKeyPath(String keyPath) {
this.keyPath = keyPath;
}
}
dts:
qdwx:
#乾岛
app-id: wx598b9e95a8b13209
app-secret: 107406ff0fcc8d7c3a658b90dd938a08
merchant-id: 123
private-key: 123
merchant-serial_number: 123
apiV3Key: 123123
pay-notify-url: 123
# 开发者应该设置成自己的wx相关信息
# 更换主体要更换id和secret
wx:
#乾岛
qd_app-id: wx598b9e95a8b13209
qd_app-secret: 107406ff0fcc8d7c3a658b90dd938a08
app-id: wx5b4409448bf2c72b
app-secret: 6fee0d7b2197845fed0a3fe8f5a9bd66
......
dts:
# 开发者应该设置成自己的wx相关信息
wx:
qdwx:
#乾岛
qd_app-id: wx598b9e95a8b13209
qd_app-secret: 107406ff0fcc8d7c3a658b90dd938a08
merchant-id: 123
private-key: 123
merchant-serial_number: 123
apiV3Key: 123123
pay-notify-url: 123
wx:
app-id: wx5b4409448bf2c72b
app-secret: 6fee0d7b2197845fed0a3fe8f5a9bd66
mch-id: 1538666666
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment