apple支付部分逻辑
This commit is contained in:
@@ -2,13 +2,16 @@ package com.ruoyi.web.controller.back;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.system.util.AppleNotificationProcessor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 描述:
|
||||
@@ -19,10 +22,23 @@ import java.util.Map;
|
||||
@RestController
|
||||
public class CallBackController {
|
||||
private static final Logger log = LoggerFactory.getLogger(CallBackController.class);
|
||||
|
||||
@Autowired
|
||||
private AppleNotificationProcessor notificationProcessor;
|
||||
|
||||
@RequestMapping("/ios")
|
||||
public void iosCallBack(@RequestBody Map<String,Object> param){
|
||||
System.out.println(param);
|
||||
log.info("ios 回调参数:{}", JSONUtil.toJsonStr( param));
|
||||
public void iosCallBack(@RequestBody String notificationBody) {
|
||||
//System.out.println(notificationBody);
|
||||
//log.info("ios 回调参数:{}", JSONUtil.toJsonStr(notificationBody));
|
||||
try {
|
||||
// 异步处理,避免超时
|
||||
CompletableFuture.runAsync(() -> {
|
||||
notificationProcessor.processSignedPayload(notificationBody);
|
||||
});
|
||||
|
||||
}catch (Exception e){
|
||||
log.error("处理iOS回调异常: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 客户端订单Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-27
|
||||
*/
|
||||
@@ -40,7 +40,6 @@ public class ClientOrderInfoController extends BaseController
|
||||
// 获取客户端IP
|
||||
String clientIp = getClientIp(httpRequest);
|
||||
request.setClientIp(clientIp);
|
||||
|
||||
return orderInfoService.createOrder(request);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("创建订单失败: " + e.getMessage());
|
||||
@@ -110,7 +109,7 @@ public class ClientOrderInfoController extends BaseController
|
||||
if (loginUser == null) {
|
||||
return AjaxResult.error(401,"用户未登录");
|
||||
}
|
||||
|
||||
|
||||
List<OrderInfo> orders = orderInfoService.selectUserOrders(loginUser.getUserId());
|
||||
return AjaxResult.success("查询成功", orders);
|
||||
} catch (Exception e) {
|
||||
@@ -128,13 +127,13 @@ public class ClientOrderInfoController extends BaseController
|
||||
if (orderInfo == null) {
|
||||
return AjaxResult.error("订单不存在");
|
||||
}
|
||||
|
||||
|
||||
// 检查用户权限
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser == null || !loginUser.getUserId().equals(orderInfo.getUserId())) {
|
||||
return AjaxResult.error(401,"无权限查看此订单");
|
||||
}
|
||||
|
||||
|
||||
return AjaxResult.success("查询成功", orderInfo);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("查询订单详情失败: " + e.getMessage());
|
||||
|
||||
@@ -67,21 +67,21 @@ spring:
|
||||
enabled: true
|
||||
# redis 配置
|
||||
redis:
|
||||
# host: 116.204.124.80
|
||||
# # 端口,默认为6379
|
||||
# port: 16379
|
||||
# # 数据库索引
|
||||
# database: 0
|
||||
# # 密码
|
||||
# password: Lwz19520416443@
|
||||
# # 地址
|
||||
host: 127.0.0.1
|
||||
host: 116.204.124.80
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
port: 16379
|
||||
# 数据库索引
|
||||
database: 0
|
||||
# 密码
|
||||
password:
|
||||
password: Lwz19520416443@
|
||||
# # 地址
|
||||
# host: 127.0.0.1
|
||||
# # 端口,默认为6379
|
||||
# port: 6379
|
||||
# # 数据库索引
|
||||
# database: 0
|
||||
# # 密码
|
||||
# password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
||||
Reference in New Issue
Block a user