Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/user-social

 Conflicts:
	yudao-admin-server/pom.xml
	yudao-dependencies/pom.xml
	yudao-user-server/src/main/resources/application-dev.yaml
	yudao-user-server/src/main/resources/application-local.yaml
This commit is contained in:
YunaiV
2021-10-30 09:30:18 +08:00
159 changed files with 6708 additions and 75 deletions

View File

@@ -138,6 +138,9 @@ yudao:
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
demo: true # 开启演示模式
pay:
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify
justauth:

View File

@@ -121,6 +121,18 @@ logging:
file:
name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径
--- #################### 微信公众号相关配置 ####################
wx: # 参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档
mp:
# 公众号配置(必填)
app-id: wx041349c6f39b268b
secret: 5abee519483bc9f8cb37ce280e814bd0
# 存储配置,解决 AccessToken 的跨节点的共享
config-storage:
type: RedisTemplate # 采用 RedisTemplate 操作 Redis会自动从 Spring 中获取
key-prefix: wx # Redis Key 的前缀 TODO 芋艿:解决下 Redis key 管理的配置
http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台
--- #################### 芋道相关配置 ####################
# 芋道配置项,设置当前项目所有自定义的配置
@@ -140,6 +152,9 @@ yudao:
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
demo: false # 关闭演示模式
pay:
pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify
refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify
justauth:

View File

@@ -20,6 +20,10 @@ spring:
write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳
fail-on-empty-beans: false # 允许序列化无属性的 Bean
# 静态资源
mvc:
static-path-pattern: /static/**
# MyBatis Plus 的配置项
mybatis-plus:
configuration:
@@ -33,6 +37,8 @@ mybatis-plus:
mapper-locations: classpath*:mapper/*.xml
type-aliases-package: ${yudao.info.base-package}.modules.*.dal.dataobject, ${yudao.core-service.base-package}.modules.*.dal.dataobject
--- #################### 芋道相关配置 ####################
yudao:

View File

@@ -0,0 +1 @@
DKOvVzFP7vPwwHx2

View File

@@ -0,0 +1,117 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"/>
<title>支付测试页</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
</head>
<body>
<div>点击如下按钮,发起支付的测试</div>
<div>
<button id="wx_pub">微信公众号</button>
</div>
</body>
<script>
let shopOrderId = undefined;
let payOrderId = undefined;
// let server = 'http://127.0.0.1:28080';
let server = 'http://niubi.natapp1.cc';
// TODO openid
let openid = "ockUAwIZ-0OeMZl9ogcZ4ILrGba0";
$(function() {
// 获得 JsapiTicket
// 参考 https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 文档
$.ajax({
url: server + "/api/wx/mp/create-jsapi-signature?url=" + document.location.href,
method: 'POST',
success: function( result ) {
if (result.code !== 0) {
alert('获取 JsapiTicket 失败,原因:' + result.msg)
return;
}
var jsapiTicket = result.data;
jsapiTicket.jsApiList = ['chooseWXPay'];
jsapiTicket.debug = false;
// 初始化 JS
wx.config(jsapiTicket);
}
});
// 自动发起商城订单编号
$.ajax({
url: server + "/api/shop/order/create",
method: 'POST',
success: function( result ) {
if (result.code !== 0) {
alert('创建商城订单失败,原因:' + result.msg)
return;
}
shopOrderId = result.data.id;
payOrderId = result.data.payOrderId;
console.log("商城订单:" + shopOrderId)
console.log("支付订单:" + payOrderId)
}
})
})
// 微信公众号
$( "#wx_pub").on( "click", function() {
if (typeof WeixinJSBridge == "undefined") {
// if (document.addEventListener) {
// document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
// } else if (document.attachEvent) {
// document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
// document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
// }
alert('微信支付,只支持在微信客户端中使用!');
return;
}
if (navigator.userAgent.indexOf('wechatdevtools') >= 0) {
alert('微信支付,无法在微信开发者工具中使用!请使用微信客户端!');
return;
}
// 提交支付
// 参考 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6 文档
// 参考 https://segmentfault.com/a/1190000020704650 文档
$.ajax({
url: server + "/api/pay/order/submit",
method: 'POST',
dataType: "json",
contentType: "application/json",
data: JSON.stringify({
"id": payOrderId,
"channelCode": 'wx_pub',
"channelExtras": {
"openid": openid
}
}),
success: function( result ) {
if (result.code !== 0) {
alert('提交支付订单失败,原因:' + result.msg)
return;
}
alert('点击确定,开始微信支付');
// 开始调用微信支付
let data = result.data.invokeResponse;
wx.chooseWXPay({
timestamp: data.timeStamp,
nonceStr: data.nonceStr,
package: data.packageValue,
signType: data.signType,
paySign: data.paySign,
success: function (res) {
alert(JSON.stringify(res));
},
error: function(e) {
alert(JSON.stringify(e));
}
});
}
})
});
</script>
</html>