“mitao”
2025-12-24 b82e78ceb8f52b05203f05eb4b14151b1ab408a2
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);
    }
}