diff --git a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt index aaf3ec61b2..313c32972c 100644 --- a/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt +++ b/app/src/main/java/com/gh/gamecenter/gamecollection/square/GameCollectionSquareViewModel.kt @@ -48,27 +48,23 @@ class GameCollectionSquareViewModel(application: Application) : } override fun provideDataSingle(page: Int): Single> { - val paramsMap = if (view == "recommend") { - if (refreshCount == 0 && page == 1) { - if (selectedTagId.isNotEmpty()) { - mapOf("refresh" to "true", "tag_id" to selectedTagId, "random" to mRandomId) - } else { - mapOf("refresh" to "true", "random" to mRandomId) - } - } else { - mapOf("random" to mRandomId) - } - } else if (selectedTagId.isNotEmpty()) { - mapOf("tag_id" to selectedTagId) + val paramsMap = if (selectedTagId.isNotEmpty()) { + mutableMapOf("tag_id" to selectedTagId) } else { - mapOf() + mutableMapOf() + } + if (view == "recommend") { + paramsMap["random"] = mRandomId + if (refreshCount == 0 && page == 1) { + paramsMap["refresh"] = "true" + } } return RetrofitManager.getInstance() .api.getGameCollectionSquareList( view, page, PAGE_SIZE, - paramsMap + paramsMap.toMap() ) }