Browse Source

Merge remote-tracking branch 'origin/release-201819-wangcz' into release-201819-wangcz

yujia 7 years ago
parent
commit
8de337549a

+ 12 - 0
src/main/java/com/uas/platform/b2c/common/search/controller/SearcherController.java

@@ -316,6 +316,9 @@ public class SearcherController {
 	@RequestMapping(value = "/201819", method = RequestMethod.GET, params = "type=component")
 	@ResponseBody
 	public ModelMap getCompGoodsBySearch(PageParams params, String keyword, HttpServletRequest request) {
+		if (StringUtils.isEmpty(keyword) || "*".equals(keyword)) {
+			return new ModelMap("total",0);
+		}
 		return searcherService.searchComponentGoods(keyword, params, request);
 	}
 
@@ -328,6 +331,9 @@ public class SearcherController {
 	@RequestMapping(value = "/201819", method = RequestMethod.GET, params = "type=kind")
 	@ResponseBody
 	public ModelMap getEnterpriseBySearchProduct(PageParams params, String keyword, HttpServletRequest request) {
+		if (StringUtils.isEmpty(keyword) || "*".equals(keyword)) {
+			return new ModelMap("total",0);
+		}
 		return searcherService.getEnterpriseBySearchKind(keyword, params);
 	}
 	/**
@@ -339,6 +345,9 @@ public class SearcherController {
 	@RequestMapping(value = "/201819", method = RequestMethod.GET, params = "type=store")
 	@ResponseBody
 	public ModelMap getEnterpriseBySearchStore(PageParams params, String keyword, HttpServletRequest request) {
+		if (StringUtils.isEmpty(keyword) || "*".equals(keyword)) {
+			return new ModelMap("total",0);
+		}
 		return searcherService.getEnterpriseBySearchStore(keyword, params, request);
 	}
 	/**
@@ -350,6 +359,9 @@ public class SearcherController {
 	@RequestMapping(value = "/201819", method = RequestMethod.GET, params = "type=brand")
 	@ResponseBody
 	public ModelMap getEnterpriseBySearchBrand(PageParams params, String keyword, HttpServletRequest request) {
+		if (StringUtils.isEmpty(keyword) || "*".equals(keyword)) {
+			return new ModelMap("total",0);
+		}
 		return searcherService.getEnterpriseBySearchBrand(keyword, params);
 	}
 

+ 3 - 1
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -257,7 +257,7 @@ define([ 'app/app' ], function(app) {
 	}]);
 
 	// 搜索框Ctrl
-	app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', function($scope, $http, $rootScope, SessionService) {
+	app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', 'toaster', function($scope, $http, $rootScope, SessionService, toaster) {
         // 默认搜索类型
         $scope.searchType = 'component';
         $scope.placeholderSearch = '请输入型号';
@@ -283,6 +283,8 @@ define([ 'app/app' ], function(app) {
                 SessionService.set('brand', true);
                 SessionService.unset('component');
                 window.location.href = 'search?w=' + encodeURI($scope.keyword) + '&type=' + $scope.searchType;
+            } else {
+              toaster.pop("info", "请输入关键字");
             }
         };