From b82e78ceb8f52b05203f05eb4b14151b1ab408a2 Mon Sep 17 00:00:00 2001
From: “mitao” <“2763622819@qq.com”>
Date: 星期三, 24 十二月 2025 18:52:23 +0800
Subject: [PATCH] feat:下单功能联调及短信对接

---
 ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
index 721ebfc..0960f95 100644
--- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
+++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/OrderController.java
@@ -189,4 +189,41 @@
         boolean success = appletOrderService.confirmBigGiftOrder(id, userId);
         return success ? R.ok() : R.fail("确认收货失败,订单不存在或状态不正确");
     }
+
+    /**
+     * 实物商品立即支付(从Redis获取缓存的支付参数)
+     *
+     * @param id 订单ID
+     * @return 支付参数
+     */
+    @ApiOperation(value = "实物商品待支付订单立即支付", response = PlaceOrderVO.class)
+    @GetMapping("/physical/pay-now/{id}")
+    public R<PlaceOrderVO> physicalPayNow(@PathVariable Integer id) {
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        PlaceOrderVO result = physicalGoodsOrderService.payNow(id, userId);
+        return R.ok(result);
+    }
+
+    /**
+     * 大礼包立即支付(生成新的支付参数)
+     *
+     * @param id 订单ID
+     * @return 支付参数
+     */
+    @ApiOperation(value = "大礼包待支付订单立即支付", response = PlaceOrderVO.class)
+    @GetMapping("/big-gift/pay-now/{id}")
+    public R<PlaceOrderVO> bigGiftPayNow(@PathVariable Integer id) {
+        // 获取当前登录用户
+        Integer userId = tokenService.getLoginUserApplet().getUserId();
+        TAppUser appUser = appUserService.getById(userId);
+        if (appUser == null) {
+            return R.fail("用户不存在");
+        }
+        if (appUser.getOpenid() == null || appUser.getOpenid().isEmpty()) {
+            return R.fail("用户未绑定微信");
+        }
+
+        PlaceOrderVO result = bigGiftPackageOrderService.payNow(id, userId, appUser.getOpenid());
+        return R.ok(result);
+    }
 }

--
Gitblit v1.7.1