From f36e315c3074ebd2ce2147b6b380d038d81517e8 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 27 五月 2026 19:42:44 +0800
Subject: [PATCH] 666 新增代金券

---
 Main/SDK/SDKUtils.cs |   72 ++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/Main/SDK/SDKUtils.cs b/Main/SDK/SDKUtils.cs
index 32532cb..62ff119 100644
--- a/Main/SDK/SDKUtils.cs
+++ b/Main/SDK/SDKUtils.cs
@@ -939,49 +939,51 @@
     /// 
     public void FreePlatformPay(string title, float money, string cpInfo)
     {
-        // 鎻愮ず鏄惁浣跨敤浠i噾鍒�
-        var gameCash = UIHelper.GetAllVourcher();
-
-        bool isBuyGameCash = false; //浠i噾鍒告湰韬殑鍏呭�间笉鑳界敤浠i噾鍒歌喘涔� 閫犳垚寰幆
+        // 浠i噾鍒�/鐜伴噾绀煎埜鏈韩鐨勫厖鍊间笉鑳戒娇鐢ㄤ唬閲戝埜璐拱 閫犳垚寰幆
+        bool isBuyGameCash = false;
         int ctgID = RechargeManager.Instance.orderInfoToCTGID[cpInfo];
         if (ctgID != 0)
         {
-            isBuyGameCash = CTGConfig.Get(ctgID).PayType == 17;
+            var payType = CTGConfig.Get(ctgID).PayType;
+            isBuyGameCash = (payType == 17 || payType == 27);
         }
 
-
-        if (!isBuyGameCash && gameCash >= money * 100)
+        if (isBuyGameCash)
         {
+            FreePlatformPayEx(title, money, cpInfo);
+            return;
+        }
 
+        long needMoney = (long)(money * 100);  // money鏄厓锛宯eedMoney鏄垎
+        long cashVoucher = UIHelper.GetMoneyCnt(97);
+        long diamond = UIHelper.GetMoneyCnt(99);
+
+        bool hasEnoughVoucher = cashVoucher >= needMoney;
+        bool hasEnoughDiamond = diamond >= needMoney;
+
+        if (hasEnoughVoucher || hasEnoughDiamond)
+        {
+            // 寮瑰嚭鏀粯鏂瑰紡閫夋嫨妗嗭紙鐜伴噾绀煎埜/鐜勭帀浜岄�変竴锛�
             UIManager.Instance.CloseWindow<GotoChargeWin>();
-            if (DayRemind.Instance.GetDayRemind(DayRemind.DJQTip))
-            {
-                var pack = new CA125_tagCMCoinBuyOrderInfo();
-                pack.AppID = VersionConfig.Get().appId;
-                pack.AppIDLen = (byte)pack.AppID.Length;
-                pack.OrderInfo = cpInfo;
-                pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
-                GameNetSystem.Instance.SendInfo(pack);
-            }
-            else
-            {
-                ConfirmCancel.ShowPopConfirm(
-                    Language.Get("Mail101"),
-                    Language.Get("GameCashRule1", money, title),
-                    (bool isOk) =>
+            int defaultMoneyType = hasEnoughVoucher ? 97 : 99;
+            ConfirmCancel.ShowPayMethodConfirm(
+                97, (int)needMoney, Language.Get("Recharge8"),     // 鐜伴噾绀煎埜
+                99, (int)needMoney, Language.Get("Recharge7"),     // 鐜勭帀
+                Language.Get("Recharge6", UIHelper.GetIconNameWithMoneyType(defaultMoneyType), money, title),
+                money, title,
+                (bool isOk, int selectedMoneyType) =>
+                {
+                    if (isOk)
                     {
-                        if (isOk)
-                        {
-                            var pack = new CA125_tagCMCoinBuyOrderInfo();
-                            pack.AppID = VersionConfig.Get().appId;
-                            pack.AppIDLen = (byte)pack.AppID.Length;
-                            pack.OrderInfo = cpInfo;
-                            pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
-                            GameNetSystem.Instance.SendInfo(pack);
-                        }
-
-                    });
-            }
+                        var pack = new CA125_tagCMCoinBuyOrderInfo();
+                        pack.AppID = VersionConfig.Get().appId;
+                        pack.AppIDLen = (byte)pack.AppID.Length;
+                        pack.OrderInfo = cpInfo;
+                        pack.OrderInfoLen = (byte)pack.OrderInfo.Length;
+                        pack.UseMoneyType = (byte)selectedMoneyType;
+                        GameNetSystem.Instance.SendInfo(pack);
+                    }
+                });
         }
         else
         {
@@ -1293,7 +1295,7 @@
             SendGaoreEvent(dataType, pageType, pageName, pageItemId, money, orderID);
             return;
         }
-        else if (appID == "sghy")
+        else if (appID == "sghy" && dataType == 7)
         {
             SendOverSeaTraceEvent("tutorial_complete");
         }

--
Gitblit v1.8.0