Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate AbstractObjectParser.java #119
Conversation
POST(新增)支持批量,批量事务问题处理方式:全部成功,则成功,只要一条失败,全部失败
|
非常感谢,里面有个小 bug 会导致编译不通过,具体见批注 |
|
感谢贡献,已合并,现在你也是 APIJSON 项目的一个 Contributer 了 https://github.com/TommyLemon/APIJSON/graphs/contributors https://github.com/APIJSON/APIJSON/blob/master/README.md#%E8%B4%A1%E7%8C%AE%E8%80%85%E4%BB%AC |
| @@ -240,8 +240,33 @@ public AbstractObjectParser parse() throws Exception { | |||
| response.put(key, onChildParse(index, key, (JSONObject)value)); | |||
| index ++; | |||
| } | |||
| } | |||
| else if (method == PUT && value instanceof JSONArray | |||
| } else if (value instanceof JSONArray && method == POST && | |||
| JSONObject before = (JSONObject)response.get(key); | ||
| if(result.get("code").equals(200)){ | ||
| if(before!=null){ | ||
| before.put("count",before.getInteger("count")+result.getInteger("count")); |
| } | ||
| } else { | ||
| //只要有一条失败,则抛出异常,全部失败 | ||
| throw new RuntimeException(key + "," + valueArray.getJSONObject(i) +",新增失败!"); |
TommyLemon
Feb 27, 2020
Member
建议根据 JSONResponse.KEY_CODE 及 JSONResponse.KEY_MSG 改为更准确的 Exeption,方便排查错误


POST(新增)支持批量,批量事务问题处理方式:全部成功,则成功,只要一条失败,全部失败