Browse Source

测试修改

lcl 6 months ago
parent
commit
84059b3589
3 changed files with 77 additions and 7 deletions
  1. 2 2
      Model/Base/PagerInfo.cs
  2. 6 1
      Program.cs
  3. 69 4
      Util/PrizeDo.cs

+ 2 - 2
Model/Base/PagerInfo.cs

@@ -25,10 +25,10 @@
         public PagerInfo()
         {
             pageNum = 1;
-            pageSize = 30;
+            pageSize = 100;
         }
 
-        public PagerInfo(int page = 1, int pageSize = 30)
+        public PagerInfo(int page = 1, int pageSize = 100)
         {
             pageNum = page;
             pageSize = pageSize;

+ 6 - 1
Program.cs

@@ -119,6 +119,11 @@ app.MapControllerRoute(
 
 app.MapControllers();
 
-// PrizeDo.sendPrize("{\"PosSn\":\"00005702880118401866\",\"MerNo\":\"039150908119495\"}");
+// PrizeDo.sendPrize(1, "{\"PosSn\":\"00005702880118401866\"}");
+// PrizeDo.sendPrize(1, "{\"PosSn\":\"00003102722406215502730\"}");
+// PrizeDo.sendPrize(4, "{\"PosSn\":\"89861500232320207957\"}");
+// PrizeDo.sendPrize(5, "{\"PosSn\":\"00000302T1NL90664172\"}");
+// PrizeDo.sendPrize(6, "{\"PosSn\":\"1152131239\"}");
+// PrizeDo.sendPrize(3, "{\"OrderNo\":\"BM2024090922074280346374786\"}");
 
 app.Run();

+ 69 - 4
Util/PrizeDo.cs

@@ -573,7 +573,8 @@ namespace Util
                                         string[] returnFieldIdList = returnFieldId.Split(',');
                                         foreach(string subField in returnFieldIdList)
                                         {
-                                            checkObj += condiDic.ContainsKey(subField) + ",";
+                                            string val = condiDic.ContainsKey(subField) ? condiDic[subField].ToString() : "0";
+                                            checkObj += val + ",";
                                         }
                                         checkObj = checkObj.TrimEnd(',');
                                     }
@@ -679,11 +680,44 @@ namespace Util
                                             if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1;
                                         }
                                     }
+                                    else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
+                                    {
+                                        string val = ",";
+                                        string[] valList = checkVal.Split(',');
+                                        if(fieldQueryModel == "request_param")
+                                        {
+                                            Dictionary<string, string> req = getRequestParams(projectId, content);
+                                            foreach(string subVal in valList)
+                                            {
+                                                val += req[subVal] + ",";
+                                            }
+                                        }
+                                        else if(fieldQueryModel == "fixed_value")
+                                        {
+                                            foreach(string subVal in valList)
+                                            {
+                                                val += GetExpressionVal(subVal) + ",";
+                                            }
+                                        }
+                                        else if(fieldQueryModel == "db_field")
+                                        {
+                                            foreach(string subVal in valList)
+                                            {
+                                                val += GetDbExpressionVal(subVal) + ",";
+                                            }
+                                        }
+                                        if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
+                                        if(fieldQueryKind == "6" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
+                                    }
                                 }
                                 if(loopSet.conditionMode == "all" && passCount == allCount) prizeFlag = true;
                                 else if(loopSet.conditionMode == "one" && passCount == 1) prizeFlag = true;
                                 else prizeFlag = false;
                             }
+                            else
+                            {
+                                prizeFlag = false;
+                            }
                             if(prizeFlag)
                             {
                                 prizeSendDo(projectId, sub, objId, content);
@@ -699,6 +733,7 @@ namespace Util
                 }
                 else
                 {
+
                     prizeSendDo(projectId, sub, prizeObjectId, content);
                 }
             }
@@ -818,9 +853,38 @@ namespace Util
                         if(checkObj.ToString() != GetExpressionVal(checkVal)) passCount += 1;
                     }
                 }
+                else if(fieldQueryKind == "5" || fieldQueryKind == "6") //数组匹配/排除
+                {
+                    string val = ",";
+                    string[] valList = checkVal.Split(',');
+                    if(fieldQueryModel == "request_param")
+                    {
+                        Dictionary<string, string> req = getRequestParams(projectId, content);
+                        foreach(string subVal in valList)
+                        {
+                            val += req[subVal] + ",";
+                        }
+                    }
+                    else if(fieldQueryModel == "fixed_value")
+                    {
+                        foreach(string subVal in valList)
+                        {
+                            val += GetExpressionVal(subVal) + ",";
+                        }
+                    }
+                    else if(fieldQueryModel == "db_field")
+                    {
+                        foreach(string subVal in valList)
+                        {
+                            val += GetDbExpressionVal(subVal) + ",";
+                        }
+                    }
+                    if(fieldQueryKind == "5" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
+                    if(fieldQueryKind == "6" && val.Contains("," + checkObj.ToString() + ",")) passCount += 1;
+                }
             }
             bool op = false;
-            if(conditionMode == "all" && passCount == allCount) op = true;
+            if(conditionMode == "all" && passCount == allCount && passCount > 0) op = true;
             else if(conditionMode == "one" && passCount == 1) op = true;
             if(op) //满足条件
             {
@@ -836,7 +900,8 @@ namespace Util
                     string[] prizeSourceFieldList = prizeSourceField.Split(',');
                     foreach(string subField in prizeSourceFieldList)
                     {
-                        prizeSourceData += condiDic.ContainsKey(subField) + ",";
+                        string val = condiDic.ContainsKey(subField) ? condiDic[subField].ToString() : "0";
+                        prizeSourceData += val + ",";
                     }
                     prizeSourceData = prizeSourceData.TrimEnd(',');
                 }
@@ -1114,7 +1179,7 @@ namespace Util
                 {
                     foreach(System.Data.DataColumn item in items.Columns)
                     {
-                        dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
+                        if(!dic.ContainsKey(item.ColumnName)) dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
                     }
                 }
             }