|
|
@ -148,7 +148,7 @@ class AnalyzeRule(private var book: BaseBook? = null) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (result == null) return ArrayList() |
|
|
|
if (result == null) return null |
|
|
|
if (result is String) { |
|
|
|
if (result is String) { |
|
|
|
result = (result as String).split("\n") |
|
|
|
result = (result as String).split("\n") |
|
|
|
} |
|
|
|
} |
|
|
@ -509,13 +509,16 @@ class AnalyzeRule(private var book: BaseBook? = null) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
regType == -1 -> { |
|
|
|
regType == -1 -> { |
|
|
|
val jsEval: Any = evalJS(ruleParam[index], result) |
|
|
|
val jsEval: Any? = evalJS(ruleParam[index], result) |
|
|
|
if (jsEval is String) { |
|
|
|
when { |
|
|
|
infoVal.insert(0, jsEval) |
|
|
|
jsEval == null -> { |
|
|
|
} else if (jsEval is Double && jsEval % 1.0 == 0.0) { |
|
|
|
} |
|
|
|
infoVal.insert(0, String.format("%.0f", jsEval)) |
|
|
|
jsEval is String -> infoVal.insert(0, jsEval) |
|
|
|
} else { |
|
|
|
jsEval is Double && jsEval % 1.0 == 0.0 -> infoVal.insert( |
|
|
|
infoVal.insert(0, jsEval.toString()) |
|
|
|
0, |
|
|
|
|
|
|
|
String.format("%.0f", jsEval) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
else -> infoVal.insert(0, jsEval.toString()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
regType == -2 -> { |
|
|
|
regType == -2 -> { |
|
|
@ -546,7 +549,7 @@ class AnalyzeRule(private var book: BaseBook? = null) { |
|
|
|
* 执行JS |
|
|
|
* 执行JS |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Throws(Exception::class) |
|
|
|
@Throws(Exception::class) |
|
|
|
private fun evalJS(jsStr: String, result: Any?): Any { |
|
|
|
private fun evalJS(jsStr: String, result: Any?): Any? { |
|
|
|
val bindings = SimpleBindings() |
|
|
|
val bindings = SimpleBindings() |
|
|
|
bindings["java"] = this |
|
|
|
bindings["java"] = this |
|
|
|
bindings["book"] = book |
|
|
|
bindings["book"] = book |
|
|
|