|
@@ -15,7 +15,7 @@ namespace Util
|
|
public static void sendPrize(string content)
|
|
public static void sendPrize(string content)
|
|
{
|
|
{
|
|
batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + Function.get_Random(3);
|
|
batchNo = DateTime.Now.ToString("yyyyMMddHHmmssfff") + Function.get_Random(3);
|
|
- int projectId = 1;
|
|
|
|
|
|
+ int projectId = 5;
|
|
string priObjString = prizeObject(projectId, content);
|
|
string priObjString = prizeObject(projectId, content);
|
|
if(!string.IsNullOrEmpty(priObjString))
|
|
if(!string.IsNullOrEmpty(priObjString))
|
|
{
|
|
{
|
|
@@ -28,12 +28,12 @@ namespace Util
|
|
|
|
|
|
|
|
|
|
//接收入参
|
|
//接收入参
|
|
- public static Dictionary<string, string> getRequestParams(string content)
|
|
|
|
|
|
+ public static Dictionary<string, string> getRequestParams(int projectId, string content)
|
|
{
|
|
{
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
JsonData jsonData = JsonMapper.ToObject(content);
|
|
JsonData jsonData = JsonMapper.ToObject(content);
|
|
var paramService = App.GetService<IPriProjectParamService>();
|
|
var paramService = App.GetService<IPriProjectParamService>();
|
|
- var paramList = paramService.GetList(m => m.projectId == 1);
|
|
|
|
|
|
+ var paramList = paramService.GetList(m => m.projectId == projectId);
|
|
foreach(var param in paramList)
|
|
foreach(var param in paramList)
|
|
{
|
|
{
|
|
dic.Add(param.fieldEnName, jsonData[param.fieldEnName].ToString());
|
|
dic.Add(param.fieldEnName, jsonData[param.fieldEnName].ToString());
|
|
@@ -45,7 +45,7 @@ namespace Util
|
|
public static SqlSugarClient initDb(int projectId)
|
|
public static SqlSugarClient initDb(int projectId)
|
|
{
|
|
{
|
|
var databaseSetService = App.GetService<IPriDatabaseSetService>();
|
|
var databaseSetService = App.GetService<IPriDatabaseSetService>();
|
|
- var connectionString = databaseSetService.GetFirst(m => m.projectId == 1);
|
|
|
|
|
|
+ var connectionString = databaseSetService.GetFirst(m => m.projectId == projectId);
|
|
string server = connectionString.ipAddress;
|
|
string server = connectionString.ipAddress;
|
|
int port = connectionString.port;
|
|
int port = connectionString.port;
|
|
string user = connectionString.userId;
|
|
string user = connectionString.userId;
|
|
@@ -76,7 +76,7 @@ namespace Util
|
|
var returnFields = returnFieldService.GetList(m => m.queryTableId == queryTable.id);
|
|
var returnFields = returnFieldService.GetList(m => m.queryTableId == queryTable.id);
|
|
foreach(var returnField in returnFields)
|
|
foreach(var returnField in returnFields)
|
|
{
|
|
{
|
|
- fields += returnField.fieldEnName + ",";
|
|
|
|
|
|
+ fields += returnField.fieldEnName + " " + queryTable.tableEnName + "_" + returnField.fieldEnName + ",";
|
|
}
|
|
}
|
|
fields = fields.TrimEnd(',');
|
|
fields = fields.TrimEnd(',');
|
|
|
|
|
|
@@ -95,7 +95,7 @@ namespace Util
|
|
condi += " and " + fieldEnName + " like ";
|
|
condi += " and " + fieldEnName + " like ";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -105,29 +105,33 @@ namespace Util
|
|
}
|
|
}
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
{
|
|
{
|
|
- condi += " and " + fieldEnName + "=";
|
|
|
|
- string val = "";
|
|
|
|
- if(fieldQueryModel == "request_param")
|
|
|
|
- {
|
|
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
- val = req[fieldQueryValue];
|
|
|
|
- }
|
|
|
|
- else if(fieldQueryModel == "fixed_value")
|
|
|
|
- {
|
|
|
|
- val = GetExpressionVal(fieldQueryValue);
|
|
|
|
- }
|
|
|
|
- if(fieldQueryValueType == "text")
|
|
|
|
|
|
+ if(fieldQueryValue == "null" && fieldQueryValueType == "text") condi += " and " + fieldEnName + " is null";
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- val = "'" + val + "'";
|
|
|
|
|
|
+ condi += " and " + fieldEnName + "=";
|
|
|
|
+ string val = "";
|
|
|
|
+ if(fieldQueryModel == "request_param")
|
|
|
|
+ {
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
|
+ val = req[fieldQueryValue];
|
|
|
|
+ }
|
|
|
|
+ else if(fieldQueryModel == "fixed_value")
|
|
|
|
+ {
|
|
|
|
+ val = GetExpressionVal(fieldQueryValue);
|
|
|
|
+ }
|
|
|
|
+ if(fieldQueryValueType == "text")
|
|
|
|
+ {
|
|
|
|
+ val = "'" + val + "'";
|
|
|
|
+ }
|
|
|
|
+ condi += val;
|
|
}
|
|
}
|
|
- condi += val;
|
|
|
|
}
|
|
}
|
|
else if(fieldQueryKind == "3") //范围匹配
|
|
else if(fieldQueryKind == "3") //范围匹配
|
|
{
|
|
{
|
|
string[] val = fieldQueryValue.Split(':');
|
|
string[] val = fieldQueryValue.Split(':');
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
@@ -155,28 +159,39 @@ namespace Util
|
|
}
|
|
}
|
|
else if(fieldQueryKind == "4") //取反匹配
|
|
else if(fieldQueryKind == "4") //取反匹配
|
|
{
|
|
{
|
|
- condi += " and " + fieldEnName + "!=";
|
|
|
|
- string val = "";
|
|
|
|
- if(fieldQueryModel == "request_param")
|
|
|
|
- {
|
|
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
- val = req[fieldQueryValue];
|
|
|
|
- }
|
|
|
|
- else if(fieldQueryModel == "fixed_value")
|
|
|
|
- {
|
|
|
|
- val = GetExpressionVal(fieldQueryValue);
|
|
|
|
- }
|
|
|
|
- if(fieldQueryValueType == "text")
|
|
|
|
|
|
+ if(fieldQueryValue == "null" && fieldQueryValueType == "text") condi += " and " + fieldEnName + " is not null";
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- val = "'" + val + "'";
|
|
|
|
|
|
+ condi += " and " + fieldEnName + "!=";
|
|
|
|
+ string val = "";
|
|
|
|
+ if(fieldQueryModel == "request_param")
|
|
|
|
+ {
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
|
|
+ val = req[fieldQueryValue];
|
|
|
|
+ }
|
|
|
|
+ else if(fieldQueryModel == "fixed_value")
|
|
|
|
+ {
|
|
|
|
+ val = GetExpressionVal(fieldQueryValue);
|
|
|
|
+ }
|
|
|
|
+ if(fieldQueryValueType == "text")
|
|
|
|
+ {
|
|
|
|
+ val = "'" + val + "'";
|
|
|
|
+ }
|
|
|
|
+ condi += val;
|
|
}
|
|
}
|
|
- condi += val;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
var db = initDb(projectId);
|
|
var db = initDb(projectId);
|
|
- var item = db.SqlQueryable<Dictionary<string, object>>("select " + fields + " " + queryTable.tableEnName + "-" + fields + " from " + queryTable.tableEnName + " where 1=1" + condi).First();
|
|
|
|
- dic.AddRange(item);
|
|
|
|
|
|
+ string sql = "select " + fields + " from " + queryTable.tableEnName + " where 1=1" + condi;
|
|
|
|
+ var items = db.Ado.GetDataTable(sql);
|
|
|
|
+ if(items.Rows.Count > 0)
|
|
|
|
+ {
|
|
|
|
+ foreach(System.Data.DataColumn item in items.Columns)
|
|
|
|
+ {
|
|
|
|
+ dic.Add(item.ColumnName, items.Rows[0][item.ColumnName].ToString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return dic;
|
|
return dic;
|
|
}
|
|
}
|
|
@@ -207,7 +222,7 @@ namespace Util
|
|
condi += " and " + fieldEnName + " like ";
|
|
condi += " and " + fieldEnName + " like ";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -221,7 +236,7 @@ namespace Util
|
|
string val = "";
|
|
string val = "";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -239,7 +254,7 @@ namespace Util
|
|
string[] val = fieldQueryValue.Split(':');
|
|
string[] val = fieldQueryValue.Split(':');
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
@@ -271,7 +286,7 @@ namespace Util
|
|
string val = "";
|
|
string val = "";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -287,10 +302,10 @@ namespace Util
|
|
}
|
|
}
|
|
|
|
|
|
var db = initDb(projectId);
|
|
var db = initDb(projectId);
|
|
- var item = db.SqlQueryable<Dictionary<string, object>>("select " + field + " from " + prizeObjectTable.tableEnName + " where 1=1" + condi).First();
|
|
|
|
|
|
+ var item = db.Ado.GetScalar("select " + field + " from " + prizeObjectTable.tableEnName + " where 1=1" + condi);
|
|
if(item != null)
|
|
if(item != null)
|
|
{
|
|
{
|
|
- return item[field].ToString() + "|" + prizeObjectTable.prizeListIds;
|
|
|
|
|
|
+ return item.ToString() + "|" + prizeObjectTable.prizeListIds;
|
|
}
|
|
}
|
|
return "";
|
|
return "";
|
|
}
|
|
}
|
|
@@ -319,18 +334,21 @@ namespace Util
|
|
var tableEnName = loopSet.tableEnName; //递归查询表
|
|
var tableEnName = loopSet.tableEnName; //递归查询表
|
|
var parentField = loopSet.parentField; //父字段
|
|
var parentField = loopSet.parentField; //父字段
|
|
var sonField = loopSet.sonField; //子字段
|
|
var sonField = loopSet.sonField; //子字段
|
|
|
|
+ var afterPrizeFlag = loopSet.afterPrizeFlag; //发奖后是否继续
|
|
var db = initDb(projectId);
|
|
var db = initDb(projectId);
|
|
string objId = prizeObjectId;
|
|
string objId = prizeObjectId;
|
|
- while(!string.IsNullOrEmpty(objId) && objId != "0")
|
|
|
|
|
|
+ bool op = true;
|
|
|
|
+ while(!string.IsNullOrEmpty(objId) && objId != "0" && op)
|
|
{
|
|
{
|
|
- if(loopCondition(projectId, objId, content))
|
|
|
|
|
|
+ if(loopCondition(projectId, sub, objId, content))
|
|
{
|
|
{
|
|
prizeSendDo(projectId, sub, objId, content);
|
|
prizeSendDo(projectId, sub, objId, content);
|
|
|
|
+ op = afterPrizeFlag;
|
|
}
|
|
}
|
|
- var parent = db.SqlQueryable<Dictionary<string, object>>("select " + parentField + " from " + tableEnName + " where " + sonField + "=" + objId).First();
|
|
|
|
|
|
+ var parent = db.Ado.GetScalar("select " + parentField + " from " + tableEnName + " where " + sonField + "=" + objId);
|
|
if(parent != null)
|
|
if(parent != null)
|
|
{
|
|
{
|
|
- objId = parent[parentField].ToString();
|
|
|
|
|
|
+ objId = parent.ToString();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -370,7 +388,7 @@ namespace Util
|
|
|
|
|
|
var returnField = returnFieldService.GetFirst(m => m.id == returnFieldId);
|
|
var returnField = returnFieldService.GetFirst(m => m.id == returnFieldId);
|
|
var queryTable = queryTableService.GetFirst(m => m.id == returnField.queryTableId);
|
|
var queryTable = queryTableService.GetFirst(m => m.id == returnField.queryTableId);
|
|
- var checkObj = condiDic[queryTable.tableEnName + "-" + returnField.fieldEnName];
|
|
|
|
|
|
+ var checkObj = condiDic.ContainsKey(queryTable.tableEnName + "_" + returnField.fieldEnName) ? condiDic[queryTable.tableEnName + "_" + returnField.fieldEnName] : "0";
|
|
var checkVal = fieldQueryValue;
|
|
var checkVal = fieldQueryValue;
|
|
|
|
|
|
if(fieldQueryKind == "1") //模糊匹配
|
|
if(fieldQueryKind == "1") //模糊匹配
|
|
@@ -384,11 +402,11 @@ namespace Util
|
|
{
|
|
{
|
|
if(fieldQueryValueType == "int")
|
|
if(fieldQueryValueType == "int")
|
|
{
|
|
{
|
|
- if((int)checkObj == int.Parse(Function.CheckInt(checkVal))) passCount += 1;
|
|
|
|
|
|
+ if(int.Parse(Function.CheckInt(checkObj.ToString())) == int.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
}
|
|
}
|
|
else if(fieldQueryValueType == "number")
|
|
else if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
- if((decimal)checkObj == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
|
|
|
|
+ if(decimal.Parse(Function.CheckNum(checkObj.ToString())) == decimal.Parse(Function.CheckNum(checkVal))) passCount += 1;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -400,7 +418,7 @@ namespace Util
|
|
string[] val = checkVal.Split(':');
|
|
string[] val = checkVal.Split(':');
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(req[val[0]])) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
if(!string.IsNullOrEmpty(req[val[0]]) && !string.IsNullOrEmpty(req[val[1]]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(req[val[0]])) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(req[val[1]]))) passCount += 1;
|
|
@@ -424,15 +442,15 @@ namespace Util
|
|
{
|
|
{
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(val[0])) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (decimal)checkObj <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (decimal)checkObj >= decimal.Parse(Function.CheckNum(val[0])) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) >= decimal.Parse(Function.CheckNum(val[0]))) passCount += 1;
|
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && decimal.Parse(Function.CheckNum(checkObj.ToString())) <= decimal.Parse(Function.CheckNum(val[1]))) passCount += 1;
|
|
}
|
|
}
|
|
else if(fieldQueryValueType == "int")
|
|
else if(fieldQueryValueType == "int")
|
|
{
|
|
{
|
|
- if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (int)checkObj >= int.Parse(Function.CheckInt(val[0])) && (int)checkObj <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
|
- else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && (int)checkObj >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
|
- else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (int)checkObj <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
|
|
|
+ if(!string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && (int)checkObj >= int.Parse(Function.CheckInt(val[0])) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
|
|
+ else if(!string.IsNullOrEmpty(val[0]) && string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) >= int.Parse(Function.CheckInt(val[0]))) passCount += 1;
|
|
|
|
+ else if(string.IsNullOrEmpty(val[0]) && !string.IsNullOrEmpty(val[1]) && int.Parse(Function.CheckInt(checkObj.ToString())) <= int.Parse(Function.CheckInt(val[1]))) passCount += 1;
|
|
}
|
|
}
|
|
else if(fieldQueryValueType.StartsWith("date"))
|
|
else if(fieldQueryValueType.StartsWith("date"))
|
|
{
|
|
{
|
|
@@ -463,7 +481,18 @@ namespace Util
|
|
else if(conditionMode == "one" && passCount == 1) op = true;
|
|
else if(conditionMode == "one" && passCount == 1) op = true;
|
|
if(op) //满足条件
|
|
if(op) //满足条件
|
|
{
|
|
{
|
|
- string prizeSourceData = condiDic[prizeSourceField].ToString();
|
|
|
|
|
|
+ decimal number = 0;
|
|
|
|
+ if(prizeSourceField.Contains("/"))
|
|
|
|
+ {
|
|
|
|
+ number = decimal.Parse(prizeSourceField.Split('/')[1]);
|
|
|
|
+ prizeSourceField = prizeSourceField.Split('/')[0];
|
|
|
|
+ }
|
|
|
|
+ string prizeSourceData = condiDic.ContainsKey(prizeSourceField) ? condiDic[prizeSourceField].ToString() : "0";
|
|
|
|
+ if(prizeSourceField.Contains("/") && number > 0)
|
|
|
|
+ {
|
|
|
|
+ decimal prizeSourceDataNum = decimal.Parse(prizeSourceData) / number;
|
|
|
|
+ prizeSourceData = prizeSourceDataNum.ToString("f2");
|
|
|
|
+ }
|
|
decimal prizeAmt = 0;
|
|
decimal prizeAmt = 0;
|
|
var amountSet = amountSetService.GetFirst(m => m.listId == sub.id && m.prizeSourceField == prizeSourceData);
|
|
var amountSet = amountSetService.GetFirst(m => m.listId == sub.id && m.prizeSourceField == prizeSourceData);
|
|
if(amountSet != null)
|
|
if(amountSet != null)
|
|
@@ -475,7 +504,7 @@ namespace Util
|
|
if(prizeAmount > 0) prizeAmt += prizeAmount;
|
|
if(prizeAmount > 0) prizeAmt += prizeAmount;
|
|
if(prizeAmt > 0)
|
|
if(prizeAmt > 0)
|
|
{
|
|
{
|
|
- var req = getRequestParams(content);
|
|
|
|
|
|
+ var req = getRequestParams(projectId, content);
|
|
var requestParamField = req[sub.requestParamField];
|
|
var requestParamField = req[sub.requestParamField];
|
|
var sendFlag = recordService.Any(m => m.prizeObjId == prizeObjectId && m.listId == sub.id && m.requestParamField == requestParamField);
|
|
var sendFlag = recordService.Any(m => m.prizeObjId == prizeObjectId && m.listId == sub.id && m.requestParamField == requestParamField);
|
|
if(!sendFlag)
|
|
if(!sendFlag)
|
|
@@ -485,7 +514,7 @@ namespace Util
|
|
createDate = DateTime.Now,
|
|
createDate = DateTime.Now,
|
|
projectId = projectId,
|
|
projectId = projectId,
|
|
listId = sub.id,
|
|
listId = sub.id,
|
|
- prizeAmount = sub.prizeAmount,
|
|
|
|
|
|
+ prizeAmount = prizeAmt,
|
|
prizeObjId = prizeObjectId,
|
|
prizeObjId = prizeObjectId,
|
|
requestParamField = requestParamField,
|
|
requestParamField = requestParamField,
|
|
batchNo = batchNo,
|
|
batchNo = batchNo,
|
|
@@ -497,13 +526,15 @@ namespace Util
|
|
}
|
|
}
|
|
|
|
|
|
//递归条件判断
|
|
//递归条件判断
|
|
- public static bool loopCondition(int projectId, string objId, string content)
|
|
|
|
|
|
+ public static bool loopCondition(int projectId, PriList sub, string objId, string content)
|
|
{
|
|
{
|
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
Dictionary<string, object> dic = new Dictionary<string, object>();
|
|
var queryTableService = App.GetService<IPriRecursionStartTableService>();
|
|
var queryTableService = App.GetService<IPriRecursionStartTableService>();
|
|
var queryFieldService = App.GetService<IPriRecursionStartFieldService>();
|
|
var queryFieldService = App.GetService<IPriRecursionStartFieldService>();
|
|
|
|
+ int passCount = 0;
|
|
//查询表
|
|
//查询表
|
|
- var queryTables = queryTableService.GetList(m => m.projectId == projectId);
|
|
|
|
|
|
+ var queryTables = queryTableService.GetList(m => m.listId == sub.id);
|
|
|
|
+ int allCount = queryTables.Count;
|
|
foreach(var queryTable in queryTables)
|
|
foreach(var queryTable in queryTables)
|
|
{
|
|
{
|
|
//查询返回字段
|
|
//查询返回字段
|
|
@@ -518,14 +549,14 @@ 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;
|
|
- fieldQueryValue = fieldQueryValue.Replace("#{loop_obj}#", objId);
|
|
|
|
|
|
+ if(fieldQueryModel == "loop_field") fieldQueryValue = objId;
|
|
string fieldQueryValueType = queryField.fieldQueryValueType;
|
|
string fieldQueryValueType = queryField.fieldQueryValueType;
|
|
if(fieldQueryKind == "1") //模糊匹配
|
|
if(fieldQueryKind == "1") //模糊匹配
|
|
{
|
|
{
|
|
condi += " and " + fieldEnName + " like ";
|
|
condi += " and " + fieldEnName + " like ";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -536,10 +567,10 @@ namespace Util
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
else if(fieldQueryKind == "2") //精确匹配
|
|
{
|
|
{
|
|
condi += " and " + fieldEnName + "=";
|
|
condi += " and " + fieldEnName + "=";
|
|
- string val = "";
|
|
|
|
|
|
+ string val = fieldQueryValue;
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -557,7 +588,7 @@ namespace Util
|
|
string[] val = fieldQueryValue.Split(':');
|
|
string[] val = fieldQueryValue.Split(':');
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
@@ -589,7 +620,7 @@ namespace Util
|
|
string val = "";
|
|
string val = "";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -605,10 +636,13 @@ namespace Util
|
|
}
|
|
}
|
|
|
|
|
|
var db = initDb(projectId);
|
|
var db = initDb(projectId);
|
|
- var item = db.SqlQueryable<Dictionary<string, object>>("select " + fields + " " + queryTable.tableEnName + "-" + fields + " from " + queryTable.tableEnName + " where 1=1" + condi).First();
|
|
|
|
- if(item == null) return false;
|
|
|
|
|
|
+ var item = db.Ado.GetScalar("select " + fields + " from " + queryTable.tableEnName + " where 1=1" + condi);
|
|
|
|
+ if(item != null) passCount += 1;
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
|
|
+ bool op = false;
|
|
|
|
+ if(sub.conditionMode == "all" && passCount == allCount) op = true;
|
|
|
|
+ else if(sub.conditionMode == "one" && passCount == 1) op = true;
|
|
|
|
+ return op;
|
|
}
|
|
}
|
|
|
|
|
|
//奖励入库
|
|
//奖励入库
|
|
@@ -634,7 +668,7 @@ namespace Util
|
|
string fieldQueryValueType = prizeInField.fieldQueryValueType;
|
|
string fieldQueryValueType = prizeInField.fieldQueryValueType;
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
fieldQueryValue = req[fieldQueryValue];
|
|
fieldQueryValue = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -663,7 +697,7 @@ namespace Util
|
|
condi += " and " + fieldEnName + " like ";
|
|
condi += " and " + fieldEnName + " like ";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
condi += "'%" + req[fieldQueryValue] + "%'";
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -677,7 +711,7 @@ namespace Util
|
|
string val = "";
|
|
string val = "";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|
|
@@ -695,7 +729,7 @@ namespace Util
|
|
string[] val = fieldQueryValue.Split(':');
|
|
string[] val = fieldQueryValue.Split(':');
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
if(fieldQueryValueType == "number")
|
|
if(fieldQueryValueType == "number")
|
|
{
|
|
{
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
if(!string.IsNullOrEmpty(req[val[0]])) condi += " and " + fieldEnName + ">=" + req[val[0]];
|
|
@@ -727,7 +761,7 @@ namespace Util
|
|
string val = "";
|
|
string val = "";
|
|
if(fieldQueryModel == "request_param")
|
|
if(fieldQueryModel == "request_param")
|
|
{
|
|
{
|
|
- Dictionary<string, string> req = getRequestParams(content);
|
|
|
|
|
|
+ Dictionary<string, string> req = getRequestParams(projectId, content);
|
|
val = req[fieldQueryValue];
|
|
val = req[fieldQueryValue];
|
|
}
|
|
}
|
|
else if(fieldQueryModel == "fixed_value")
|
|
else if(fieldQueryModel == "fixed_value")
|