From aa2c6d722ed799290285b6365f011aaa74373d73 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期六, 23 十二月 2023 17:30:07 +0800
Subject: [PATCH] 11.27,9

---
 cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java |   40 ++++++++++++++++++++++++++++++----------
 1 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
index df35d12..c14da34 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java
@@ -10,15 +10,13 @@
 import com.dsh.other.feignclient.account.AppUserClient;
 import com.dsh.other.feignclient.account.model.AppUser;
 import com.dsh.other.model.QueryMySiteVo;
-import com.dsh.other.service.ISiteLockService;
-import com.dsh.other.service.TGameConfigService;
-import com.dsh.other.service.TGameRecordService;
-import com.dsh.other.service.TGameService;
+import com.dsh.other.service.*;
 import com.dsh.other.util.*;
 import com.dsh.other.util.httpClinet.HttpResult;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
+import net.bytebuddy.asm.Advice;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -123,8 +121,9 @@
             return ResultUtil.runErr();
         }
     }
-
-
+    private String smid = "2088330203191220";//平台支付宝商户号
+    @Autowired
+    private ISiteService siteService;
     @ResponseBody
     @PostMapping("/payGame")
     @ApiOperation(value = "支付游戏", tags = {"用户—游戏"})
@@ -212,10 +211,21 @@
                 return weixinpay;
             } else if (type == 2) {
 //                Integer gameId, Integer configId,Integer type,Integer sutuId,Integer spaceId;
-
+                String smid1="";
                 String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId;
+                // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号
+                TGame game = gameService.getById(gameId);
 
-                ResultUtil alipay = payMoneyUtil.alipay("游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
+                Integer operationId = game.getOperationId();
+                if (operationId==0){
+                    // 是平台的
+                    smid1 = smid;
+                }else{
+                    String smidByOperatorId = siteService.getSMIDByOperatorId(operationId);
+                    smid1 = smidByOperatorId;
+                }
+
+                ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback");
                 if (alipay.getCode() == 200) {
                     new Thread(new Runnable() {
                         @Override
@@ -253,7 +263,6 @@
                                                 coursePackagePayment.setStatus(1);
                                                 coursePackagePayment.setMoney(config.getCash());
                                                 coursePackagePayment.setOrderNo(tradeNo);
-
                                                 CourseCounsum courseCounsum = new CourseCounsum();
 //                                                courseCounsum.setPaymentId(paymentId);
                                                 courseCounsum.setChangeType(3);
@@ -261,10 +270,21 @@
                                                 courseCounsum.setReason("智慧球场;" + config.getCash());
                                                 courseCounsum.setAppUserId(uid);
                                                 courseRecordClient.save(courseCounsum);
-
                                             }
                                             gameRecordService.updateBatchById(list);
                                             Integer integer = startGame(uid, gameId, spaceId, sutuId);
+                                            // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号
+                                            TGame game = gameService.getById(gameId);
+                                            String smid2="";
+                                            Integer operationId = game.getOperationId();
+                                            if (operationId==0){
+                                                // 是平台的
+                                                smid2 = smid;
+                                            }else{
+                                                String smidByOperatorId = siteService.getSMIDByOperatorId(operationId);
+                                                smid2 = smidByOperatorId;
+                                            }
+                                            payMoneyUtil.confirm(smid2,code,tradeNo,config.getCash().toString());
                                             break;
                                         }
                                         if ("WAIT_BUYER_PAY".equals(s)) {

--
Gitblit v1.7.1