Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AbstractObjectParser.java #119

Merged
merged 2 commits into from Feb 27, 2020
Merged

Update AbstractObjectParser.java #119

merged 2 commits into from Feb 27, 2020

Conversation

@zhoulingfengofcd
Copy link
Contributor

@zhoulingfengofcd zhoulingfengofcd commented Feb 26, 2020

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

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

@TommyLemon TommyLemon commented Feb 26, 2020

非常感谢,里面有个小 bug 会导致编译不通过,具体见批注
https://github.com/APIJSON/APIJSON/pull/119/files#diff-5aac4eb3e72073f8c8dc00768d5d4f18
希望修复下哦

@TommyLemon TommyLemon merged commit 1d2d25f into APIJSON:master Feb 27, 2020
Copy link
Member

@TommyLemon TommyLemon left a comment

@@ -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 &&

This comment has been minimized.

@TommyLemon

TommyLemon Feb 27, 2020
Member

POST 未被 import 进来直接使用,编译报错

JSONObject before = (JSONObject)response.get(key);
if(result.get("code").equals(200)){
if(before!=null){
before.put("count",before.getInteger("count")+result.getInteger("count"));

This comment has been minimized.

@TommyLemon

TommyLemon Feb 27, 2020
Member

"count" 已有 JSONRequst.KEY_COUNT 常量,建议替换

}
} else {
//只要有一条失败,则抛出异常,全部失败
throw new RuntimeException(key + "," + valueArray.getJSONObject(i) +",新增失败!");

This comment has been minimized.

@TommyLemon

TommyLemon Feb 27, 2020
Member

建议根据 JSONResponse.KEY_CODE 及 JSONResponse.KEY_MSG 改为更准确的 Exeption,方便排查错误

@zhoulingfengofcd zhoulingfengofcd deleted the zhoulingfengofcd:zhoulingfengofcd-patch-1 branch Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.