求版本敏感词优化

This commit is contained in:
kehaoyuan
2017-11-15 15:07:34 +08:00
parent 038e736eb1
commit 8403bc3a64

View File

@ -279,18 +279,13 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR
JSONObject responseObject = new JSONObject(string);
boolean cast = responseObject.getBoolean("cast");
String id = responseObject.getString("_id");
String illegal = responseObject.getString("illegal");
if (!TextUtils.isEmpty(illegal)) {
Utils.toast(VoteActivity.this, "包含非法内容,请修改后重试");
if (cast) {
Utils.toast(VoteActivity.this, "投票成功");
} else {
if (cast) {
Utils.toast(VoteActivity.this, "投票成功");
if (isNewVote) {
Utils.toast(VoteActivity.this, "已经存在相同的选项");
} else {
if (isNewVote) {
Utils.toast(VoteActivity.this, "已经存在相同的选项");
} else {
Utils.toast(VoteActivity.this, "你已经投过了");
}
Utils.toast(VoteActivity.this, "你已经投过了");
}
}
@ -311,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();
}
});