Commit 5105a007 by 霍志良

feat:热门词修改

parent 8f8a4292
......@@ -15,6 +15,8 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydl_router.manager.YDLRouterParams
import com.ydl.ydlcommon.base.BaseMvpActivity
......@@ -100,15 +102,20 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
// 搜索的关联词
var relatedWords = ""
var isRecommendWords = false
if (searchSuggestList.isNotEmpty()&&searchSuggestList.size>0){
if (searchSuggestList[0].suggest_relations.size>0){
if (searchSuggestList.isNotEmpty()&&searchSuggestList.size>0) {
if (searchSuggestList[0].suggest_relations.size > 0) {
relatedWords = searchSuggestList[0].suggest_relations[0]
isRecommendWords = true
}
if (TextUtils.isEmpty(relatedWords)&&!TextUtils.isEmpty(searchSuggestList[0].suggest_content)){
if (TextUtils.isEmpty(relatedWords) && !TextUtils.isEmpty(searchSuggestList[0].suggest_content)) {
relatedWords = searchSuggestList[0].suggest_content
}
doSearch(etSearch.text.toString(),relatedWords,isRecommendWords)
if (searchSuggestList?.get(0)?.suggest_types?.contains("jump_word")) {
NewH5Activity.start(this, H5Params(searchSuggestList[0].jump_url!!, null))
} else {
doSearch(etSearch.text.toString(), relatedWords, isRecommendWords)
}
}else{
val searchWords = etSearch.text.toString()
if (TextUtils.isEmpty(searchWords)){
......@@ -150,19 +157,33 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
// 搜索的关联词
var relatedWords = ""
var isRecommendWords = false
if (searchSuggestList.isNotEmpty()&&searchSuggestList.size>0){
if (searchSuggestList[position].suggest_relations.size>0){
if (searchSuggestList.isNotEmpty() && searchSuggestList.size > 0) {
if (searchSuggestList[position].suggest_relations.size > 0) {
relatedWords = searchSuggestList[position].suggest_relations[0]
isRecommendWords = true
}
if (TextUtils.isEmpty(relatedWords)&&!TextUtils.isEmpty(searchSuggestList[position].suggest_content)){
if (TextUtils.isEmpty(relatedWords) && !TextUtils.isEmpty(searchSuggestList[position].suggest_content)) {
relatedWords = searchSuggestList[position].suggest_content
}
}
doSearch(searchSuggestList[position].suggest_content,relatedWords,isRecommendWords)
if (searchSuggestList[position].suggest_types?.contains("jump_word")) {
NewH5Activity.start(this, H5Params(searchSuggestList[position].jump_url!!, null))
} else {
doSearch(
searchSuggestList[position].suggest_content,
relatedWords,
isRecommendWords
)
}
// 埋点
ActionCountUtils.baiDuCountSign3(ConsultBIConstants.PART_ID_YDL_USER_MAIN_PAGE,ConsultBIConstants.POSITION_YDL_USER_ASSOCIATE_WORD_CLICK,etSearch.text.toString(),searchSuggestList[position].suggest_content,"app")
ActionCountUtils.baiDuCountSign3(
ConsultBIConstants.PART_ID_YDL_USER_MAIN_PAGE,
ConsultBIConstants.POSITION_YDL_USER_ASSOCIATE_WORD_CLICK,
etSearch.text.toString(),
searchSuggestList[position].suggest_content,
"app"
)
}
etSearch.addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {
......@@ -204,19 +225,30 @@ class HotSearchActivity : BaseMvpActivity<IHotSearchContract.View, IHotSearchCon
override fun getSearchWordsSuccess(searchWordsBean: SearchWordsBean,searchContent:String,isClickWords:Boolean) {
if (isClickWords){
//判断 suggest_classify_types 有值则通过 jump_url跳转
// 搜索的关联词
var relatedWords = ""
var isRecommendWords = false
if (!searchWordsBean.search_suggests.isNullOrEmpty()&&searchWordsBean.search_suggests.size>0){
if (searchWordsBean.search_suggests[0].suggest_relations.size>0){
if (!searchWordsBean.search_suggests.isNullOrEmpty() && searchWordsBean.search_suggests.size > 0) {
if (searchWordsBean.search_suggests[0].suggest_relations.size > 0) {
relatedWords = searchWordsBean.search_suggests[0].suggest_relations[0]
isRecommendWords = true
}
if (TextUtils.isEmpty(relatedWords)&&!TextUtils.isEmpty(searchWordsBean.search_suggests[0].suggest_content)){
if (TextUtils.isEmpty(relatedWords) && !TextUtils.isEmpty(searchWordsBean.search_suggests[0].suggest_content)) {
relatedWords = searchWordsBean.search_suggests[0].suggest_content
}
}
doSearch(searchContent,relatedWords,isRecommendWords)
if (!searchWordsBean.search_suggests.isNullOrEmpty() && searchWordsBean.search_suggests?.get(
0
)?.suggest_types?.contains("jump_word")
) {
NewH5Activity.start(
this,
H5Params(searchWordsBean.search_suggests[0].jump_url!!, null)
)
} else {
doSearch(searchContent, relatedWords, isRecommendWords)
}
}else{
searchSuggestList.clear()
if (!searchWordsBean.search_suggests.isNullOrEmpty()){
......
......@@ -8,11 +8,13 @@ data class SearchWordsBean(
)
data class SearchSuggestListBean(
val id:String,
val score:String,
val suggest_content:String,
val suggest_relations:ArrayList<String>,
val id: String,
val score: String,
val suggest_content: String,
val suggest_relations: ArrayList<String>,
val search_count: Int,
val suggest_classify_types:ArrayList<String>,
val mapping_classify_type_exist:Boolean
val suggest_classify_types: ArrayList<String>?,
val mapping_classify_type_exist: Boolean,
val jump_url: String?,
val suggest_types: ArrayList<String>
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment