student 15 stundas atpakaļ
vecāks
revīzija
3863ef1003

+ 66 - 0
website/Areas/Millions/Controllers/HomeController.cs

@@ -220,6 +220,72 @@ namespace LotteryWebApp.Areas.Millions.Controllers
                 {
                      HttpContext.Session.SetString("termType", termType);
                 }
+
+                // Get Term Results for Jackpot
+                string cachedBolet = HttpContext.Session.GetString("bolet");
+                if (!string.IsNullOrEmpty(cachedBolet))
+                {
+                    model.bolet = cachedBolet;
+                    model.lastResult = HttpContext.Session.GetString("lastResult");
+                    model.lastResultDate = HttpContext.Session.GetString("lastResultDate");
+                    model.nextRoundDate = HttpContext.Session.GetString("nextRoundDate");
+                }
+                else
+                {
+                    String fromDate = DateTime.Now.AddDays(-2).ToString("dd/MM/yyyy");
+                    String toDate = DateTime.Now.ToString("dd/MM/yyyy");
+                    string lang = CultureInfo.CurrentCulture.Name;
+                    string langValue = (lang.StartsWith("en") || lang.StartsWith("fr")) ? "0" : "1";
+
+                    // Get Last Result
+                    ResultOfTermRequest resultOfTermRequest = new ResultOfTermRequest
+                    {
+                        gameId = model.termType,
+                        language = langValue,
+                        token = token,
+                        type = Constants.TERM_HAS_RESULT_TYPE,
+                        order = Constants.DECS,
+                        fromDate = fromDate,
+                        toDate = toDate,
+                        rowsOnPage = Constants.ROW_ON_PAGE,
+                        seqPage = "1",
+                        id = Constants.ALL_DATA
+                    };
+
+                    ResultOfTermResponse result = api.GetResultOfTermApi(configuration, resultOfTermRequest);
+                    if (result.responseCode == Code.SUCCESS && result.listTerm != null && result.listTerm.Count > 0)
+                    {
+                        model.bolet = result.listTerm[0].bolet;
+                        model.lastResult = result.listTerm[0].result;
+                        model.lastResultDate = result.listTerm[0].date_random;
+                        model.nextRoundDate = result.listTerm[0].date_end;
+                        HttpContext.Session.SetString("nextRoundDate", model.nextRoundDate ?? "");
+                        HttpContext.Session.SetString("bolet", model.bolet ?? "");
+                        HttpContext.Session.SetString("lastResult", model.lastResult ?? "");
+                        HttpContext.Session.SetString("lastResultDate", model.lastResultDate ?? "");
+                    }
+
+                    //// Get Next Round
+                    //ResultOfTermRequest nextRoundRequest = new ResultOfTermRequest
+                    //{
+                    //    gameId = model.termType,
+                    //    language = langValue,
+                    //    token = token,
+                    //    type = Constants.TERM_HAS_NOT_RESULT_TYPE,
+                    //    order = Constants.ASC,
+                    //    fromDate = DateTime.Now.ToString("dd/MM/yyyy"),
+                    //    toDate = DateTime.Now.AddDays(7).ToString("dd/MM/yyyy"),
+                    //    rowsOnPage = "1",
+                    //    seqPage = "1",
+                    //    id = Constants.ALL_DATA
+                    //};
+                    //ResultOfTermResponse nextResult = api.GetResultOfTermApi(configuration, nextRoundRequest);
+                    //if (nextResult.responseCode == Code.SUCCESS && nextResult.listTerm != null && nextResult.listTerm.Count > 0)
+                    //{
+                    //    model.nextRoundDate = nextResult.listTerm[0].date_random;
+                    //    HttpContext.Session.SetString("nextRoundDate", model.nextRoundDate ?? "");
+                    //}
+                }
             }
             catch (Exception ex)
             {

+ 47 - 41
website/Areas/Millions/Views/Home/GameHome.cshtml

@@ -7,16 +7,7 @@
 @using LotteryWebApp.Controllers;
 @using LotteryWebApp.Common;
 
-@functions {
-    public string FormatMoney(string amount) {
-        if (string.IsNullOrEmpty(amount)) return "0";
-        var clean = new string(amount.Where(c => char.IsDigit(c)).ToArray());
-        if (long.TryParse(clean, out long val)) {
-            return val.ToString("#,##0", new System.Globalization.CultureInfo("vi-VN")).Replace(",", ".");
-        }
-        return amount;
-    }
-}
+
 
 @section Styles {
     <link rel="preconnect" href="https://fonts.googleapis.com">
@@ -28,6 +19,15 @@
 <div class="main-content h-dvh w-full max-w-[430px] mx-auto bg-[#f5f7fb] relative overflow-hidden font-bricolage">
 
     <!-- Scrollable content area -->
+    @{
+        var hasResult = !string.IsNullOrEmpty(Model.lastResult);
+        var resultBalls = hasResult ? Model.lastResult.Split(',') : null;
+        if (hasResult && resultBalls.Length < 6) {
+            var temp = new string[6];
+            for (int i = 0; i < 6; i++) temp[i] = i < resultBalls.Length ? resultBalls[i] : "0";
+            resultBalls = temp;
+        }
+    }
     <div class="absolute inset-x-0 top-0 bottom-[88px] overflow-y-auto flex flex-col">
 
         <!-- Top section with header + cards -->
@@ -55,7 +55,7 @@
                         <p class="text-white text-base font-semibold leading-tight">@(Model?.profile?.users ?? "User")</p>
                         <div class="mt-2 flex items-center justify-between gap-2 rounded-full border border-white/35 bg-white/10 px-3 py-2">
                             <div class="flex items-center gap-1 min-w-0">
-                                <span class="text-3xl font-condensed text-gold-gradient leading-none truncate">@FormatMoney(Model?.userStatus?.bet_coin)</span>
+                                <span class="text-3xl font-condensed text-gold-gradient leading-none truncate">@Utils.FormatMoney(Model?.userStatus?.bet_coin)</span>
                                 <img src="/Millions/assets/icons/coin.png" alt="" class="w-5 h-5 shrink-0"/>
                                 <span class="text-white text-sm shrink-0">@Lang.millions_htg</span>
                             </div>
@@ -73,7 +73,7 @@
                     <img src="/Millions/assets/icons/calendar.png" alt="" class="w-6 h-6"/>
                     <div>
                         <p class="text-xs text-[#797979]">@Lang.next_round</p>
-                        <p class="text-xs font-bold text-black" id="draw-date">Friday, Mar 20, 2026</p>
+                        <p class="text-xs font-bold text-black" id="draw-date">@Utils.FormatResultDate(Model.nextRoundDate)</p>
                     </div>
                 </div>
                 <div class="w-px h-12 bg-gray-200"></div>
@@ -82,7 +82,7 @@
                     <div>
                         <p class="text-xs text-[#797979]">@Lang.jackpot_prize</p>
                         <p class="leading-none ">
-                            <span class="text-base font-extrabold text-[#002bff]">30.000.000</span><span class="text-[10.32px] font-extrabold text-black align-top">@Lang.millions_htg</span>
+                            <span class="text-base font-extrabold text-[#002bff]">@Utils.FormatMoney(Model.bolet ?? "30000000")</span><span class="text-[10.32px] font-extrabold text-black align-top">@Lang.millions_htg</span>
                         </p>
                     </div>
                 </div>
@@ -90,36 +90,42 @@
         </div>
 
         <!-- Result section -->
-        <div class="px-4 mt-20">
-            <div class="result-box rounded-[32px] py-3 flex flex-col gap-2">
-                <div class="flex items-center justify-between px-4">
-                    <div class="flex items-center gap-2 text-xs">
-                        <span class="text-[#797979]">@Lang.results</span>
-                        <span class="font-bold text-black">Monday, Mar 20, 2026</span>
+        @if (hasResult)
+        {
+            <div class="px-4 mt-20">
+                <div class="result-box rounded-[32px] py-3 flex flex-col gap-2">
+                    <div class="flex items-center justify-between px-4">
+                        <div class="flex items-center gap-2 text-xs">
+                            <span class="text-[#797979]">@Lang.results</span>
+                            <span class="font-bold text-black">@Utils.FormatResultDate(Model.lastResultDate)</span>
+                        </div>
+                        <a href="/Millions/Home/Results" class="flex items-center gap-1 text-[10px] font-bold text-black border border-[#c2c2c2] rounded-lg px-2 py-1">
+                            View all results
+                            <img src="/Millions/assets/icons/chevron-right.svg" alt="" class="w-[5px] h-2" />
+                        </a>
                     </div>
-                    <a href="/Millions/Home/Results" class="flex items-center gap-1 text-[10px] font-bold text-black border border-[#c2c2c2] rounded-lg px-2 py-1">
-                        View all results
-                        <img src="/Millions/assets/icons/chevron-right.svg" alt="" class="w-[5px] h-2"/>
-                    </a>
-                </div>
 
-                <!-- Result balls -->
-                <div class="flex items-center justify-between gap-1 px-4">
-                    <div class="ball ball-blue">7</div>
-                    <div class="ball ball-blue">16</div>
-                    <div class="ball ball-blue">32</div>
-                    <div class="ball ball-blue">35</div>
-                    <div class="ball ball-blue">40</div>
-                    <div class="relative">
-                        <img src="/Millions/assets/icons/crown.png" alt="" class="absolute -top-4 -right-1 w-7 h-auto pointer-events-none rotate-[15deg] z-0"/>
-                        <div class="ball ball-mb relative z-10">
-                            <span>12</span>
-                            <span class="absolute -bottom-1 -right-2 bg-[#ee0033] text-white text-[8px] font-bold px-1.5 py-0.5 rounded z-20">MB</span>
+                    <!-- Result balls -->
+                    <div class="flex items-center justify-between gap-1 px-4">
+                        @for (int i = 0; i < 5; i++)
+                        {
+                            <div class="ball ball-blue">@resultBalls[i]</div>
+                        }
+                        <div class="relative">
+                            <img src="/Millions/assets/icons/crown.png" alt="" class="absolute -top-4 -right-1 w-7 h-auto pointer-events-none rotate-[15deg] z-0" />
+                            <div class="ball ball-mb relative z-10">
+                                <span>@resultBalls[5]</span>
+                                <span class="absolute -bottom-1 -right-2 bg-[#ee0033] text-white text-[8px] font-bold px-1.5 py-0.5 rounded z-20">MB</span>
+                            </div>
                         </div>
                     </div>
                 </div>
             </div>
-        </div>
+        }
+        else
+        {
+            <div class="mt-20"></div>
+        }
 
         <!-- Mega Jackpot banner -->
         <div class="px-2 mt-6">
@@ -129,14 +135,14 @@
                 <span class="mega-glow" style="right:-107px; top:20px;"></span>
                 <p class="mega-title relative inline-block text-white text-[22px] font-futura leading-none">
                     <img src="/Millions/assets/icons/crown.png" alt="" class="absolute -top-[5px] left-[26px] w-[12px] h-auto rotate-[10deg] pointer-events-none"/>
-                    Mega Jackpot
+                    @Lang.millions_mega_jackpot
                 </p>
-                <p class="text-white text-xs mt-2">Estimate Jackpot Prize</p>
+                <p class="text-white text-xs mt-2">@Lang.millions_estimate_jackpot_prize</p>
                 <p class="leading-none mt-1 flex items-start" style="margin-bottom:18px;">
-                    <span class="mega-amount mega-jackpot-wiggle text-[40px] font-condensed text-gold-gradient tracking-tight leading-none">30.000.000</span>
+                    <span class="mega-amount mega-jackpot-wiggle text-[40px] font-condensed text-gold-gradient tracking-tight leading-none">@Utils.FormatMoney(Model.bolet ?? "30000000")</span>
                     <span class="mega-jackpot-wiggle text-gold-gradient text-sm font-bold uppercase ml-1">@Lang.v2_htg</span>
                 </p>
-                <p class="text-white text-[10px] mt-1 ">Be the next millionaire</p>
+                <p class="text-white text-[10px] mt-1 ">@Lang.millions_be_the_next_millionaire</p>
 
                 <!-- Decorative elements -->
                 <img src="/Millions/assets/images/crown-balls.png" alt="" class="absolute right-2 top-1/2 -translate-y-1/2 w-44 h-auto pointer-events-none"/>

+ 31 - 0
website/Common/Utils.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Globalization;
+using System.Linq;
+
+namespace LotteryWebApp.Common
+{
+    public static class Utils
+    {
+        public static string FormatMoney(string amount)
+        {
+            if (string.IsNullOrEmpty(amount)) return "0";
+            var clean = new string(amount.Where(c => char.IsDigit(c)).ToArray());
+            if (long.TryParse(clean, out long val))
+            {
+                return val.ToString("#,##0", new CultureInfo("vi-VN")).Replace(",", ".");
+            }
+            return amount;
+        }
+
+        public static string FormatResultDate(string dateStr)
+        {
+            if (string.IsNullOrEmpty(dateStr)) return "Monday, Mar 20, 2026";
+            DateTime dt;
+            if (DateTime.TryParseExact(dateStr, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
+            {
+                return dt.ToString("dddd, MMM dd, yyyy", new CultureInfo("en-US"));
+            }
+            return dateStr;
+        }
+    }
+}

+ 27 - 0
website/Languages/Lang.Designer.cs

@@ -1593,6 +1593,15 @@ namespace LotteryWebApp.Languages {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Be the next millionaire.
+        /// </summary>
+        public static string millions_be_the_next_millionaire {
+            get {
+                return ResourceManager.GetString("millions_be_the_next_millionaire", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Gwo  PITI .
         /// </summary>
@@ -1818,6 +1827,15 @@ namespace LotteryWebApp.Languages {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Estimate Jackpot Prize.
+        /// </summary>
+        public static string millions_estimate_jackpot_prize {
+            get {
+                return ResourceManager.GetString("millions_estimate_jackpot_prize", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Estimasyon pri tike.
         /// </summary>
@@ -2007,6 +2025,15 @@ namespace LotteryWebApp.Languages {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to Mega Jackpot.
+        /// </summary>
+        public static string millions_mega_jackpot {
+            get {
+                return ResourceManager.GetString("millions_mega_jackpot", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized string similar to Mega Millions.
         /// </summary>

+ 9 - 0
website/Languages/Lang.fr.resx

@@ -1834,4 +1834,13 @@ We’ll help you create an account in a few easy steps.</value>
   <data name="millions_redeem_rewards" xml:space="preserve">
     <value>Redeem Rewards</value>
   </data>
+  <data name="millions_mega_jackpot" xml:space="preserve">
+    <value>Mega Jackpot</value>
+  </data>
+  <data name="millions_estimate_jackpot_prize" xml:space="preserve">
+    <value>Estimate Jackpot Prize</value>
+  </data>
+  <data name="millions_be_the_next_millionaire" xml:space="preserve">
+    <value>Be the next millionaire</value>
+  </data>
 </root>

+ 9 - 0
website/Languages/Lang.resx

@@ -1835,4 +1835,13 @@ Apre yo fin tire 20 nimewo, sistem nan konte konbyen nimewo ki enpe oswa pe: &lt
   <data name="millions_redeem_rewards" xml:space="preserve">
     <value>Redeem Rewards</value>
   </data>
+  <data name="millions_mega_jackpot" xml:space="preserve">
+    <value>Mega Jackpot</value>
+  </data>
+  <data name="millions_estimate_jackpot_prize" xml:space="preserve">
+    <value>Estimate Jackpot Prize</value>
+  </data>
+  <data name="millions_be_the_next_millionaire" xml:space="preserve">
+    <value>Be the next millionaire</value>
+  </data>
 </root>

+ 4 - 0
website/Models/HomeViewModel.cs

@@ -15,6 +15,10 @@ namespace LotteryWebApp.Models
         public String topWinner { get; set; }
         public DateTime serverTime { get; set; }
         public double secondsUntilDraw { get; set; }
+        public string bolet { get; set; }
+        public string lastResult { get; set; }
+        public string lastResultDate { get; set; }
+        public string nextRoundDate { get; set; }
     }
 
     public class HomeTransfer_ViewModel