diff --git a/app/src/main/java/com/gh/common/DefaultUrlHandler.kt b/app/src/main/java/com/gh/common/DefaultUrlHandler.kt index b02bf3d072..c93dfdec95 100644 --- a/app/src/main/java/com/gh/common/DefaultUrlHandler.kt +++ b/app/src/main/java/com/gh/common/DefaultUrlHandler.kt @@ -502,6 +502,13 @@ object DefaultUrlHandler { @JvmStatic fun transformNormalScheme(context: Context, url: String, entrance: String): Boolean { + val b = transformNewNormalScheme(context, url, entrance) + if (b) return b + return transformOldNormalScheme(context, url, entrance) + } + + @JvmStatic + fun transformOldNormalScheme(context: Context, url: String, entrance: String): Boolean { val uri = Uri.parse(url) if (uri.host == "www.ghzs666.com" || uri.host == "www.ghzs.com" @@ -513,8 +520,7 @@ object DefaultUrlHandler { uri.path?.apply { when { contains("game") -> { - val gameId = uri.getQueryParameter("gameId") ?: uri.pathSegments.last() - ?: "" + val gameId = uri.getQueryParameter("gameId") ?: uri.pathSegments.last() ?: "" DirectUtils.directToGameDetail(context, gameId, entrance, autoDownload = false, traceEvent = null) } contains("question") -> { @@ -580,6 +586,56 @@ object DefaultUrlHandler { return false } + @JvmStatic + fun transformNewNormalScheme(context: Context, url: String, entrance: String): Boolean { + val uri = Uri.parse(url) + if (uri.host == "www.ghzs666.com" + || uri.host == "www.ghzs.com" + || uri.host == "ask.ghzs.com" + || uri.host == "m.ghzs.com" + || uri.host == "m.ghzs666.com" + || uri.host == "dev-bbs-mobile.ghzs.com" + ) { + Utils.log(uri.path) + uri.path?.apply { + val splits = split("/") + when { + //https://m.ghzs666.com/bbs/thread-帖子ID + splits.size >= 3 && splits[1] == "bbs" && splits[2].startsWith("thread-") -> { + val articleId = splits[2].substring(7) + DirectUtils.directToCommunityArticle( + context, articleId, "", + entrance, "文章链接" + ) + } + //https://m.ghzs666.com/article/文章ID + splits.size >= 3 && splits[1] == "article" -> { + val articleId = splits[2] + DirectUtils.directToArticle(context, articleId, entrance) + } + //https://m.ghzs666.com/column/专题ID + splits.size >= 3 && splits[1] == "column" -> { + val columnId = splits[2] + DirectUtils.directToSubject(context, columnId, "", entrance) + } + //https://m.ghzs666.com/zone/游戏ID + splits.size >= 3 && splits[1] == "zone" -> { + val gameId = splits[2] + DirectUtils.directGameZone(context, gameId, url, entrance) + } + //https://m.ghzs666.com/bbs/video-视频ID + splits.size >= 3 && splits[1] == "bbs" && splits[2].startsWith("video-") -> { + val videoId = splits[2].substring(6) + DirectUtils.directToVideoDetail(context, videoId, entrance) + } + else -> return false + } + } + return true + } + return false + } + /** * 将 url 转换为 LinkEntity (实际只有 type 和 link 两个字段,仅供日志,不保证能用) */ diff --git a/app/src/main/java/com/gh/common/util/CommentHelper.kt b/app/src/main/java/com/gh/common/util/CommentHelper.kt index 4ecfc6f8b1..4f7d036674 100644 --- a/app/src/main/java/com/gh/common/util/CommentHelper.kt +++ b/app/src/main/java/com/gh/common/util/CommentHelper.kt @@ -441,7 +441,6 @@ object CommentHelper { "确定", "取消", { RetrofitManager.getInstance().api .highlightCommunityArticleComment( - communityId, articleId, comment.id ) @@ -502,7 +501,7 @@ object CommentHelper { context, hide, hideDialogHintContent, "确定", "取消", { RetrofitManager.getInstance().api - .hideCommunityArticleComment(communityId, articleId, comment.id) + .hideCommunityArticleComment(articleId, comment.id) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.io()) .subscribe(hideObserver) diff --git a/app/src/main/java/com/gh/common/util/PostCommentUtils.java b/app/src/main/java/com/gh/common/util/PostCommentUtils.java index 897bbe4b08..10cc2fd356 100644 --- a/app/src/main/java/com/gh/common/util/PostCommentUtils.java +++ b/app/src/main/java/com/gh/common/util/PostCommentUtils.java @@ -81,7 +81,7 @@ public class PostCommentUtils { observable = RetrofitManager.getInstance().getApi().postReplyToCommunityArticleComment(articleCommunityId, articleId, commentEntity.getId(), body); } else { - observable = RetrofitManager.getInstance().getApi().postCommentToCommunityArticle(articleCommunityId, articleId, body); + observable = RetrofitManager.getInstance().getApi().postCommentToCommunityArticle(articleId, body); } } else { if (commentEntity != null) { @@ -122,7 +122,7 @@ public class PostCommentUtils { if (!TextUtils.isEmpty(answerId)) { observable = RetrofitManager.getInstance().getApi().postVoteAnswerComment(answerId, commentId); } else if (!TextUtils.isEmpty(articleId)) { - observable = RetrofitManager.getInstance().getApi().postVoteCommunityArticleComment(articleCommunityId, articleId, commentId); + observable = RetrofitManager.getInstance().getApi().postVoteCommunityArticleComment(articleId, commentId); } else if (!TextUtils.isEmpty(questionId)) { observable = RetrofitManager.getInstance().getApi().postVoteQuestionComment(questionId, commentId); } else { @@ -159,8 +159,8 @@ public class PostCommentUtils { if (!TextUtils.isEmpty(questionId)) { observable = RetrofitManager.getInstance().getApi().postUnVoteQuestionComment(questionId, commentId); - } else if (!TextUtils.isEmpty(articleCommunityId) && !TextUtils.isEmpty(articleId)) { - observable = RetrofitManager.getInstance().getApi().postUnVoteArticleComment(articleCommunityId, articleId, commentId); + } else if (!TextUtils.isEmpty(articleId)) { + observable = RetrofitManager.getInstance().getApi().postUnVoteArticleComment(articleId, commentId); } else { observable = RetrofitManager.getInstance().getApi().postUnVoteVideoComment(videoId, commentId); } diff --git a/app/src/main/java/com/gh/gamecenter/collection/CommunityArticleViewModel.kt b/app/src/main/java/com/gh/gamecenter/collection/CommunityArticleViewModel.kt index 5e2daac106..5ce2af0ed5 100644 --- a/app/src/main/java/com/gh/gamecenter/collection/CommunityArticleViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/collection/CommunityArticleViewModel.kt @@ -88,7 +88,7 @@ class CommunityArticleViewModel(application: Application) : ListViewModel() { diff --git a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt index 1033114957..230214d725 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailFragment.kt @@ -739,8 +739,8 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable { when (requestCode) { CommunityHomeFragment.ARTICLE_REQUEST_CODE -> { val articleId = data?.getStringExtra("article_id") ?: return - val communityId = data?.getStringExtra("community_id") ?: return - mViewModel?.getArticleData(communityId, articleId) +// val communityId = data?.getStringExtra("community_id") ?: return + mViewModel?.getArticleData(articleId) } CommunityHomeFragment.QUESTION_REQUEST_CODE -> { diff --git a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailViewModel.kt b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailViewModel.kt index a12da10a59..532cbd6714 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/detail/ForumDetailViewModel.kt @@ -40,29 +40,29 @@ class ForumDetailViewModel(application: Application, val bbsId: String) : Androi @SuppressLint("CheckResult") fun postForumRead() { mApi.postForumRead(bbsId) - .compose(singleToMain()) - .subscribe(EmptyResponse()) + .compose(singleToMain()) + .subscribe(EmptyResponse()) } fun getForumDetail() { mApi.getForumDetail(bbsId) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : Response() { - override fun onResponse(response: ForumDetailEntity?) { - super.onResponse(response) - forumDetail.postValue(Resource.success(response)) - response?.run { - mForumDao.addForum(convertForumDetailEntityToForumEntity()) - EventBus.getDefault().post(EBForumRecordChange(convertForumDetailEntityToForumEntity())) - } + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : Response() { + override fun onResponse(response: ForumDetailEntity?) { + super.onResponse(response) + forumDetail.postValue(Resource.success(response)) + response?.run { + mForumDao.addForum(convertForumDetailEntityToForumEntity()) + EventBus.getDefault().post(EBForumRecordChange(convertForumDetailEntityToForumEntity())) } + } - override fun onFailure(e: HttpException?) { - super.onFailure(e) - forumDetail.postValue(Resource.error(e)) - } - }) + override fun onFailure(e: HttpException?) { + super.onFailure(e) + forumDetail.postValue(Resource.error(e)) + } + }) } fun getModeratorsApplyStatus() { @@ -85,64 +85,64 @@ class ForumDetailViewModel(application: Application, val bbsId: String) : Androi @SuppressLint("CheckResult") fun followForum(onSuccess: () -> Unit) { RetrofitManager.getInstance().api - .followForum(bbsId) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - onSuccess.invoke() - } - }) + .followForum(bbsId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : BiResponse() { + override fun onSuccess(data: ResponseBody) { + onSuccess.invoke() + } + }) } @SuppressLint("CheckResult") fun unFollowForum(onSuccess: () -> Unit) { RetrofitManager.getInstance().api - .unFollowForum(bbsId) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - onSuccess.invoke() - } - }) + .unFollowForum(bbsId) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : BiResponse() { + override fun onSuccess(data: ResponseBody) { + onSuccess.invoke() + } + }) } - fun getArticleData(communityId: String, articleId: String) { - mApi.getCommunityArticleDetail(communityId, articleId) - .compose(observableToMain()) - .subscribe(object : Response() { - override fun onResponse(response: ArticleDetailEntity?) { - response?.run { - answerLiveData.postValue(convertArticleDetailToAnswer(response)) - } - + fun getArticleData(articleId: String) { + mApi.getCommunityArticleDetail(articleId) + .compose(observableToMain()) + .subscribe(object : Response() { + override fun onResponse(response: ArticleDetailEntity?) { + response?.run { + answerLiveData.postValue(convertArticleDetailToAnswer(response)) } - }) + + } + }) } fun getQuestionDetail(questionId: String) { mApi.getQuestionsById(questionId) - .compose(observableToMain()) - .subscribe(object : Response() { - override fun onResponse(response: QuestionsDetailEntity?) { - response?.run { - answerLiveData.postValue(convertQuestionDetailToAnswer(response)) - } + .compose(observableToMain()) + .subscribe(object : Response() { + override fun onResponse(response: QuestionsDetailEntity?) { + response?.run { + answerLiveData.postValue(convertQuestionDetailToAnswer(response)) } - }) + } + }) } fun getVideoDetail(videoId: String) { mApi.getBbsVideoDetail(videoId) - .compose(observableToMain()) - .subscribe(object : Response() { - override fun onResponse(response: ForumVideoEntity?) { - response?.run { - answerLiveData.postValue(convertVideoDetailToAnswer(response)) - } + .compose(observableToMain()) + .subscribe(object : Response() { + override fun onResponse(response: ForumVideoEntity?) { + response?.run { + answerLiveData.postValue(convertVideoDetailToAnswer(response)) } - }) + } + }) } fun convertArticleDetailToAnswer(articleDetailEntity: ArticleDetailEntity): AnswerEntity { @@ -159,7 +159,7 @@ class ForumDetailViewModel(application: Application, val bbsId: String) : Androi answerEntity.images = articleDetailEntity.images answerEntity.imagesInfo = articleDetailEntity.imagesInfo answerEntity.videos = articleDetailEntity.videos - answerEntity.status = articleDetailEntity.status ?:"" + answerEntity.status = articleDetailEntity.status ?: "" answerEntity.type = "community_article" return answerEntity @@ -201,12 +201,13 @@ class ForumDetailViewModel(application: Application, val bbsId: String) : Androi answerEntity.time = forumVideoEntity.time.upload forumVideoEntity.user.run { answerEntity.user = UserEntity( - id = id, - name = name, - icon = icon, - auth = auth, - badge = badge, - border = border) + id = id, + name = name, + icon = icon, + auth = auth, + badge = badge, + border = border + ) } answerEntity.type = "video" diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt index 2e3f334b12..20ce0dc489 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeFragment.kt @@ -141,15 +141,15 @@ class CommunityHomeFragment : LazyFragment() { mFragmentList.clear() val tag = "android:switcher:${viewPager.id}:" val forumArticleListFragment = childFragmentManager.findFragmentByTag("${tag}0") - ?: ForumArticleListFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "社区", EntranceConsts.KEY_PATH to "推荐")) + ?: ForumArticleListFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "社区", EntranceConsts.KEY_PATH to "推荐")) mFragmentList.add(forumArticleListFragment) val forumFragment = childFragmentManager.findFragmentByTag("${tag}1") - ?: ForumFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "社区")) + ?: ForumFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "社区")) mFragmentList.add(forumFragment) val activityFragment = childFragmentManager.findFragmentByTag("${tag}2") - ?: ForumActivityFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "活动")) + ?: ForumActivityFragment().with(bundleOf(EntranceConsts.KEY_ENTRANCE to "活动")) mFragmentList.add(activityFragment) viewPager.run { @@ -195,13 +195,25 @@ class CommunityHomeFragment : LazyFragment() { (mTabList[position] as TextView).run { layoutParams.width = (DEFAULT_TAB_TEXT_WIDTH + ((1 - positionOffset) * 4F.dip2px())).roundToInt() textSize = (DEFAULT_TAB_TEXT_SIZE + ((1 - positionOffset) * 4)).roundTo(1) - setTextColor(ColorUtils.blendARGB(TAB_DEFAULT_COLOR.toColor(requireContext()), TAB_SELECTED_COLOR.toColor(requireContext()), 1 - positionOffset)) + setTextColor( + ColorUtils.blendARGB( + TAB_DEFAULT_COLOR.toColor(requireContext()), + TAB_SELECTED_COLOR.toColor(requireContext()), + 1 - positionOffset + ) + ) } if (mTabList[position + 1] is TextView) { (mTabList[position + 1] as TextView).run { layoutParams.width = (DEFAULT_TAB_TEXT_WIDTH + ((positionOffset) * 4F.dip2px())).roundToInt() textSize = (DEFAULT_TAB_TEXT_SIZE + ((positionOffset) * 4)).roundTo(1) - setTextColor(ColorUtils.blendARGB(TAB_DEFAULT_COLOR.toColor(requireContext()), TAB_SELECTED_COLOR.toColor(requireContext()), positionOffset)) + setTextColor( + ColorUtils.blendARGB( + TAB_DEFAULT_COLOR.toColor(requireContext()), + TAB_SELECTED_COLOR.toColor(requireContext()), + positionOffset + ) + ) } } else { (mTabList[position + 1] as TabItemCommunityBinding).run { @@ -211,7 +223,13 @@ class CommunityHomeFragment : LazyFragment() { tabImg.scaleY = (DEFAULT_TAB_IMG_HEIGHT + ((positionOffset) * 4)).roundTo(1) / DEFAULT_TAB_IMG_HEIGHT if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { tabImg.imageTintList = - ColorStateList.valueOf(ColorUtils.blendARGB(TAB_DEFAULT_COLOR.toColor(requireContext()), TAB_SELECTED_COLOR.toColor(requireContext()), positionOffset)) + ColorStateList.valueOf( + ColorUtils.blendARGB( + TAB_DEFAULT_COLOR.toColor(requireContext()), + TAB_SELECTED_COLOR.toColor(requireContext()), + positionOffset + ) + ) } } } @@ -433,8 +451,8 @@ class CommunityHomeFragment : LazyFragment() { when (requestCode) { ARTICLE_REQUEST_CODE -> { val articleId = data?.getStringExtra("article_id") ?: return - val communityId = data?.getStringExtra("community_id") ?: return - mViewModel?.getArticleData(communityId, articleId) +// val communityId = data?.getStringExtra("community_id") ?: return + mViewModel?.getArticleData(articleId) } QUESTION_REQUEST_CODE -> { @@ -531,7 +549,11 @@ class CommunityHomeFragment : LazyFragment() { navigationBg.setBackgroundColor(R.color.transparent.toColor(requireContext())) navigationBg.setImageDrawable(null) } else if (viewPager.currentItem == TAB_RECOMMEND_INDEX) { - navigationBg.setBackgroundColor(if (mNightMode && y > 0) R.color.background_white.toColor(requireContext()) else if (mNightMode && y == 0) R.color.background.toColor(requireContext()) else R.color.transparent.toColor(requireContext())) + navigationBg.setBackgroundColor( + if (mNightMode && y > 0) R.color.background_white.toColor(requireContext()) else if (mNightMode && y == 0) R.color.background.toColor( + requireContext() + ) else R.color.transparent.toColor(requireContext()) + ) navigationBg.setImageDrawable(null) } else if (mNightMode) { navigationBg.setBackgroundColor(R.color.background_white.toColor(requireContext())) @@ -552,7 +574,11 @@ class CommunityHomeFragment : LazyFragment() { } } mBinding?.run { - root.setBackgroundColor(if (viewPager.currentItem == TAB_FORUM_INDEX) R.color.background_white.toColor(requireContext()) else R.color.background.toColor(requireContext())) + root.setBackgroundColor( + if (viewPager.currentItem == TAB_FORUM_INDEX) R.color.background_white.toColor(requireContext()) else R.color.background.toColor( + requireContext() + ) + ) topBg.run { visibleIf(!mNightMode) post { diff --git a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeViewModel.kt b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeViewModel.kt index 4fa40e2284..3daf5fad05 100644 --- a/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/forum/home/CommunityHomeViewModel.kt @@ -19,8 +19,8 @@ class CommunityHomeViewModel(application: Application) : AndroidViewModel(applic private val mApi = RetrofitManager.getInstance().api val articleLiveData = MediatorLiveData() - fun getArticleData(communityId: String, articleId: String) { - mApi.getCommunityArticleDetail(communityId, articleId) + fun getArticleData(articleId: String) { + mApi.getCommunityArticleDetail(articleId) .compose(observableToMain()) .subscribe(object : Response() { override fun onResponse(response: ArticleDetailEntity?) { diff --git a/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt b/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt index 42c5ff3e9d..2e84e8ca0d 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/answer/BaseAnswerOrArticleItemViewHolder.kt @@ -60,28 +60,38 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH when (entity.type) { "community_article" -> { val communityId = if (!entity.communityId.isNullOrEmpty()) entity.communityId - ?: "" else entity.bbs.id - val intent = ArticleDetailActivity.getCommentIntent(itemView.context, - CommunityEntity(communityId, entity.communityName ?: ""), - entity.id ?: "", entrance, "") + ?: "" else entity.bbs.id + val intent = ArticleDetailActivity.getCommentIntent( + itemView.context, + CommunityEntity(communityId, entity.communityName ?: ""), + entity.id ?: "", entrance, "" + ) itemView.context.startActivity(intent) } "video" -> { val communityId = if (!entity.communityId.isNullOrEmpty()) entity.communityId ?: "" else entity.bbs.id - itemView.context.startActivity(ForumVideoDetailActivity.getIntent(itemView.context, entity.id - ?: "", communityId, true)) + itemView.context.startActivity( + ForumVideoDetailActivity.getIntent( + itemView.context, entity.id + ?: "", communityId, true + ) + ) } "answer" -> { - val intent = CommentActivity.getAnswerCommentIntent(itemView.context, - entity.id ?: "", - entity.count.comment, - false) + val intent = CommentActivity.getAnswerCommentIntent( + itemView.context, + entity.id ?: "", + entity.count.comment, + false + ) itemView.context.startActivity(intent) } else -> { - val intent = NewQuestionDetailActivity.getCommentIntent(itemView.context, entity.id - ?: "", entrance, "") + val intent = NewQuestionDetailActivity.getCommentIntent( + itemView.context, entity.id + ?: "", entrance, "" + ) itemView.context.startActivity(intent) } } @@ -156,10 +166,15 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH id = entity.id, title = entity.title, images = entity.images, - description = entity.brief) - it.context.startActivity(QuestionsInviteActivity.getIntent(it.context, - questionsDetailEntity, - entrance)) + description = entity.brief + ) + it.context.startActivity( + QuestionsInviteActivity.getIntent( + it.context, + questionsDetailEntity, + entrance + ) + ) } } @@ -173,7 +188,16 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH "video" -> "视频帖评论" else -> "提问帖评论" } - NewLogUtils.logRecommendFeedContentClick("click_for_you_comment", contentType, id, (position + 1), bbs.id, bbsType, user.id ?: "", commentType) + NewLogUtils.logRecommendFeedContentClick( + "click_for_you_comment", + contentType, + id, + (position + 1), + bbs.id, + bbsType, + user.id ?: "", + commentType + ) } } @@ -192,10 +216,12 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH else -> { val communityId = if (entity.community.id.isNotEmpty()) entity.community.id else UserManager.getInstance().community.id - val intent = ArticleDetailActivity.getCommentIntent(itemView.context, - CommunityEntity(communityId, entity.community.name), - entity.id, - entrance, "") + val intent = ArticleDetailActivity.getCommentIntent( + itemView.context, + CommunityEntity(communityId, entity.community.name), + entity.id, + entrance, "" + ) itemView.context.startActivity(intent) MtaHelper.onEvent(getEventId(entrance), getKey(entrance), "评论图标") } @@ -209,7 +235,15 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH CheckLoginUtils.checkLogin(itemView.context, entrance) { if (entrance == "社区+(推荐)" && position != null) { entity.run { - NewLogUtils.logRecommendFeedContentClick("click_for_you_like", contentType, id, position + 1, bbs.id, bbsType, user.id ?: "") + NewLogUtils.logRecommendFeedContentClick( + "click_for_you_like", + contentType, + id, + position + 1, + bbs.id, + bbsType, + user.id ?: "" + ) } } @@ -281,75 +315,72 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH } if (entity.type == "video") { RetrofitManager.getInstance() - .api.voteVideo(entity.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - //Utils.toast(getApplication(), "已点赞") - EnergyTaskHelper.postEnergyTask("vote_video", entity.id) - } + .api.voteVideo(entity.id) + .subscribeOn(Schedulers.io()) + .subscribe(object : BiResponse() { + override fun onSuccess(data: ResponseBody) { + //Utils.toast(getApplication(), "已点赞") + EnergyTaskHelper.postEnergyTask("vote_video", entity.id) + } - override fun onFailure(exception: Exception) { - super.onFailure(exception) - entity.count.vote = entity.count.vote - 1 - entity.me.isVoted = false - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity) - } - }) + override fun onFailure(exception: Exception) { + super.onFailure(exception) + entity.count.vote = entity.count.vote - 1 + entity.me.isVoted = false + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + setVoteAndCommentStyle(entity) + } + }) } else { val voteObservable = if (entity.type == "community_article") { - val communityId = if (entity.articleCommunityId.isNotEmpty()) entity.articleCommunityId - else entity.bbs.id - RetrofitManager.getInstance().api - .postCommunityArticleVote(communityId, entity.id) + RetrofitManager.getInstance().api.postCommunityArticleVote(entity.id) } else { RetrofitManager.getInstance().api - .postVoteQuestionComment(entity.questions.id, entity.id) - .map { GsonUtils.fromJson(it.string(), VoteEntity::class.java) } + .postVoteQuestionComment(entity.questions.id, entity.id) + .map { GsonUtils.fromJson(it.string(), VoteEntity::class.java) } } voteObservable - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : Response() { - override fun onResponse(response: VoteEntity?) { - if (entity.type == "community_article") { - entity.me.isCommunityArticleVote = true - EnergyTaskHelper.postEnergyTask("vote_community_article", entity.id) - } else { - entity.me.isAnswerVoted = true - EnergyTaskHelper.postEnergyTask("vote_answer", entity.id) - } - ToastUtils.showToast("已赞同") + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : Response() { + override fun onResponse(response: VoteEntity?) { + if (entity.type == "community_article") { + entity.me.isCommunityArticleVote = true + EnergyTaskHelper.postEnergyTask("vote_community_article", entity.id) + } else { + entity.me.isAnswerVoted = true + EnergyTaskHelper.postEnergyTask("vote_answer", entity.id) } + ToastUtils.showToast("已赞同") + } - override fun onFailure(e: HttpException?) { - ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { - if (403008 == it) { - Utils.toast(itemView.context, R.string.ask_vote_hint) - true - } else if (403036 == it) { - Utils.toast(itemView.context, R.string.ask_vote_limit_hint) - true - } else if (404001 == it) { - Utils.toast(itemView.context, "内容可能已被删除") - entity.active = false - setVoteAndCommentStyle(entity) - true + override fun onFailure(e: HttpException?) { + ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { + if (403008 == it) { + Utils.toast(itemView.context, R.string.ask_vote_hint) + true + } else if (403036 == it) { + Utils.toast(itemView.context, R.string.ask_vote_limit_hint) + true + } else if (404001 == it) { + Utils.toast(itemView.context, "内容可能已被删除") + entity.active = false + setVoteAndCommentStyle(entity) + true + } else { + entity.count.vote = entity.count.vote - 1 + if (entity.type == "community_article") { + entity.me.isCommunityArticleVote = true } else { - entity.count.vote = entity.count.vote - 1 - if (entity.type == "community_article") { - entity.me.isCommunityArticleVote = true - } else { - entity.me.isAnswerVoted = true - } - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity) - false + entity.me.isAnswerVoted = true } + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + setVoteAndCommentStyle(entity) + false } } - }) + } + }) } entity.count.vote = entity.count.vote + 1 voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" @@ -366,127 +397,32 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH if (entity.type == "video") { RetrofitManager.getInstance() - .api.undoVoteVideo(entity.id) - .subscribeOn(Schedulers.io()) - .subscribe(object : BiResponse() { - override fun onSuccess(data: ResponseBody) { - Utils.toast(itemView.context, "取消点赞") - } + .api.undoVoteVideo(entity.id) + .subscribeOn(Schedulers.io()) + .subscribe(object : BiResponse() { + override fun onSuccess(data: ResponseBody) { + Utils.toast(itemView.context, "取消点赞") + } - override fun onFailure(exception: Exception) { - super.onFailure(exception) - entity.count.vote = entity.count.vote + 1 - entity.me.isVoted = true - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity) - } - }) + override fun onFailure(exception: Exception) { + super.onFailure(exception) + entity.count.vote = entity.count.vote + 1 + entity.me.isVoted = true + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + setVoteAndCommentStyle(entity) + } + }) } else { val unVoteObservable = if (entity.type == "community_article") { entity.me.isCommunityArticleVote = false - - val communityId = if (entity.articleCommunityId.isNotEmpty()) entity.articleCommunityId - else entity.bbs.id - RetrofitManager.getInstance().api - .postCommunityArticleUnVote(communityId, entity.id) + RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id) } else { entity.me.isAnswerVoted = false RetrofitManager.getInstance().api - .postAnswerUnvote(entity.id) + .postAnswerUnvote(entity.id) } unVoteObservable - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : Response() { - override fun onResponse(response: VoteEntity?) { - Utils.toast(itemView.context, "取消赞同") - } - - override fun onFailure(e: HttpException?) { - ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { - if (403008 == it) { - Utils.toast(itemView.context, R.string.ask_vote_hint) - true - } else if (403036 == it) { - Utils.toast(itemView.context, R.string.ask_vote_limit_hint) - true - } else if (404001 == it) { - Utils.toast(itemView.context, "内容可能已被删除") - entity.active = false - setVoteAndCommentStyle(entity) - true - } else { - entity.count.vote = entity.count.vote + 1 - if (entity.type == "community_article") { - entity.me.isCommunityArticleVote = true - } else { - entity.me.isAnswerVoted = true - } - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity) - false - } - } - } - }) - } - } - - fun voteArticle(entity: ArticleEntity) { - entity.count.vote = entity.count.vote + 1 - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - playVoteAnimation() - - val communityId = if (entity.community.id.isEmpty()) entity.bbs.id - else entity.community.id - RetrofitManager.getInstance().api - .postCommunityArticleVote(communityId, entity.id) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : Response() { - override fun onResponse(response: VoteEntity?) { - entity.me.isCommunityArticleVote = true - ToastUtils.showToast("已赞同") - EnergyTaskHelper.postEnergyTask("vote_community_article", entity.id) - } - - override fun onFailure(e: HttpException?) { - ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { - if (403008 == it) { - Utils.toast(itemView.context, R.string.ask_vote_hint) - true - } else if (403036 == it) { - Utils.toast(itemView.context, R.string.ask_vote_limit_hint) - true - } else if (404001 == it) { - Utils.toast(itemView.context, "内容可能已被删除") - entity.active = false - setVoteAndCommentStyle(entity.transformAnswerEntity()) - true - } else { - entity.count.vote = entity.count.vote - 1 - entity.me.isCommunityArticleVote = false - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity.transformAnswerEntity()) - false - } - } - } - }) - } - - fun cancelArticleVote(entity: ArticleEntity) { - entity.count.vote = entity.count.vote - 1 - entity.me.isCommunityArticleVote = false - voteIcon.isChecked = false - voteCount.setTextColor(R.color.text_subtitleDesc.toColor()) - voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - - val communityId = if (entity.community.id.isEmpty()) entity.bbs.id - else entity.community.id - RetrofitManager.getInstance().api - .postCommunityArticleUnVote(communityId, entity.id) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -505,36 +441,123 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH } else if (404001 == it) { Utils.toast(itemView.context, "内容可能已被删除") entity.active = false - setVoteAndCommentStyle(entity.transformAnswerEntity()) + setVoteAndCommentStyle(entity) true } else { entity.count.vote = entity.count.vote + 1 - entity.me.isCommunityArticleVote = true + if (entity.type == "community_article") { + entity.me.isCommunityArticleVote = true + } else { + entity.me.isAnswerVoted = true + } voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" - setVoteAndCommentStyle(entity.transformAnswerEntity()) + setVoteAndCommentStyle(entity) false } } } }) + } + } + + fun voteArticle(entity: ArticleEntity) { + entity.count.vote = entity.count.vote + 1 + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + playVoteAnimation() + + RetrofitManager.getInstance().api + .postCommunityArticleVote(entity.id) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : Response() { + override fun onResponse(response: VoteEntity?) { + entity.me.isCommunityArticleVote = true + ToastUtils.showToast("已赞同") + EnergyTaskHelper.postEnergyTask("vote_community_article", entity.id) + } + + override fun onFailure(e: HttpException?) { + ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { + if (403008 == it) { + Utils.toast(itemView.context, R.string.ask_vote_hint) + true + } else if (403036 == it) { + Utils.toast(itemView.context, R.string.ask_vote_limit_hint) + true + } else if (404001 == it) { + Utils.toast(itemView.context, "内容可能已被删除") + entity.active = false + setVoteAndCommentStyle(entity.transformAnswerEntity()) + true + } else { + entity.count.vote = entity.count.vote - 1 + entity.me.isCommunityArticleVote = false + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + setVoteAndCommentStyle(entity.transformAnswerEntity()) + false + } + } + } + }) + } + + fun cancelArticleVote(entity: ArticleEntity) { + entity.count.vote = entity.count.vote - 1 + entity.me.isCommunityArticleVote = false + voteIcon.isChecked = false + voteCount.setTextColor(R.color.text_subtitleDesc.toColor()) + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + + RetrofitManager.getInstance().api + .postCommunityArticleUnVote(entity.id) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : Response() { + override fun onResponse(response: VoteEntity?) { + Utils.toast(itemView.context, "取消赞同") + } + + override fun onFailure(e: HttpException?) { + ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) { + if (403008 == it) { + Utils.toast(itemView.context, R.string.ask_vote_hint) + true + } else if (403036 == it) { + Utils.toast(itemView.context, R.string.ask_vote_limit_hint) + true + } else if (404001 == it) { + Utils.toast(itemView.context, "内容可能已被删除") + entity.active = false + setVoteAndCommentStyle(entity.transformAnswerEntity()) + true + } else { + entity.count.vote = entity.count.vote + 1 + entity.me.isCommunityArticleVote = true + voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同" + setVoteAndCommentStyle(entity.transformAnswerEntity()) + false + } + } + } + }) } fun followUser(entity: AnswerEntity, callback: EmptyCallback?) { RetrofitManager.getInstance().api - .postFollowing(entity.user.id) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(object : Response() { - override fun onResponse(response: ResponseBody?) { - super.onResponse(response) - callback?.onCallback() - } + .postFollowing(entity.user.id) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(object : Response() { + override fun onResponse(response: ResponseBody?) { + super.onResponse(response) + callback?.onCallback() + } - override fun onFailure(e: HttpException?) { - super.onFailure(e) - Utils.toast(itemView.context, R.string.loading_failed_hint) - } - }) + override fun onFailure(e: HttpException?) { + super.onFailure(e) + Utils.toast(itemView.context, R.string.loading_failed_hint) + } + }) } private fun playVoteAnimation() { diff --git a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt index 92822f1224..e2672d90ef 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/article/detail/ArticleDetailFragment.kt @@ -676,10 +676,7 @@ class ArticleDetailFragment : BaseCommentFragment() { @@ -105,7 +104,7 @@ class ArticleDetailViewModel( } fun cancelLikeArticle() { - mApi.postCommunityArticleUnVote(communityId, articleId) + mApi.postCommunityArticleUnVote(articleId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -126,7 +125,7 @@ class ArticleDetailViewModel( } fun likeArticle() { - mApi.postCommunityArticleVote(communityId, articleId) + mApi.postCommunityArticleVote(articleId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -227,13 +226,11 @@ class ArticleDetailViewModel( val observable = if (isCollection) { mApi.postCommunityArticleFavorites( UserManager.getInstance().userId, - communityId, articleId ) } else { mApi.deleteCommunityArticleFavorites( UserManager.getInstance().userId, - communityId, articleId ) } @@ -309,8 +306,8 @@ class ArticleDetailViewModel( }) } - fun doHighlightThisArticle(communityId: String, articleId: String?) { - mApi.highlightCommunityArticle(communityId, articleId) + fun doHighlightThisArticle(articleId: String?) { + mApi.highlightCommunityArticle(articleId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -326,8 +323,8 @@ class ArticleDetailViewModel( }) } - fun cancelHighlightThisArticle(communityId: String, articleId: String){ - mApi.cancelHighlightCommunityArticle(communityId, articleId) + fun cancelHighlightThisArticle(articleId: String) { + mApi.cancelHighlightCommunityArticle(articleId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -359,8 +356,8 @@ class ArticleDetailViewModel( }) } - fun doHideThisArticle(communityId: String, articleId: String?) { - mApi.hideCommunityArticle(communityId, articleId) + fun doHideThisArticle(articleId: String?) { + mApi.hideCommunityArticle(articleId) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(object : Response() { @@ -377,12 +374,11 @@ class ArticleDetailViewModel( } fun modifyArticleActivityTag( - communityId: String, articleId: String, label: ActivityLabelEntity? ) { val body = json { "tag_activity_id" to label?.id }.toRequestBody() - mApi.modifyArticleActivityTag(communityId, articleId, body) + mApi.modifyArticleActivityTag(articleId, body) .compose(observableToMain()) .subscribe(object : Response() { override fun onResponse(response: ResponseBody?) { diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt index 228d125dc6..2e1ed23db3 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/NewCommentViewModel.kt @@ -56,7 +56,7 @@ open class NewCommentViewModel( val pictureLiveData = MutableLiveData>() init { - commentDraftDao = AppDatabase.getInstance().commentDraftDao() + commentDraftDao = AppDatabase.getInstance().commentDraftDao() } override fun provideDataObservable(page: Int): Observable>? { @@ -66,7 +66,7 @@ open class NewCommentViewModel( CommentType.ANSWER -> api.getAnswerCommentList(answerId, page) CommentType.ANSWER_CONVERSATION -> api.getAnswerCommentConversationList(answerId, commentId, page) - CommentType.COMMUNITY_ARTICLE -> api.getCommunityArticleCommentList(communityId, articleId, "time.create:1", page, mapOf()) + CommentType.COMMUNITY_ARTICLE -> api.getCommunityArticleCommentList(articleId, "time.create:1", page, mapOf()) CommentType.COMMUNITY_ARTICLE_CONVERSATION -> api.getCommunityArticleCommentConversation(communityId, articleId, commentId, page) CommentType.VIDEO -> api.getVideoCommentList(videoId, page, mapOf()) @@ -141,7 +141,7 @@ open class NewCommentViewModel( CommentType.COMMUNITY_ARTICLE, CommentType.COMMUNITY_ARTICLE_CONVERSATION -> { if (commentEntity == null) { - api.postCommentToCommunityArticle(communityId, articleId, body) + api.postCommentToCommunityArticle(articleId, body) } else { api.postReplyToCommunityArticleComment(communityId, articleId, commentEntity.id, body) } diff --git a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt index da00e63019..f1edf16a47 100644 --- a/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/qa/comment/base/BaseCommentViewModel.kt @@ -262,7 +262,7 @@ abstract class BaseCommentViewModel( mApi.deleteQuestionComment(questionId, entity.id).toObservable() } articleId.isNotEmpty() -> { - mApi.hideCommunityArticleComment(communityId, articleId, entity.id) + mApi.hideCommunityArticleComment(articleId, entity.id) } else -> null } ?: return @@ -305,7 +305,7 @@ abstract class BaseCommentViewModel( } when { articleId.isNotEmpty() -> { - mApi.postArticleCommentTop(communityId, articleId, commentId, map) + mApi.postArticleCommentTop(articleId, commentId, map) } questionId.isNotEmpty() -> { mApi.postQuestionCommentTop(questionId, commentId, map) @@ -318,7 +318,7 @@ abstract class BaseCommentViewModel( } else { when { articleId.isNotEmpty() -> { - mApi.postArticleCommentUnTop(communityId, articleId, commentId) + mApi.postArticleCommentUnTop(articleId, commentId) } questionId.isNotEmpty() -> { mApi.postQuestionCommentUnTop(questionId, commentId) diff --git a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java index 1a6154a056..f451679903 100644 --- a/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java +++ b/app/src/main/java/com/gh/gamecenter/retrofit/service/ApiService.java @@ -1299,8 +1299,8 @@ public interface ApiService { */ @GET("users/{user_id}/histories") Single> getPersonalHistoryCount(@Path("user_id") String userId, - @Query("channel") String channel, - @Query("filter") String filter); + @Query("channel") String channel, + @Query("filter") String filter); /** * 检测游戏是否开启社区,用在游戏详情页的答案列表。如果有可用答案,将会返回社区ID和专题ID @@ -1413,20 +1413,20 @@ public interface ApiService { /** * 获取社区文章详情 */ - @GET("communities/{community_id}/articles/{article_id}?view=detail") - Observable getCommunityArticleDetail(@Path("community_id") String communityId, @Path("article_id") String articleId); + @GET("communities/articles/{article_id}?view=detail") + Observable getCommunityArticleDetail(@Path("article_id") String articleId); /** * 点赞社区文章 */ - @POST("communities/{community_id}/articles/{article_id}:vote") - Observable postCommunityArticleVote(@Path("community_id") String communityId, @Path("article_id") String articleId); + @POST("communities/articles/{article_id}:vote") + Observable postCommunityArticleVote(@Path("article_id") String articleId); /** * 取消点赞社区文章 */ - @POST("communities/{community_id}/articles/{article_id}:unvote") - Observable postCommunityArticleUnVote(@Path("community_id") String communityId, @Path("article_id") String articleId); + @POST("communities/articles/{article_id}:unvote") + Observable postCommunityArticleUnVote(@Path("article_id") String articleId); /** * 踩社区文章 @@ -1461,25 +1461,22 @@ public interface ApiService { /** * 收藏社区文章 */ - @POST("users/{user_id}/favorites/communities/{community_id}/articles/{article_id}") + @POST("users/{user_id}/favorites/communities/articles/{article_id}") Observable postCommunityArticleFavorites(@Path("user_id") String userId, - @Path("community_id") String communityId, @Path("article_id") String articleId); /** * 取消收藏社区文章 */ - @DELETE("users/{user_id}/favorites/communities/{community_id}/articles/{article_id}") + @DELETE("users/{user_id}/favorites/communities/articles/{article_id}") Observable deleteCommunityArticleFavorites(@Path("user_id") String userId, - @Path("community_id") String communityId, @Path("article_id") String articleId); /** * 获取社区文章评论列表.可以分页 */ - @GET("communities/{community_id}/articles/{article_id}/comments") - Observable> getCommunityArticleCommentList(@Path("community_id") String communityId, - @Path("article_id") String articleId, + @GET("communities/articles/{article_id}/comments") + Observable> getCommunityArticleCommentList(@Path("article_id") String articleId, @Query("sort") String type, @Query("page") int page, @QueryMap Map params); @@ -1515,9 +1512,8 @@ public interface ApiService { /** * 评论社区文章评论 */ - @POST("communities/{community_id}/articles/{article_id}/comments") - Observable postCommentToCommunityArticle(@Path("community_id") String communityId, - @Path("article_id") String articleId, + @POST("communities/articles/{article_id}/comments") + Observable postCommentToCommunityArticle(@Path("article_id") String articleId, @Body RequestBody body); /** @@ -1532,9 +1528,8 @@ public interface ApiService { /** * 对社区文章评论的点赞 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:vote") - Observable postVoteCommunityArticleComment(@Path("community_id") String communityId, - @Path("article_id") String articled, + @POST("communities/articles/{article_id}/comments/{comment_id}:vote") + Observable postVoteCommunityArticleComment(@Path("article_id") String articled, @Path("comment_id") String commentId); /** @@ -1738,33 +1733,33 @@ public interface ApiService { /** * 加精社区文章 */ - @POST("communities/{community_id}/articles/{article_id}:choiceness") - Observable highlightCommunityArticle(@Path("community_id") String communityId, @Path("article_id") String articleId); + @POST("communities/articles/{article_id}:choiceness") + Observable highlightCommunityArticle(@Path("article_id") String articleId); /** * 取消加精社区文章 */ - @POST("communities/{bbs_id}/articles/{article_id}:cancel_choiceness") - Observable cancelHighlightCommunityArticle(@Path("bbs_id") String bbsId, @Path("article_id") String articleId); + @POST("communities/articles/{article_id}:cancel_choiceness") + Observable cancelHighlightCommunityArticle(@Path("article_id") String articleId); /** * 隐藏社区文章 */ - @POST("communities/{community_id}/articles/{article_id}:hide") - Observable hideCommunityArticle(@Path("community_id") String communityId, @Path("article_id") String articleId); + @POST("communities/articles/{article_id}:hide") + Observable hideCommunityArticle(@Path("article_id") String articleId); /** * 置顶社区文章评论 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:set-top") - Observable highlightCommunityArticleComment(@Path("community_id") String communityId, @Path("article_id") String articleId, @Path("comment_id") String commendId); + @POST("communities/articles/{article_id}/comments/{comment_id}:set-top") + Observable highlightCommunityArticleComment(@Path("article_id") String articleId, @Path("comment_id") String commendId); /** * 隐藏社区文章评论 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:hide") - Observable hideCommunityArticleComment(@Path("community_id") String communityId, @Path("article_id") String articleId, @Path("comment_id") String commendId); + @POST("communities/articles/{article_id}/comments/{comment_id}:hide") + Observable hideCommunityArticleComment(@Path("article_id") String articleId, @Path("comment_id") String commendId); /** * 设置回答详情的的评论区域是否开启 @@ -2815,14 +2810,14 @@ public interface ApiService { /** * 置顶评论 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:set-top") - Observable postArticleCommentTop(@Path("community_id") String communityId, @Path("article_id") String articleId, @Path("comment_id") String commentId, @QueryMap Map params); + @POST("communities/articles/{article_id}/comments/{comment_id}:set-top") + Observable postArticleCommentTop(@Path("article_id") String articleId, @Path("comment_id") String commentId, @QueryMap Map params); /** * 取消置顶评论 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:unset-top") - Observable postArticleCommentUnTop(@Path("community_id") String communityId, @Path("article_id") String articleId, @Path("comment_id") String commentId); + @POST("communities/articles/{article_id}/comments/{comment_id}:unset-top") + Observable postArticleCommentUnTop(@Path("article_id") String articleId, @Path("comment_id") String commentId); /** * 获取推荐的论坛 @@ -3212,8 +3207,8 @@ public interface ApiService { /** * 版主修改社区文章活动标签 */ - @POST("communities/{community_id}/articles/{article_id}/activity_tags") - Observable modifyArticleActivityTag(@Path("community_id") String communityId, @Path("article_id") String articleId, @Body RequestBody body); + @POST("communities/articles/{article_id}/activity_tags") + Observable modifyArticleActivityTag(@Path("article_id") String articleId, @Body RequestBody body); /** * 版主修改视频帖活动标签 @@ -3528,8 +3523,8 @@ public interface ApiService { /** * 取消帖子评论点赞 */ - @POST("communities/{community_id}/articles/{article_id}/comments/{comment_id}:unvote") - Observable postUnVoteArticleComment(@Path("community_id") String communityId, @Path("article_id") String articleId, @Path("comment_id") String commentId); + @POST("communities/articles/{article_id}/comments/{comment_id}:unvote") + Observable postUnVoteArticleComment(@Path("article_id") String articleId, @Path("comment_id") String commentId); /** * 置顶视频评论