| | |
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | private DaTaoKeGoodsDetailService daTaoKeGoodsDetailService;
|
| | |
|
| | | /**
|
| | | * 搜索候选词
|
| | | * |
| | | * @param acceptData
|
| | | * @param kw
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "suggestSearch", method = RequestMethod.POST)
|
| | | public void getSugguestSearch(AcceptData acceptData, String kw, Integer goodsType, PrintWriter out) {
|
| | | if (goodsType == null) {
|
| | | out.print(JsonUtil.loadFalseResult("平台类型不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<String> list = null;
|
| | | if (goodsType == Constant.SOURCE_TYPE_TAOBAO) {
|
| | | list = TaoBaoUtil.getSuguestSearch(kw);
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_JD) {
|
| | |
|
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) {
|
| | |
|
| | | }
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无建议内容"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | for (String words : list) {
|
| | | array.add(words);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(array));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 搜索-新版
|
| | | *
|
| | | * @param acceptData
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 拼多多商品 TODO
|
| | | if (goodsType.intValue() == Constant.SOURCE_TYPE_PDD) {
|
| | | // 拼多多商品 TODO
|
| | | searchPDDGoods(kw, page, filter, order, startprice, endprice, out);
|
| | | return;
|
| | | }
|
| | |
| | | // 获取推荐词
|
| | | List<String> listRecommendWords = new ArrayList<String>();
|
| | | // 综合 查询第一页时获取候选词
|
| | | if (page == 0) {
|
| | | if (page == 1) {
|
| | | listRecommendWords = TaoBaoUtil.getSuguestSearch(kw);
|
| | | if (listRecommendWords == null || listRecommendWords.size() == 0) {
|
| | | listRecommendWords = new ArrayList<String>();
|
| | |
| | | */
|
| | | private JSONObject searchDaTaoKeGoods(String key, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | | page = page + 1;
|
| | | int sort = DaTaoKeApiUtil.SORT_DEFAULT;
|
| | | if ("5".equalsIgnoreCase(order)) {
|
| | | sort = DaTaoKeApiUtil.SORT_COMMISSION;
|
| | |
| | | jdfilter.setSortName(JDSearchFilter.SORTNAME_COMMISSION_SHARE);
|
| | | break;
|
| | | default: // 默认:销量 desc
|
| | | //jdfilter.setSort(JDSearchFilter.SORT_DESC);
|
| | | //jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | // jdfilter.setSort(JDSearchFilter.SORT_DESC);
|
| | | // jdfilter.setSortName(JDSearchFilter.SORTNAME_ORDER_COUNT_30DAYS);
|
| | | break;
|
| | | }
|
| | |
|