Authored by 胡古飞

fix searchLike page bug

... ... @@ -71,13 +71,13 @@ public class SearchLikeInShopServiceImpl implements ISearchLikeInShopService {
if (productInfoInEs == null) {
return new SearchApiResult().setCode(400).setMessage("SKN不存在");
}
// 3、检测分页参数
int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 60 : Integer.parseInt(paramMap.get("viewNum"));
// 3、检测分页参数[默认展示10条,最多展示60条]
int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 10 : Integer.parseInt(paramMap.get("viewNum"));
int page = StringUtils.isBlank(paramMap.get("page")) ? 1 : Integer.parseInt(paramMap.get("page"));
if (page < 1 || pageSize < 0) {
return new SearchApiResult().setCode(400).setMessage("分页参数不合法");
}
if (pageSize > 60 || pageSize < 10) {
if (pageSize > 60 || pageSize <= 0) {
pageSize = 60;
}
... ...
... ... @@ -72,13 +72,13 @@ public class SearchLikeServiceImpl implements ISearchLikeService {
if (productInfoInEs == null) {
return new SearchApiResult().setCode(400).setMessage("SKN不存在");
}
// 3、检测分页参数
int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 60 : Integer.parseInt(paramMap.get("viewNum"));
// 3、检测分页参数【默认30条,最多60条】
int pageSize = StringUtils.isBlank(paramMap.get("viewNum")) ? 30 : Integer.parseInt(paramMap.get("viewNum"));
int page = StringUtils.isBlank(paramMap.get("page")) ? 1 : Integer.parseInt(paramMap.get("page"));
if (page < 1 || pageSize < 0) {
return new SearchApiResult().setCode(400).setMessage("分页参数不合法");
}
if (pageSize > 60 || pageSize < 10) {
if (pageSize > 60 || pageSize <= 0) {
pageSize = 60;
}
... ... @@ -164,6 +164,9 @@ public class SearchLikeServiceImpl implements ISearchLikeService {
* @return
*/
private JSONArray getProductListNotInBrand(JSONObject productInfoInEs, Map<String, String> paramMap, List<String> notInProductSkns, int limit) {
if(limit<=0){
return new JSONArray();
}
SearchParam searchParam = new SearchParam();
// 1、构建Query
QueryBuilder queryBuilder = this.genQueryBuilder(productInfoInEs, paramMap, false);
... ...