与3.0.2合并

This commit is contained in:
kehaoyuan
2017-11-17 10:47:43 +08:00
30 changed files with 568 additions and 111 deletions

View File

@ -279,7 +279,6 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
JSONObject responseObject = new JSONObject(string);
boolean cast = responseObject.getBoolean("cast");
String id = responseObject.getString("_id");
if (cast) {
Utils.toast(VoteActivity.this, getString(R.string.vote_success));
} else {
@ -307,7 +306,21 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
@Override
public void onFailure(HttpException e) {
super.onFailure(e);
Utils.toast(VoteActivity.this, "提交失败");
if (e != null && e.code() == 403) {
try {
String string = e.response().errorBody().string();
JSONObject errorJson = new JSONObject(string);
String detail = errorJson.getString("detail");
if ("illegal".equals(detail)) {
Utils.toast(VoteActivity.this, "包含非法内容,请修改后重试");
}
} catch (Exception e1) {
e1.printStackTrace();
}
} else {
Utils.toast(VoteActivity.this, "提交失败");
}
waitDialog.dismiss();
}
});