Browse Source

修改js引擎变量类型入参为object

andy 1 year ago
parent
commit
08dba3c8e9

+ 6 - 4
src/main/java/com/scbfkj/uni/library/script/JsScriptEngineUtil.java

@@ -2,6 +2,7 @@ package com.scbfkj.uni.library.script;
 
 import com.scbfkj.uni.library.DataFormatUtil;
 import com.scbfkj.uni.library.UniReturnUtil;
+import com.scbfkj.uni.system.Config;
 import org.apache.commons.pool2.BaseKeyedPooledObjectFactory;
 import org.apache.commons.pool2.KeyedObjectPool;
 import org.apache.commons.pool2.PooledObject;
@@ -48,18 +49,19 @@ public final class JsScriptEngineUtil {
     }, new GenericKeyedObjectPoolConfig<>());
 
 
-    public static Map<String, Object> eval(String script, List<Map<String, Object>> args) throws Exception {
+    public static Map<String, Object> eval(String script, Object args) throws Exception {
 
         try {
             return UniReturnUtil.success(exec(script, args));
         } catch (Exception e) {
-            System.out.println(script);
-            e.printStackTrace();
+            if (Config.isDebug()) {
+                e.printStackTrace();
+            }
             throw e;
         }
     }
 
-    public static Object exec(String script, List<Map<String, Object>> args) throws Exception {
+    public static Object exec(String script, Object args) throws Exception {
 
         String sc = ARGS + script;