|
|
@@ -24219,44 +24219,20 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
|
|
|
*/
|
|
|
app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', 'AccountEnterprise', function($scope, $http, $rootScope, SessionService, AccountEnterprise) {
|
|
|
$scope.hotwords = new Array();
|
|
|
- var hasBrand = false;
|
|
|
- var hasComponent = false;
|
|
|
|
|
|
- // 热词搜索品牌
|
|
|
- var hotBrand = function () {
|
|
|
- $http.get($scope.toB2cLink + '/api/product/brand/mostSearchBrands'
|
|
|
+ // 热词搜索
|
|
|
+ var hotSearchList = function () {
|
|
|
+ $http.get('https://mall.usoftchina.com/cmsApi?method=queryContentPage&module=index_hotModels&orderBy=order_number%20ASC'
|
|
|
).success(function(data){
|
|
|
- hasBrand = true;
|
|
|
-
|
|
|
- angular.forEach(data, function (value) {
|
|
|
- $scope.hotwords.push({name: value.nameEn, url: $scope.toB2cLink + '/search?w='+ value.nameEn +'&type=brand'})
|
|
|
- })
|
|
|
- if (hasBrand) {
|
|
|
- hotComponent();
|
|
|
- }
|
|
|
- }).error(function(response) {
|
|
|
- console.log(response)
|
|
|
- });
|
|
|
- };
|
|
|
-
|
|
|
- // 热词搜索器件
|
|
|
- var hotComponent = function () {
|
|
|
- $http.get($scope.toB2cLink + '/api/product/component/mostSearchComponent'
|
|
|
- ).success(function(data){
|
|
|
- hasComponent = true;
|
|
|
- if (hasBrand && hasComponent) {
|
|
|
- angular.forEach(data, function (value) {
|
|
|
- $scope.hotwords.push({name: value.code, url: $scope.toB2cLink + '/search?w='+ value.code +'&type=component'})
|
|
|
- })
|
|
|
- }
|
|
|
+ $scope.hotwords = data.data
|
|
|
}).error(function(response) {
|
|
|
console.log(response)
|
|
|
});
|
|
|
};
|
|
|
|
|
|
AccountEnterprise.getB2cUrl({}, function(data) {
|
|
|
- $scope.toB2cLink = data.url
|
|
|
- hotBrand();
|
|
|
+ $scope.toB2cLink = data.url;
|
|
|
+ hotSearchList();
|
|
|
});
|
|
|
|
|
|
// 默认搜索类型
|