|
|
|
@ -515,10 +515,11 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { |
|
|
|
|
/** |
|
|
|
|
* 替换@get,{{ }} |
|
|
|
|
*/ |
|
|
|
|
fun makeUpRule(result: Any?) { //追加比插入快 |
|
|
|
|
fun makeUpRule(result: Any?) { |
|
|
|
|
val infoVal = StringBuilder() |
|
|
|
|
if (ruleParam.isNotEmpty()) { |
|
|
|
|
for (index in 0 until ruleParam.size) { |
|
|
|
|
var index = ruleParam.size |
|
|
|
|
for (index-- > 0) { |
|
|
|
|
val regType = ruleType[index] |
|
|
|
|
when { |
|
|
|
|
regType > defaultRuleType -> { |
|
|
|
@ -526,17 +527,17 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { |
|
|
|
|
(result as? List<String?>)?.run { |
|
|
|
|
if (this.size > regType) { |
|
|
|
|
this[regType]?.let { |
|
|
|
|
infoVal.append(it) |
|
|
|
|
infoVal.insert(0, it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}?:infoVal.append(ruleParam[index]) |
|
|
|
|
}?:infoVal.insert(0, ruleParam[index]) |
|
|
|
|
} |
|
|
|
|
regType == jsRuleType -> { |
|
|
|
|
if (isRule(ruleParam[index])) { |
|
|
|
|
infoVal.append( getString(arrayListOf(SourceRule(ruleParam[index]))) ) |
|
|
|
|
infoVal.insert(0, getString(arrayListOf(SourceRule(ruleParam[index])))) |
|
|
|
|
} else { |
|
|
|
|
evalJS(ruleParam[index], result)?.run{ |
|
|
|
|
infoVal.append(when(this){ |
|
|
|
|
infoVal.insert(0, when(this){ |
|
|
|
|
is String -> this |
|
|
|
|
this is Double && this % 1.0 == 0.0 -> String.format("%.0f", this) |
|
|
|
|
else -> toString() |
|
|
|
@ -545,9 +546,9 @@ class AnalyzeRule(val ruleData: RuleDataInterface) : JsExtensions { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
regType == getRuleType -> { |
|
|
|
|
infoVal.append(get(ruleParam[index])) |
|
|
|
|
infoVal.insert(0, get(ruleParam[index])) |
|
|
|
|
} |
|
|
|
|
else -> infoVal.append(ruleParam[index]) |
|
|
|
|
else -> infoVal.insert(0, ruleParam[index]) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
rule = infoVal.toString() |
|
|
|
|