Skip to content

Commit aed4996

Browse files
committed
远程函数:新增校验 Function 表中配置的 returnType
1 parent a0735fb commit aed4996

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/main/java/apijson/framework/APIJSONFunctionParser.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,12 @@ public static <T extends Object> JSONObject init(boolean shutdownWhenServerError
207207
onServerError("\n\n\n\n\n !!!! 查询远程函数异常 !!!\n" + response.getString(JSONResponse.KEY_MSG) + "\n\n\n\n\n", shutdownWhenServerError);
208208
}
209209

210-
JSONArray scriptList = response.getJSONArray(SCRIPT_ + "[]");
210+
JSONArray scriptList = response.getJSONArray("[]"); // response.getJSONArray(SCRIPT_ + "[]");
211211
if (scriptList != null && scriptList.isEmpty() == false) {
212-
if (isAll) {
213-
SCRIPT_MAP = new LinkedHashMap<>();
214-
}
212+
//if (isAll) {
213+
// SCRIPT_MAP = new LinkedHashMap<>();
214+
//}
215+
Map<String, JSONObject> newMap = new LinkedHashMap<>();
215216

216217
for (int i = 0; i < scriptList.size(); i++) {
217218
JSONObject item = scriptList.getJSONObject(i);
@@ -230,11 +231,13 @@ public static <T extends Object> JSONObject init(boolean shutdownWhenServerError
230231
onServerError("Script 表字段 script 的值 " + s + " 不合法!不能为空!", shutdownWhenServerError);
231232
}
232233

233-
SCRIPT_MAP.put(n, item);
234+
newMap.put(n, item);
234235
}
236+
237+
SCRIPT_MAP = newMap;
235238
}
236239

237-
JSONArray list = response.getJSONArray(FUNCTION_ + "[]");
240+
JSONArray list = scriptList; // response.getJSONArray(FUNCTION_ + "[]");
238241
int size = list == null ? 0 : list.size();
239242
if (isAll && size <= 0) {
240243
Log.w(TAG, "init isAll && size <= 0,,没有可用的远程函数");

0 commit comments

Comments
 (0)