新版游戏详情,我的光环, 反馈页面。 专题增加标签
This commit is contained in:
@ -2,6 +2,7 @@ package com.gh.common.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
@ -24,13 +25,19 @@ import rx.schedulers.Schedulers;
|
||||
public class PostCommentUtils {
|
||||
|
||||
public static void addCommentData(final Context context, final String newsId, final String content,
|
||||
final boolean isCheck, final PostCommentListener listener) {
|
||||
final boolean isCheck, final CommentEntity commentEntity,
|
||||
final PostCommentListener listener) {
|
||||
TokenUtils.getToken(context, isCheck)
|
||||
.flatMap(new Func1<String, Observable<ResponseBody>>() {
|
||||
@Override
|
||||
public Observable<ResponseBody> call(String token) {
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), content);
|
||||
return RetrofitManager.getComment().postNewsComment(token, newsId, body);
|
||||
|
||||
if (commentEntity != null) {
|
||||
return RetrofitManager.getComment().postReplyComment(token, commentEntity.getId(), body);
|
||||
} else {
|
||||
return RetrofitManager.getComment().postNewsComment(token, newsId, body);
|
||||
}
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -47,10 +54,16 @@ public class PostCommentUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Utils.log("======" + e.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
if (e != null && e.code() == 401) {
|
||||
addCommentData(context, newsId, content, false, listener);
|
||||
addCommentData(context, newsId, content, false, commentEntity, listener);
|
||||
return;
|
||||
}
|
||||
if (listener != null){
|
||||
|
||||
Reference in New Issue
Block a user