修改点赞逻辑,评论数据同步
This commit is contained in:
@ -55,22 +55,30 @@ public class PostCommentUtils {
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static void addCommentVoto(final Context context, final String newsId) {
|
||||
addCommentVoto(context, newsId, true);
|
||||
public static void addCommentVoto(final Context context, final String newsId, final PostCommentListener listener) {
|
||||
addCommentVoto(context, newsId, true, listener);
|
||||
}
|
||||
|
||||
public static void addCommentVoto(final Context context, final String newsId, final boolean isCheck) {
|
||||
public static void addCommentVoto(final Context context, final String newsId, final boolean isCheck
|
||||
, final PostCommentListener listener) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
StringExtendedRequest request = new StringExtendedRequest(
|
||||
Request.Method.POST, Config.COMMENT_HOST + "comment/" + newsId + "/vote" ,
|
||||
null,
|
||||
Request.Method.POST, Config.COMMENT_HOST + "comment/" + newsId + "/vote",
|
||||
new Response.Listener<String>() {
|
||||
@Override
|
||||
public void onResponse(String response) {
|
||||
listener.postSucced(null);
|
||||
}
|
||||
},
|
||||
new Response.ErrorListener() {
|
||||
@Override
|
||||
public void onErrorResponse(VolleyError error) {
|
||||
if (error.networkResponse != null && error.networkResponse.statusCode == 401) {
|
||||
addCommentVoto(context, newsId, false);
|
||||
addCommentVoto(context, newsId, false,listener);
|
||||
} else {
|
||||
listener.postFailed(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user