From 48323fce3b4b8013755421aa1d1feb9a73cddde9 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 03 一月 2024 11:42:17 +0800
Subject: [PATCH] 合并代码

---
 cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java |   35 ++++++++++++++++++++++++++---------
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
index 9bd5b02..59e44a1 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/SiteController.java
@@ -7,6 +7,7 @@
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.dsh.other.entity.*;
+import com.dsh.other.feignclient.CourseRecordClient;
 import com.dsh.other.feignclient.account.CityManagerClient;
 import com.dsh.other.feignclient.activity.UserCouponClient;
 import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId;
@@ -372,7 +373,13 @@
         }
     }
 
+    @Autowired
+    private TGameConfigService gameConfigService;
+    @Autowired
+    private TGameRecordService gameRecordService;
 
+    @Resource
+    private CourseRecordClient courseRecordClient;
     /**
      * 启动游戏支付宝回调
      *
@@ -388,17 +395,26 @@
             if (null != map) {
 
                 String code = map.get("passback_params");
-//                String trade_no = map.get("trade_no");
-//                SiteBooking siteBooking = siteBookingService.getOne(new QueryWrapper<SiteBooking>().eq("orderNo", code).eq("state", 1));
-//                if(siteBooking.getStatus() == 0){
-//                    siteBooking.setPayTime(new Date());
-//                    siteBooking.setStatus(1);
-//                    siteBooking.setPayOrderNo(trade_no);
-//                    siteBookingService.updateById(siteBooking);
-//                }
-
+                String trade_no = map.get("trade_no");
                 String[] s = code.split("_");
                 Integer i = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3]));
+                List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("number", s[4]).eq("payType", 2));
+                TGameRecord one = list.get(0);
+                TGameConfig config = gameConfigService.getById(s[5]);
+                for (TGameRecord coursePackagePayment : list) {
+                    coursePackagePayment.setStatus(1);
+                    coursePackagePayment.setMoney(config.getCash());
+                    coursePackagePayment.setOrderNo(trade_no);
+
+                    CourseCounsum courseCounsum = new CourseCounsum();
+                    courseCounsum.setChangeType(3);
+                    courseCounsum.setInsertTime(new Date());
+                    courseCounsum.setReason("智慧球场;" + config.getCash());
+                    courseCounsum.setAppUserId(Integer.valueOf(s[0]));
+                    courseRecordClient.save(courseCounsum);
+                }
+                gameRecordService.updateBatchById(list);
+
                 System.err.println("===========游戏回调游戏回调=========" + i);
                 PrintWriter out = response.getWriter();
                 out.write("success");
@@ -423,6 +439,7 @@
         JSONObject jsonObject = JSONObject.parseObject(s);
         Object code = jsonObject.get("code");
         if (String.valueOf(code) != null && "200".equals(String.valueOf(code))) {
+            System.err.println("启动了一次游戏");
             return 200;
         } else {
             return 500;

--
Gitblit v1.7.1