From ae84ae528290f44c66ef14c92f4a68bd3c1ce617 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期一, 11 十一月 2024 08:50:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
index c003b2e..fdb537f 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TGoodsController.java
@@ -30,7 +30,10 @@
 import com.ruoyi.other.service.TActivityService;
 import com.ruoyi.other.service.TCouponService;
 import com.ruoyi.other.service.TGoodsService;
+import com.ruoyi.payment.api.feignClient.AliPaymentClient;
 import com.ruoyi.payment.api.feignClient.WxPaymentClient;
+import com.ruoyi.payment.api.vo.AliPaymentReq;
+import com.ruoyi.payment.api.vo.AliPaymentResp;
 import com.ruoyi.payment.api.vo.PaymentOrder;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -282,9 +285,12 @@
 
     }
 
+    @Resource
+    private AliPaymentClient aliPaymentClient;
+
     @ApiOperation(tags = {"小程序-现金商城"},value = "支付商品")
     @PostMapping(value = "/app/pay")
-    public R<Map<String, Object>> pay(@RequestBody ExchangeDto exchangeDto) {
+    public Object pay(@RequestBody ExchangeDto exchangeDto) {
         Long userId = tokenService.getLoginUserApplet().getUserId();
         TAppUser user = appUserClient.getUserById(userId).getData();
         boolean isVip = false;
@@ -361,13 +367,20 @@
             mapR.getData().put("orderId",shopOrder.getId().toString());
             return    mapR;
         }else {
-            //todo 罗 支付宝支付
-            return R.ok();
+            AliPaymentReq req = new AliPaymentReq();
+            req.setOutTradeNo(shopOrder.getCode());
+            req.setTotalAmount(shopOrder.getPaymentAmount().toString());
+            req.setSubject("购买商品");
+            req.setBuyerOpenId(user.getAliOpenid());
+            req.setBody("购买商品");
+            req.setNotifyUrl("/payment/ali/callBack");
+            AliPaymentResp data = aliPaymentClient.payment(req).getData();
+            if(null != data){
+                data.setOrderId(shopOrder.getId().toString());
+                return AjaxResult.success(data);
+            }
         }
-
-
-
-
+        return AjaxResult.success();
     }
 
     

--
Gitblit v1.7.1