Selaa lähdekoodia

表达式数字转换修复

lcl 2 kuukautta sitten
vanhempi
commit
cabdd4d2ab
2 muutettua tiedostoa jossa 21 lisäystä ja 14 poistoa
  1. 3 3
      Program.cs
  2. 18 11
      Util/PrizeDo.cs

+ 3 - 3
Program.cs

@@ -122,7 +122,7 @@ app.MapControllers();
 
 
 app.Urls.Add("http://*:5802");
 app.Urls.Add("http://*:5802");
 
 
-// PrizeDo.sendPrize("QUEUE_KXS_MACHINE_PRIZE_CONFIG_DIVISION", "{\"brand_id\":12,\"pos_sn\":\"00005702880110007899\",\"user_id\":264342}");
+// PrizeDo.sendPrize("QUEUE_KXS_MACHINE_PRIZE_CONFIG_DIVISION", "{\"brand_id\":12,\"pos_sn\":\"00005702880110007897\",\"user_id\":264331}");
 // PrizeDo.sendPrize("QUEUE_KXS_WIFI_PRIZE_CONFIG_DIVISION", "{\"brand_id\":23,\"pos_sn\":\"1453360007\",\"trade_amt\":199.00,\"user_id\":264331}");
 // PrizeDo.sendPrize("QUEUE_KXS_WIFI_PRIZE_CONFIG_DIVISION", "{\"brand_id\":23,\"pos_sn\":\"1453360007\",\"trade_amt\":199.00,\"user_id\":264331}");
 // PrizeDo.sendPrize(4, "{\"PosSn\":\"CS00000000015859\"}");
 // PrizeDo.sendPrize(4, "{\"PosSn\":\"CS00000000015859\"}");
 // PrizeDo.sendPrize("QUEUE_KXS_HAODA_PRIZE_CONFIG_DIVISION", "{\"brand_id\":19,\"pos_sn\":\"00000102249QCQF02551\",\"user_id\":192332}");
 // PrizeDo.sendPrize("QUEUE_KXS_HAODA_PRIZE_CONFIG_DIVISION", "{\"brand_id\":19,\"pos_sn\":\"00000102249QCQF02551\",\"user_id\":192332}");
@@ -130,9 +130,9 @@ app.Urls.Add("http://*:5802");
 // PrizeDo.sendPrize("QUEUE_KXS_PRIZE_MALL_CONFIG_DIVISION", "{\"order_id\":602804,\"user_id\":264331}");
 // PrizeDo.sendPrize("QUEUE_KXS_PRIZE_MALL_CONFIG_DIVISION", "{\"order_id\":602804,\"user_id\":264331}");
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817330511847441249\"}");
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817330511847441249\"}");
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817360962275551251\"}");
 // PrizeDo.sendPrize(7, "{\"OrderNo\":\"BM2024090817360962275551251\"}");
-// PrizeDo.sendPrize("KXS_LEADER_STA_PRIZE", "{\"month\":\"202411\"}");
+// PrizeDo.sendPrize("KXS_LEADER_STA_PRIZE", "{\"month\":\"202412\"}");
 
 
-RabbitMQClient.Instance.Start();
+// RabbitMQClient.Instance.Start();
 
 
 // CopyProject.Copy(5, 7);
 // CopyProject.Copy(5, 7);
 
 

+ 18 - 11
Util/PrizeDo.cs

@@ -204,6 +204,7 @@ namespace Util
                         string fieldQueryKind = queryField.fieldQueryKind;
                         string fieldQueryKind = queryField.fieldQueryKind;
                         string fieldQueryModel = queryField.fieldQueryModel;
                         string fieldQueryModel = queryField.fieldQueryModel;
                         string fieldQueryValue = queryField.fieldQueryValue;
                         string fieldQueryValue = queryField.fieldQueryValue;
+                        if(fieldQueryValue.Contains("${")) fieldQueryValue = GetDbExpressionVal(fieldQueryValue, projectId, content, dic, startData);
                         fieldQueryValue = MatchExpressionVal(fieldQueryValue);
                         fieldQueryValue = MatchExpressionVal(fieldQueryValue);
                         string fieldQueryValueType = queryField.fieldQueryValueType;
                         string fieldQueryValueType = queryField.fieldQueryValueType;
                         if(fieldQueryKind == "1") //模糊匹配
                         if(fieldQueryKind == "1") //模糊匹配
@@ -351,7 +352,7 @@ namespace Util
                         }
                         }
                         else if(fieldQueryKind == "3") //范围匹配
                         else if(fieldQueryKind == "3") //范围匹配
                         {
                         {
-                            string[] val = fieldQueryValue.Split(':');
+                            string[] val = RangeSplit(fieldQueryValue);
                             if(fieldQueryModel == "request_param")
                             if(fieldQueryModel == "request_param")
                             {
                             {
                                 Dictionary<string, string> req = getRequestParams(projectId, content);
                                 Dictionary<string, string> req = getRequestParams(projectId, content);
@@ -697,7 +698,7 @@ namespace Util
                             }
                             }
                             else if(fieldQueryKind == "3") //范围匹配
                             else if(fieldQueryKind == "3") //范围匹配
                             {
                             {
-                                string[] val = fieldQueryValue.Split(':');
+                                string[] val = RangeSplit(fieldQueryValue);
                                 if(fieldQueryModel == "request_param")
                                 if(fieldQueryModel == "request_param")
                                 {
                                 {
                                     Dictionary<string, string> req = getRequestParams(projectId, content);
                                     Dictionary<string, string> req = getRequestParams(projectId, content);
@@ -792,7 +793,8 @@ namespace Util
                 }
                 }
                 else
                 else
                 {
                 {
-                    sql = queryTable.customSql;
+                    sql = queryTable.customSql + " limit " + skip + "," + size;
+                    sql = MatchExpressionVal(sql);
                 }
                 }
 
 
                 var db = initDb(queryTable.databaseId);
                 var db = initDb(queryTable.databaseId);
@@ -939,7 +941,7 @@ namespace Util
                 }
                 }
                 else if(fieldQueryKind == "3") //范围匹配
                 else if(fieldQueryKind == "3") //范围匹配
                 {
                 {
-                    string[] val = fieldQueryValue.Split(':');
+                    string[] val = RangeSplit(fieldQueryValue);
                     if(fieldQueryModel == "request_param")
                     if(fieldQueryModel == "request_param")
                     {
                     {
                         Dictionary<string, string> req = getRequestParams(projectId, content);
                         Dictionary<string, string> req = getRequestParams(projectId, content);
@@ -1201,7 +1203,7 @@ namespace Util
                                                 {
                                                 {
                                                     string val = GetQueryTableData(condiDic, returnField);
                                                     string val = GetQueryTableData(condiDic, returnField);
                                                     if(val == returnField) val = "0";
                                                     if(val == returnField) val = "0";
-                                                    expresssion = expresssion.Replace(returnField, Function.CheckInt(val));
+                                                    expresssion = expresssion.Replace(returnField, Function.CheckNum(val));
 
 
                                                     string title = GetQueryTableTitle(condiDic, returnField);
                                                     string title = GetQueryTableTitle(condiDic, returnField);
                                                     checkTitle = checkTitle.Replace(returnField, title);
                                                     checkTitle = checkTitle.Replace(returnField, title);
@@ -1265,7 +1267,7 @@ namespace Util
                                             }
                                             }
                                             else if(fieldQueryKind == "3") //范围匹配
                                             else if(fieldQueryKind == "3") //范围匹配
                                             {
                                             {
-                                                string[] val = checkVal.Split(':');
+                                                string[] val = RangeSplit(checkVal);
                                                 string valLeft = val[0];
                                                 string valLeft = val[0];
                                                 string valRight = val[1];
                                                 string valRight = val[1];
                                                 if(fieldQueryModel == "request_param")
                                                 if(fieldQueryModel == "request_param")
@@ -1613,7 +1615,7 @@ namespace Util
                         foreach(string returnField in returnFields)
                         foreach(string returnField in returnFields)
                         {
                         {
                             string val = GetQueryTableData(condiDic, returnField);
                             string val = GetQueryTableData(condiDic, returnField);
-                            expresssion = expresssion.Replace(returnField, Function.CheckInt(val));
+                            expresssion = expresssion.Replace(returnField, Function.CheckNum(val));
 
 
                             string title = GetQueryTableTitle(condiDic, returnField);
                             string title = GetQueryTableTitle(condiDic, returnField);
                             checkTitle = checkTitle.Replace(returnField, title);
                             checkTitle = checkTitle.Replace(returnField, title);
@@ -1684,7 +1686,7 @@ namespace Util
                     }
                     }
                     else if(fieldQueryKind == "3") //范围匹配
                     else if(fieldQueryKind == "3") //范围匹配
                     {
                     {
-                        string[] val = checkVal.Split(':');
+                        string[] val = RangeSplit(checkVal);
                         string valLeft = val[0];
                         string valLeft = val[0];
                         string valRight = val[1];
                         string valRight = val[1];
                         if(fieldQueryModel == "request_param")
                         if(fieldQueryModel == "request_param")
@@ -2324,7 +2326,7 @@ namespace Util
                     }
                     }
                     else if(fieldQueryKind == "3") //范围匹配
                     else if(fieldQueryKind == "3") //范围匹配
                     {
                     {
-                        string[] val = fieldQueryValue.Split(':');
+                        string[] val = RangeSplit(fieldQueryValue);
                         if(fieldQueryModel == "request_param")
                         if(fieldQueryModel == "request_param")
                         {
                         {
                             Dictionary<string, string> req = getRequestParams(projectId, content);
                             Dictionary<string, string> req = getRequestParams(projectId, content);
@@ -2670,7 +2672,7 @@ namespace Util
                     }
                     }
                     else if(fieldQueryKind == "3") //范围匹配
                     else if(fieldQueryKind == "3") //范围匹配
                     {
                     {
-                        string[] val = fieldQueryValue.Split(':');
+                        string[] val = RangeSplit(fieldQueryValue);
                         if(fieldQueryModel == "request_param")
                         if(fieldQueryModel == "request_param")
                         {
                         {
                             Dictionary<string, string> req = getRequestParams(projectId, content);
                             Dictionary<string, string> req = getRequestParams(projectId, content);
@@ -2885,7 +2887,7 @@ namespace Util
                     if(condiDic.Any(m => m.FieldEnName == returnField))
                     if(condiDic.Any(m => m.FieldEnName == returnField))
                     {
                     {
                         string val = GetQueryTableData(condiDic, returnField);
                         string val = GetQueryTableData(condiDic, returnField);
-                        expresssion = expresssion.Replace(returnField, Function.CheckInt(val));
+                        expresssion = expresssion.Replace(returnField, Function.CheckNum(val));
                     }
                     }
                 }
                 }
                 DataTable dt = new();
                 DataTable dt = new();
@@ -3039,5 +3041,10 @@ namespace Util
             return "1900-01-01";
             return "1900-01-01";
         }
         }
     
     
+        public static string[] RangeSplit(string str)
+        {
+            if(str.Contains(" - ")) return str.Split(" - ", StringSplitOptions.None);
+            return str.Split(':');
+        }
     }
     }
 }
 }