|
|
@ -14,7 +14,6 @@ import com.fr.general.http.HttpToolbox; |
|
|
|
import com.fr.json.JSONArray; |
|
|
|
import com.fr.json.JSONArray; |
|
|
|
import com.fr.json.JSONException; |
|
|
|
import com.fr.json.JSONException; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONTokener; |
|
|
|
|
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.CodeUtils; |
|
|
|
import com.fr.stable.CodeUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
@ -61,19 +60,16 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { |
|
|
|
try { |
|
|
|
try { |
|
|
|
String result = HttpToolbox.get(AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j])); |
|
|
|
String result = HttpToolbox.get(AlphaFineConstants.SEARCH_API + CodeUtils.cjkEncode(searchText[j])); |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
Object json = new JSONTokener(result).nextValue(); |
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
if (json instanceof JSONObject) { |
|
|
|
if (jsonObject.optString("status").equals("success")) { |
|
|
|
JSONObject jsonObject = new JSONObject(result); |
|
|
|
JSONArray jsonArray = jsonObject.optJSONArray("result"); |
|
|
|
if (jsonObject.optString("status").equals("success")) { |
|
|
|
if (jsonArray != null && jsonArray.length() > 0) { |
|
|
|
JSONArray jsonArray = jsonObject.optJSONArray("result"); |
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
if (jsonArray != null && jsonArray.length() > 0) { |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
for (int i = 0; i < jsonArray.length(); i++) { |
|
|
|
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); |
|
|
|
AlphaFineHelper.checkCancel(); |
|
|
|
if (alphaCellModel != null && !alreadyContain(alphaCellModel)) { |
|
|
|
AlphaCellModel alphaCellModel = CellModelHelper.getModelFromJson((JSONObject) jsonArray.get(i)); |
|
|
|
|
|
|
|
if (alphaCellModel != null && !alreadyContain(alphaCellModel)) { |
|
|
|
this.recommendModelList.add(alphaCellModel); |
|
|
|
|
|
|
|
|
|
|
|
this.recommendModelList.add(alphaCellModel); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -94,6 +90,7 @@ public class RecommendSearchManager implements AlphaFineSearchProvider { |
|
|
|
} |
|
|
|
} |
|
|
|
complementAdviceModelList = ComplementAdviceManager.getInstance().getAllSearchResult(searchText); |
|
|
|
complementAdviceModelList = ComplementAdviceManager.getInstance().getAllSearchResult(searchText); |
|
|
|
moreModelList.clear(); |
|
|
|
moreModelList.clear(); |
|
|
|
|
|
|
|
|
|
|
|
if (recommendModelList.size() > 0) { |
|
|
|
if (recommendModelList.size() > 0) { |
|
|
|
if (complementAdviceModelList.size() == 0) { |
|
|
|
if (complementAdviceModelList.size() == 0) { |
|
|
|
if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE - 2) { |
|
|
|
if (recommendModelList.size() > AlphaFineConstants.SHOW_SIZE - 2) { |
|
|
|