Procházet zdrojové kódy

几个比较大的表,主键改成long类型

dodo hold před 2 roky
rodič
revize
0eb92309d0

+ 8 - 0
molilian.api/Controllers/public/TkController.cs

@@ -79,6 +79,10 @@ namespace molilian.api.Controllers
             var channel = form.Read("c", string.Empty);
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
+#if DEBUG
+            ip = "127.0.0.1";
+            oaid = "test-oaid";
+#endif
             return await UnionParseCore.UnionParseAsync(content, channel, ip, oaid);
         }
 
@@ -125,6 +129,10 @@ namespace molilian.api.Controllers
             var channel = form.Read("c", string.Empty);
             var ip = form.Read("ip", string.Empty);
             var oaid = form.Read("oaid", string.Empty);
+#if DEBUG
+            ip = "127.0.0.1";
+            oaid = "test-oaid";
+#endif
             return await UnionCouponCore.UnionCouponAsync(content, channel, ip, oaid);
         }
 

+ 1 - 1
molilian.api/Properties/launchSettings.json

@@ -6,7 +6,7 @@
       "launchUrl": "swagger",
       "environmentVariables": {
         "ASPNETCORE_ENVIRONMENT": "Development",
-        "EndPoint": "bj",
+        "EndPoint": "gz",
         "NtfyServer": "https://ntfy.yunhui800.com/5Sq9BytXXM5WDY3G",
         "ANPush": "",
         "DBType": "MySQL",

+ 21 - 1
molilian.core/Core/ProxyNodesCore.cs

@@ -10,19 +10,30 @@ using Spire.Pdf.Exporting.XPS.Schema;
 using System.Xml.Linq;
 using System.Net;
 using TencentCloud.Mrs.V20200910.Models;
+using static molilian.core.TkPoolCore;
 
 
 namespace molilian.core
 {
     public partial class ProxyNodesCore
     {
+
+
+        private static string _end_point;
+        static ProxyNodesCore()
+        {
+            _end_point = Environment.GetEnvironmentVariable("EndPoint");
+        }
+
+
         private static readonly object _lockObj = new();
         private static IEnumerable<ProxyNodesDTO> _cached;
         public static WebProxy? GetOne(string node)
         {
             var list = List();
             if (!list.Any()) return null;
-            var ProxyNodesDTO = list.Where(s => s.name == node).FirstOrDefault();
+            //var ProxyNodesDTO = list.Where(s => s.name == node).FirstOrDefault();
+            var ProxyNodesDTO = list.Where(e => SelectEndPointUseProxy(e, node)).OrderBy(l => Guid.NewGuid()).FirstOrDefault();
             if (ProxyNodesDTO == null) return null;
 
             return new WebProxy
@@ -31,6 +42,15 @@ namespace molilian.core
                 Credentials = new NetworkCredential(ProxyNodesDTO.username, ProxyNodesDTO.password)
             };
         }
+
+        private static bool SelectEndPointUseProxy(ProxyNodesDTO item, string node)
+        {
+            if (!string.IsNullOrEmpty(_end_point) && !string.IsNullOrEmpty(item.end_point))
+            {
+                if (item.end_point != _end_point) return false;
+            }
+            return item.name == node;
+        }
         public static IEnumerable<ProxyNodesDTO> List(bool force = false)
         {
             if (!force && _cached != null) return _cached;

+ 1 - 1
molilian.core/DTO/ProxyNodesDTO.cs

@@ -9,7 +9,7 @@ namespace molilian.core
         public bool status { get; set; }
         public string name { get; set; } = string.Empty;
         public string description { get; set; } = string.Empty;
-
+        public string end_point { get; set; } = string.Empty;
 
         public string type { get; set; } = string.Empty;
         public string server { get; set; } = string.Empty;

+ 1 - 1
molilian.core/DTO/UnionCouponDTO.cs

@@ -7,7 +7,7 @@ namespace molilian.core
     public class UnionCouponDTO
     {
         [Key]
-        public int id { get; set; }
+        public long id { get; set; }
         public TkChannelEnum channel { get; set; }
         public int accountId { get; set; } = 0;
         public string accountName { get; set; } = string.Empty;

+ 1 - 1
molilian.core/DTO/alimama/TkDataDTO.cs

@@ -5,7 +5,7 @@ namespace molilian.core
     public class TkDataDTO
     {
         [Key]
-        public int id { get; set; }
+        public long id { get; set; }
         public TkChannelEnum channel { get; set; }
         public LinkTypeEnum link_type { get; set; }
         public ChannelTypeEnum channel_type { get; set; } = ChannelTypeEnum.none;