谷粒商城-分布式高级篇_01
谷粒商城高级篇: 检索

前言

进入谷粒商城-分布式高级篇

本文内容:

  1. Elasticsearch(以前也用过也写过相关的文章,不过版本是6.x的)

    参考文章:

  2. 商品上架

  3. 商品检索

    商品检索本不在当前章节,只是为了后期阅读连贯性所以将商品检索部分的笔记也放在了这儿

  4. 首页域名访问,使用Thymeleaf加载分类数据(基本使用也不做详细笔记了,也写过相关文章)

    参考文章:

  5. 压力测试(省略)

Elasticsearch

安装

  1. 下载Elasticsearch镜像

    1
    docker pull elasticsearch:7.6.2
  2. 准备挂载容器数据与配置的文件夹

    1
    2
    3
    4
    mkdir -p /mydata/elasticsearch/config
    mkdir -p /mydata/elasticsearch/data
    echo "http.host: 0.0.0.0" >/mydata/elasticsearch/config/elasticsearch.yml
    chmod -R 777 /mydata/elasticsearch/
  3. 创建容器

    1
    2
    3
    4
    5
    6
    7
    docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
    -e "discovery.type=single-node" \
    -e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
    -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
    -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
    -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
    -d elasticsearch:7.6.2
  4. 设置开机自启动

    1
    docker update elasticsearch --restart=always
  5. 安装Kibana

    1
    2
    3
    4
    5
    6
    # 下载Kibana镜像
    docker pull kibana:7.6.2
    # 启动Kibana容器
    docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.149.151:9200 -p 5601:5601 -d kibana:7.6.2
    # 设置开机自启动
    docker update kibana --restart=always
  6. 安装ik分词器(省略)

Elasticsearch-Rest-Client

6.x的版本建议使用Spring Data Elasticsearch,封装的还是比较简单易用的。

更高版本建议使用Elasticsearch-Rest-Client

详细操作参考官方文档:Elasticsearch-Rest-Client文档

创建Maven项目

  1. 依赖

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.imxushuai.gulimall</groupId>
    <artifactId>gulimall-search</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>gulimall-search</name>
    <description>谷粒商城-搜索服务</description>
    <properties>
    <java.version>1.8</java.version>
    <spring-cloud.version>Greenwich.SR5</spring-cloud.version>
    <elasticsearch.version>7.6.2</elasticsearch.version>
    </properties>
    <dependencies>
    <dependency>
    <groupId>com.imxushuai.gulimall</groupId>
    <artifactId>gulimall-common</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <exclusions>
    <exclusion>
    <groupId>com.baomidou</groupId>
    <artifactId>mybatis-plus-boot-starter</artifactId>
    </exclusion>
    </exclusions>
    </dependency>

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
    </dependency>

    <dependency>
    <groupId>org.elasticsearch.client</groupId>
    <artifactId>elasticsearch-rest-high-level-client</artifactId>
    <version>${elasticsearch.version}</version>
    </dependency>
    </dependencies>

    <build>
    <plugins>
    <plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    </plugins>
    </build>

    </project>
  2. 启动类

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    package com.imxushuai.gulimall.search;

    import org.springframework.boot.SpringApplication;
    import org.springframework.boot.autoconfigure.SpringBootApplication;
    import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

    @EnableDiscoveryClient
    @SpringBootApplication
    public class GulimallSearchApplication {

    public static void main(String[] args) {
    SpringApplication.run(GulimallSearchApplication.class, args);
    }

    }
  3. 配置Rest-Client

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    package com.imxushuai.gulimall.search.config;

    import org.apache.http.HttpHost;
    import org.elasticsearch.client.RestClient;
    import org.elasticsearch.client.RestHighLevelClient;
    import org.springframework.context.annotation.Bean;
    import org.springframework.context.annotation.Configuration;

    @Configuration
    public class ElasticsearchConfiguration {

    @Bean
    public RestHighLevelClient esRestClient() {
    return new RestHighLevelClient(
    RestClient.builder(new HttpHost("192.168.149.151", 9200))
    );
    }

    }

商品上架

商品上架流程:

  1. 页面发起上架请求到商品微服务
  2. 组装数据
    1. 查询要上架的所有SKU
    2. 查询所有的SKU是否有库存
    3. 查询所有可以用来检索的规格属性
    4. 查询分类以及品牌数据
    5. 把所有数据组装
  3. 远程调用搜索微服务,搜索微服务将数据存入Elasticsearch

ES中的商品映射

我这里的mapping和视频的略有区别

brandName,categoryName,brandImg以及attrName我都允许索引

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PUT product
{
"mappings": {
"properties": {
"skuId": {
"type": "long"
},
"spuId": {
"type": "keyword"
},
"skuTitle": {
"type": "text",
"analyzer": "ik_smart"
},
"skuPrice": {
"type": "keyword"
},
"skuImg": {
"type": "keyword",
"index": false,
"doc_values": false
},
"saleCount": {
"type": "long"
},
"hasStock": {
"type": "boolean"
},
"hotScore": {
"type": "long"
},
"brandId": {
"type": "long"
},
"catalogId": {
"type": "long"
},
"brandName": {
"type": "keyword"
},
"brandImg": {
"type": "keyword"
},
"catalogName": {
"type": "keyword"
},
"attrs": {
"type": "nested",
"properties": {
"attrId": {
"type": "long"
},
"attrName": {
"type": "keyword"
},
"attrValue": {
"type": "keyword"
}
}
}
}
}
}

关键代码

下面只列出关键代码,完整代码在文末的获取代码处。

  1. 【商品微服务】上架的API

    1
    2
    3
    4
    5
    6
    7
    8
    /**
    * 商品上架
    */
    @PostMapping("/{spuId}/up")
    public R up(@PathVariable("spuId") Long spuId){
    spuInfoService.up(spuId);
    return R.ok();
    }
  2. 【商品微服务】上架的Service

    组装数据后调用搜索微服务将数据存入Elasticsearch

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    public void up(Long spuId) {
    // 1 组装数据 查出当前spuId对应的所有sku信息
    List<SkuInfoEntity> skus = skuInfoService.getSkusBySpuId(spuId);
    // 查询这些sku是否有库存
    List<Long> skuids = skus.stream().map(SkuInfoEntity::getSkuId).collect(Collectors.toList());
    // 2 封装每个sku的信息

    // 3.查询当前sku所有可以被用来检索的规格属性
    List<ProductAttrValueEntity> baseAttrs = attrValueService.baseAttrListForSpu(spuId);
    // 得到基本属性id
    List<Long> attrIds = baseAttrs.stream().map(ProductAttrValueEntity::getAttrId).collect(Collectors.toList());
    // 过滤出可被检索的基本属性id,即search_type = 1 [数据库中目前 4、5、6、11不可检索]
    Set<Long> ids = new HashSet<>(attrService.selectSearchAttrIds(attrIds));
    // 可被检索的属性封装到SkuEsModel.Attrs中
    List<SkuEsModel.Attrs> attrs = baseAttrs.stream()
    .filter(item -> ids.contains(item.getAttrId()))
    .map(item -> {
    SkuEsModel.Attrs attr = new SkuEsModel.Attrs();
    BeanUtils.copyProperties(item, attr);
    return attr;
    }).collect(Collectors.toList());
    // 每件skuId是否有库存
    Map<Long, Boolean> stockMap = null;
    try {
    // 3.1 远程调用库存系统 查询该sku是否有库存
    R hasStock = wareFeignService.getSkuHasStock(skuids);
    // 构造器受保护 所以写成内部类对象
    stockMap = hasStock.getData(new TypeReference<List<SkuHasStockVo>>() {})
    .stream()
    .collect(Collectors.toMap(SkuHasStockVo::getSkuId, SkuHasStockVo::getHasStock));
    log.warn("服务调用成功" + hasStock);
    } catch (Exception e) {
    log.error("库存服务调用失败: 原因{}", e);
    }

    Map<Long, Boolean> finalStockMap = stockMap;//防止lambda中改变
    // 开始封装es
    List<SkuEsModel> skuEsModels = skus.stream().map(sku -> {
    SkuEsModel esModel = new SkuEsModel();
    BeanUtils.copyProperties(sku, esModel);
    esModel.setSkuPrice(sku.getPrice());
    esModel.setSkuImg(sku.getSkuDefaultImg());
    // 4 设置库存,只查是否有库存,不查有多少
    if (finalStockMap == null) {
    esModel.setHasStock(true);
    } else {
    esModel.setHasStock(finalStockMap.get(sku.getSkuId()));
    }
    // TODO 1.热度评分 刚上架是0
    esModel.setHotScore(0L);
    // 设置品牌信息
    BrandEntity brandEntity = brandService.getById(esModel.getBrandId());
    esModel.setBrandName(brandEntity.getName());
    esModel.setBrandImg(brandEntity.getLogo());

    // 查询分类信息
    CategoryEntity categoryEntity = categoryService.getById(esModel.getCatalogId());
    esModel.setCatalogName(categoryEntity.getName());

    // 保存商品的属性, 查询当前sku的所有可以被用来检索的规格属性,同一spu都一样,在外面查一遍即可
    esModel.setAttrs(attrs);
    return esModel;
    }).collect(Collectors.toList());

    // 5.发给ES进行保存 gulimall-search
    R r = searchFeignService.productStatusUp(skuEsModels);
    if (r.getCode() == 0) {
    // 远程调用成功
    baseMapper.updateSpuStatus(spuId, ProductConstant.StatusEnum.SPU_UP.getCode());
    } else {
    // 远程调用失败 TODO 接口幂等性 重试机制
    /**
    * Feign 的调用流程 Feign有自动重试机制
    * 1. 发送请求执行
    * 2.
    */
    }
    }
  3. 【搜索微服务】保存数据到Elasticsearch的API

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    package com.imxushuai.gulimall.search.controller;

    import com.imxushuai.common.exception.BizCodeEnum;
    import com.imxushuai.common.to.es.SkuEsModel;
    import com.imxushuai.common.utils.R;
    import com.imxushuai.gulimall.search.service.ProductSaveService;
    import lombok.extern.slf4j.Slf4j;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.PostMapping;
    import org.springframework.web.bind.annotation.RequestBody;
    import org.springframework.web.bind.annotation.RequestMapping;
    import org.springframework.web.bind.annotation.RestController;

    import java.io.IOException;
    import java.util.List;

    @Slf4j
    @RestController
    @RequestMapping("/search/save")
    public class ElasticSaveController {

    @Autowired
    private ProductSaveService productSaveService;

    /**
    * 上架商品
    */
    @PostMapping("/product")
    public R productStatusUp(@RequestBody List<SkuEsModel> skuEsModels){

    boolean status;
    try {
    status = productSaveService.productStatusUp(skuEsModels);
    } catch (IOException e) {
    log.error("ElasticSaveController商品上架错误: ", e);
    return R.error(BizCodeEnum.PRODUCT_UP_EXCEPTION.getCode(), BizCodeEnum.PRODUCT_UP_EXCEPTION.getMsg());
    }
    if(!status){
    return R.ok();
    }
    return R.error(BizCodeEnum.PRODUCT_UP_EXCEPTION.getCode(), BizCodeEnum.PRODUCT_UP_EXCEPTION.getMsg());
    }

    }
  4. 【搜索微服务】保存数据到Elasticsearch的Service

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    package com.imxushuai.gulimall.search.service.impl;

    import com.alibaba.fastjson.JSON;
    import com.imxushuai.common.to.es.SkuEsModel;
    import com.imxushuai.gulimall.search.config.ElasticsearchConfiguration;
    import com.imxushuai.gulimall.search.constant.EsConstant;
    import com.imxushuai.gulimall.search.service.ProductSaveService;
    import lombok.extern.slf4j.Slf4j;
    import org.elasticsearch.action.bulk.BulkItemResponse;
    import org.elasticsearch.action.bulk.BulkRequest;
    import org.elasticsearch.action.bulk.BulkResponse;
    import org.elasticsearch.action.index.IndexRequest;
    import org.elasticsearch.client.RestHighLevelClient;
    import org.elasticsearch.common.xcontent.XContentType;
    import org.springframework.stereotype.Service;

    import javax.annotation.Resource;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.List;
    import java.util.stream.Collectors;

    @Slf4j
    @Service
    public class ProductSaveServiceImpl implements ProductSaveService {

    @Resource
    private RestHighLevelClient client;

    /**
    * 将数据保存到ES
    * 用bulk代替index,进行批量保存
    * BulkRequest bulkRequest, RequestOptions options
    */
    @Override
    public boolean productStatusUp(List<SkuEsModel> skuEsModels) throws IOException {
    // 1. 批量保存
    BulkRequest bulkRequest = new BulkRequest();
    // 2.构造保存请求
    for (SkuEsModel esModel : skuEsModels) {
    // 设置es索引 gulimall_product
    IndexRequest indexRequest = new IndexRequest(EsConstant.PRODUCT_INDEX);
    // 设置索引id
    indexRequest.id(esModel.getSkuId().toString());
    // json格式
    String jsonString = JSON.toJSONString(esModel);
    indexRequest.source(jsonString, XContentType.JSON);
    // 添加到文档
    bulkRequest.add(indexRequest);
    }
    // bulk批量保存
    BulkResponse bulk = client.bulk(bulkRequest, ElasticsearchConfiguration.COMMON_OPTIONS);
    // 是否拥有错误
    boolean hasFailures = bulk.hasFailures();
    if(hasFailures){
    List<String> collect = Arrays.stream(bulk.getItems())
    .filter(BulkItemResponse::isFailed)
    .map(BulkItemResponse::getId)
    .collect(Collectors.toList());
    log.error("商品上架错误:{}",collect);
    }
    return hasFailures;
    }
    }

商品检索

商品检索流程:

  1. 检索请求搜索微服务
  2. 构造搜索请求
    1. 模糊查询属性、分类、品牌、价格区间、库存
    2. 排序、分页
    3. 高亮
    4. 聚合分析
  3. 使用搜索请求调用Elasticsearch查询并获取到结果
  4. 将获取到的结果封装成想要的结构返回
  5. 使用返回的数据渲染到模板(使用Thymeleaf作为模板引擎)

关键代码

  1. 【搜索微服务】检索API

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    package com.imxushuai.gulimall.search.controller;

    import com.imxushuai.gulimall.search.service.SearchService;
    import com.imxushuai.gulimall.search.vo.SearchParam;
    import com.imxushuai.gulimall.search.vo.SearchResult;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Controller;
    import org.springframework.ui.Model;
    import org.springframework.web.bind.annotation.GetMapping;

    import javax.servlet.http.HttpServletRequest;

    @Controller
    public class SearchController {

    @Autowired
    private SearchService searchService;

    @GetMapping("/list.html")
    public String listPage(SearchParam searchParam, Model model, HttpServletRequest request){

    // 获取路径原生的查询属性
    searchParam.set_queryString(request.getQueryString());
    // ES中检索到的结果 传递给页面
    SearchResult result = searchService.search(searchParam);
    model.addAttribute("result", result);
    return "list";
    }
    }
  2. 【搜索微服务】检索的Service

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    package com.imxushuai.gulimall.search.service.impl;

    import com.alibaba.fastjson.JSON;
    import com.alibaba.fastjson.TypeReference;
    import com.imxushuai.common.to.es.SkuEsModel;
    import com.imxushuai.common.utils.R;
    import com.imxushuai.gulimall.search.config.ElasticsearchConfiguration;
    import com.imxushuai.gulimall.search.constant.EsConstant;
    import com.imxushuai.gulimall.search.feign.ProductFeignService;
    import com.imxushuai.gulimall.search.service.SearchService;
    import com.imxushuai.gulimall.search.vo.AttrResponseVo;
    import com.imxushuai.gulimall.search.vo.BrandVo;
    import com.imxushuai.gulimall.search.vo.SearchParam;
    import com.imxushuai.gulimall.search.vo.SearchResult;
    import lombok.extern.slf4j.Slf4j;
    import org.apache.commons.lang3.StringUtils;
    import org.apache.lucene.search.join.ScoreMode;
    import org.elasticsearch.action.search.SearchRequest;
    import org.elasticsearch.action.search.SearchResponse;
    import org.elasticsearch.client.RestHighLevelClient;
    import org.elasticsearch.index.query.BoolQueryBuilder;
    import org.elasticsearch.index.query.NestedQueryBuilder;
    import org.elasticsearch.index.query.QueryBuilders;
    import org.elasticsearch.index.query.RangeQueryBuilder;
    import org.elasticsearch.search.SearchHit;
    import org.elasticsearch.search.SearchHits;
    import org.elasticsearch.search.aggregations.AggregationBuilders;
    import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregationBuilder;
    import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested;
    import org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms;
    import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
    import org.elasticsearch.search.aggregations.bucket.terms.Terms;
    import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder;
    import org.elasticsearch.search.builder.SearchSourceBuilder;
    import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
    import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
    import org.elasticsearch.search.sort.SortOrder;
    import org.springframework.stereotype.Service;

    import javax.annotation.Resource;
    import java.io.IOException;
    import java.io.UnsupportedEncodingException;
    import java.net.URLEncoder;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.stream.Collectors;

    @Slf4j
    @Service
    public class SearchServiceImpl implements SearchService {

    @Resource
    private RestHighLevelClient restHighLevelClient;

    @Resource
    private ProductFeignService productFeignService;

    @Override
    public SearchResult search(SearchParam Param) {

    SearchResult result = null;
    // 1.准备检索请求
    SearchRequest searchRequest = buildSearchRequest(Param);
    try {
    // 2.执行检索请求
    SearchResponse response = restHighLevelClient.search(searchRequest, ElasticsearchConfiguration.COMMON_OPTIONS);

    // 3.分析响应数据
    result = buildSearchResult(response, Param);
    } catch (IOException e) {
    e.printStackTrace();
    }
    return result;
    }

    /**
    * 准备检索请求 [构建查询语句]
    */
    private SearchRequest buildSearchRequest(SearchParam param) {
    // 帮我们构建DSL语句的
    SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
    // 1. 模糊匹配 过滤(按照属性、分类、品牌、价格区间、库存) 先构建一个布尔Query
    // 1.1 must
    BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
    if(!StringUtils.isEmpty(param.getKeyword())){
    boolQuery.must(QueryBuilders.matchQuery("skuTitle",param.getKeyword()));
    }
    // 1.2 bool - filter Catalog3Id
    if(param.getCatalog3Id() != null){
    boolQuery.filter(QueryBuilders.termQuery("catalogId", param.getCatalog3Id()));
    }
    // 1.2 bool - brandId [集合]
    if(param.getBrandId() != null && param.getBrandId().size() > 0){
    boolQuery.filter(QueryBuilders.termsQuery("brandId", param.getBrandId()));
    }
    // 属性查询
    if(param.getAttrs() != null && param.getAttrs().size() > 0){

    for (String attrStr : param.getAttrs()) {
    BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
    String[] s = attrStr.split("_");
    // 检索的id 属性检索用的值
    String attrId = s[0];
    String[] attrValue = s[1].split(":");
    boolQueryBuilder.must(QueryBuilders.termQuery("attrs.attrId", attrId));
    boolQueryBuilder.must(QueryBuilders.termsQuery("attrs.attrValue", attrValue));
    // 构建一个嵌入式Query 每一个必须都得生成嵌入的 nested 查询
    NestedQueryBuilder attrsQuery = QueryBuilders.nestedQuery("attrs", boolQueryBuilder, ScoreMode.None);
    boolQuery.filter(attrsQuery);
    }
    }
    // 1.2 bool - filter [库存]
    if(param.getHasStock() != null){
    boolQuery.filter(QueryBuilders.termQuery("hasStock",param.getHasStock() == 1));
    }
    // 1.2 bool - filter [价格区间]
    if(!StringUtils.isEmpty(param.getSkuPrice())){
    RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("skuPrice");
    String[] s = param.getSkuPrice().split("_");
    if(s.length == 2){
    // 有三个值 就是区间
    rangeQuery.gte(s[0]).lte(s[1]);
    }else if(s.length == 1){
    // 单值情况
    if(param.getSkuPrice().startsWith("_")){
    rangeQuery.lte(s[0]);
    }
    if(param.getSkuPrice().endsWith("_")){
    rangeQuery.gte(s[0]);
    }
    }
    boolQuery.filter(rangeQuery);
    }

    // 把以前所有条件都拿来进行封装
    sourceBuilder.query(boolQuery);

    // 1.排序
    if(!StringUtils.isEmpty(param.getSort())){
    String sort = param.getSort();
    // sort=hotScore_asc/desc
    String[] s = sort.split("_");
    SortOrder order = s[1].equalsIgnoreCase("asc") ? SortOrder.ASC : SortOrder.DESC;
    sourceBuilder.sort(s[0], order);
    }
    // 2.分页 pageSize : 5
    sourceBuilder.from((param.getPageNum()-1) * EsConstant.PRODUCT_PASIZE);
    sourceBuilder.size(EsConstant.PRODUCT_PASIZE);

    // 3.高亮
    if(!StringUtils.isEmpty(param.getKeyword())){
    HighlightBuilder builder = new HighlightBuilder();
    builder.field("skuTitle");
    builder.preTags("<b style='color:red'>");
    builder.postTags("</b>");
    sourceBuilder.highlighter(builder);
    }
    // 聚合分析
    // 1.品牌聚合
    TermsAggregationBuilder brand_agg = AggregationBuilders.terms("brand_agg");
    brand_agg.field("brandId").size(50);
    // 品牌聚合的子聚合
    brand_agg.subAggregation(AggregationBuilders.terms("brand_name_agg").field("brandName").size(1));
    brand_agg.subAggregation(AggregationBuilders.terms("brand_img_agg").field("brandImg").size(1));
    // 将品牌聚合加入 sourceBuilder
    sourceBuilder.aggregation(brand_agg);
    // 2.分类聚合
    TermsAggregationBuilder catalog_agg = AggregationBuilders.terms("catalog_agg").field("catalogId").size(20);
    catalog_agg.subAggregation(AggregationBuilders.terms("catalog_name_agg").field("catalogName").size(1));
    // 将分类聚合加入 sourceBuilder
    sourceBuilder.aggregation(catalog_agg);
    // 3.属性聚合 attr_agg 构建嵌入式聚合
    NestedAggregationBuilder attr_agg = AggregationBuilders.nested("attr_agg", "attrs");
    // 3.1 聚合出当前所有的attrId
    TermsAggregationBuilder attrIdAgg = AggregationBuilders.terms("attr_id_agg").field("attrs.attrId");
    // 3.1.1 聚合分析出当前attrId对应的attrName
    attrIdAgg.subAggregation(AggregationBuilders.terms("attr_name_agg").field("attrs.attrName").size(1));
    // 3.1.2 聚合分析出当前attrId对应的所有可能的属性值attrValue 这里的属性值可能会有很多 所以写50
    attrIdAgg.subAggregation(AggregationBuilders.terms("attr_value_agg").field("attrs.attrValue").size(50));
    // 3.2 将这个子聚合加入嵌入式聚合
    attr_agg.subAggregation(attrIdAgg);
    sourceBuilder.aggregation(attr_agg);
    log.info("\n构建语句:->\n" + sourceBuilder.toString());
    SearchRequest searchRequest = new SearchRequest(new String[]{EsConstant.PRODUCT_INDEX}, sourceBuilder);
    return searchRequest;
    }

    /**
    * 构建结果数据 指定catalogId 、brandId、attrs.attrId、嵌入式查询、倒序、0-6000、每页显示两个、高亮skuTitle、聚合分析
    */
    private SearchResult buildSearchResult(SearchResponse response, SearchParam Param) {
    SearchResult result = new SearchResult();
    // 1.返回的所有查询到的商品
    SearchHits hits = response.getHits();

    List<SkuEsModel> esModels = new ArrayList<>();
    if(hits.getHits() != null && hits.getHits().length > 0){
    for (SearchHit hit : hits.getHits()) {
    String sourceAsString = hit.getSourceAsString();
    // ES中检索得到的对象
    SkuEsModel esModel = JSON.parseObject(sourceAsString, SkuEsModel.class);
    if(!StringUtils.isEmpty(Param.getKeyword())){
    // 1.1 获取标题的高亮属性
    HighlightField skuTitle = hit.getHighlightFields().get("skuTitle");
    String highlightFields = skuTitle.getFragments()[0].string();
    // 1.2 设置文本高亮
    esModel.setSkuTitle(highlightFields);
    }
    esModels.add(esModel);
    }
    }
    result.setProducts(esModels);

    // 2.当前所有商品涉及到的所有属性信息
    ArrayList<SearchResult.AttrVo> attrVos = new ArrayList<>();
    ParsedNested attr_agg = response.getAggregations().get("attr_agg");
    ParsedLongTerms attr_id = attr_agg.getAggregations().get("attr_id_agg");
    for (Terms.Bucket bucket : attr_id.getBuckets()) {
    SearchResult.AttrVo attrVo = new SearchResult.AttrVo();
    // 2.1 得到属性的id
    attrVo.setAttrId(bucket.getKeyAsNumber().longValue());
    // 2.2 得到属性的名字
    String attr_name = ((ParsedStringTerms) bucket.getAggregations().get("attr_name_agg")).getBuckets().get(0).getKeyAsString();
    attrVo.setAttrName(attr_name);
    // 2.3 得到属性的所有值
    List<String> attr_value = ((ParsedStringTerms) bucket.getAggregations().get("attr_value_agg")).getBuckets().stream().map(item -> item.getKeyAsString()).collect(Collectors.toList());
    attrVo.setAttrValue(attr_value);
    attrVos.add(attrVo);
    }
    result.setAttrs(attrVos);

    // 3.当前所有商品涉及到的所有品牌信息
    ArrayList<SearchResult.BrandVo> brandVos = new ArrayList<>();
    ParsedLongTerms brand_agg = response.getAggregations().get("brand_agg");
    for (Terms.Bucket bucket : brand_agg.getBuckets()) {
    SearchResult.BrandVo brandVo = new SearchResult.BrandVo();
    // 3.1 得到品牌的id
    long brnadId = bucket.getKeyAsNumber().longValue();
    brandVo.setBrandId(brnadId);
    // 3.2 得到品牌的名
    String brand_name = ((ParsedStringTerms) bucket.getAggregations().get("brand_name_agg")).getBuckets().get(0).getKeyAsString();
    brandVo.setBrandName(brand_name);
    // 3.3 得到品牌的图片
    String brand_img = ((ParsedStringTerms) (bucket.getAggregations().get("brand_img_agg"))).getBuckets().get(0).getKeyAsString();
    brandVo.setBrandImg(brand_img);
    brandVos.add(brandVo);
    }
    result.setBrands(brandVos);

    // 4.当前商品所有涉及到的分类信息
    ParsedLongTerms catalog_agg = response.getAggregations().get("catalog_agg");
    List<SearchResult.CatalogVo> catalogVos = new ArrayList<>();
    for (Terms.Bucket bucket : catalog_agg.getBuckets()) {
    // 设置分类id
    SearchResult.CatalogVo catalogVo = new SearchResult.CatalogVo();
    catalogVo.setCatalogId(Long.parseLong(bucket.getKeyAsString()));
    // 得到分类名
    ParsedStringTerms catalog_name_agg = bucket.getAggregations().get("catalog_name_agg");
    String catalog_name = catalog_name_agg.getBuckets().get(0).getKeyAsString();
    catalogVo.setCatalogName(catalog_name);
    catalogVos.add(catalogVo);
    }
    result.setCatalogs(catalogVos);
    // ================以上信息从聚合信息中获取
    // 5.分页信息-页码
    result.setPageNum(Param.getPageNum());

    // 总记录数
    long total = hits.getTotalHits().value;

    result.setTotal(total);

    // 总页码:计算得到
    int totalPages = (int)(total / EsConstant.PRODUCT_PASIZE + 0.999999999999);
    result.setTotalPages(totalPages);
    // 设置导航页
    ArrayList<Integer> pageNavs = new ArrayList<>();
    for (int i = 1;i <= totalPages; i++){
    pageNavs.add(i);
    }
    result.setPageNavs(pageNavs);

    // 6.构建面包屑导航功能
    if(Param.getAttrs() != null){
    List<SearchResult.NavVo> navVos = Param.getAttrs().stream().map(attr -> {
    SearchResult.NavVo navVo = new SearchResult.NavVo();
    String[] s = attr.split("_");
    navVo.setNavValue(s[1]);
    R r = productFeignService.getAttrsInfo(Long.parseLong(s[0]));
    // 将已选择的请求参数添加进去 前端页面进行排除
    result.getAttrIds().add(Long.parseLong(s[0]));
    if(r.getCode() == 0){
    AttrResponseVo data = r.getData(new TypeReference<AttrResponseVo>(){});
    if (data != null) {
    navVo.setName(data.getAttrName());
    }
    }else{
    // 失败了就拿id作为名字
    navVo.setName(s[0]);
    }
    // 拿到所有查询条件 替换查询条件
    String replace = replaceQueryString(Param, attr, "attrs");
    navVo.setLink("http://search.gulimall.com/list.html?" + replace);
    return navVo;
    }).collect(Collectors.toList());
    result.setNavs(navVos);
    }

    // 品牌、分类
    if(Param.getBrandId() != null && Param.getBrandId().size() > 0){
    List<SearchResult.NavVo> navs = result.getNavs();
    SearchResult.NavVo navVo = new SearchResult.NavVo();
    navVo.setName("品牌");
    // 远程查询所有品牌
    R r = productFeignService.brandInfo(Param.getBrandId());
    if(r.getCode() == 0){
    List<BrandVo> brand = r.getData("data", new TypeReference<List<BrandVo>>() {});
    StringBuilder buffer = new StringBuilder();
    // 替换所有品牌ID
    String replace = "";
    for (BrandVo brandVo : brand) {
    buffer.append(brandVo.getBrandName()).append(";");
    replace = replaceQueryString(Param, brandVo.getBrandId() + "", "brandId");
    }
    navVo.setNavValue(buffer.toString());
    navVo.setLink("http://search.gulimall.com/list.html?" + replace);
    }
    navs.add(navVo);
    }
    return result;
    }

    /**
    * 替换字符
    * key :需要替换的key
    */
    private String replaceQueryString(SearchParam Param, String value, String key) {
    String encode = null;
    try {
    encode = URLEncoder.encode(value,"UTF-8");
    // 浏览器对空格的编码和java的不一样
    encode = encode.replace("+","%20");
    encode = encode.replace("%28", "(").replace("%29",")");
    } catch (UnsupportedEncodingException e) {
    e.printStackTrace();
    }
    return Param.get_queryString().replace("&" + key + "=" + encode, "");
    }
    }
  3. 【搜索微服务】商品检索结果模板

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
    910
    911
    912
    913
    914
    915
    916
    917
    918
    919
    920
    921
    922
    923
    924
    925
    926
    927
    928
    929
    930
    931
    932
    933
    934
    935
    936
    937
    938
    939
    940
    941
    942
    943
    944
    945
    946
    947
    948
    949
    950
    951
    952
    953
    954
    955
    956
    957
    958
    959
    960
    961
    962
    963
    964
    965
    966
    967
    968
    969
    970
    971
    972
    973
    974
    975
    976
    977
    978
    979
    980
    981
    982
    983
    984
    985
    986
    987
    988
    989
    990
    991
    992
    993
    994
    995
    996
    997
    998
    999
    1000
    1001
    1002
    1003
    1004
    1005
    1006
    1007
    1008
    1009
    1010
    1011
    1012
    1013
    1014
    1015
    1016
    1017
    1018
    1019
    1020
    1021
    1022
    1023
    1024
    1025
    1026
    1027
    1028
    1029
    1030
    1031
    1032
    1033
    1034
    1035
    1036
    1037
    1038
    1039
    1040
    1041
    1042
    1043
    1044
    1045
    1046
    1047
    1048
    1049
    1050
    1051
    1052
    1053
    1054
    1055
    1056
    1057
    1058
    1059
    1060
    1061
    1062
    1063
    1064
    1065
    1066
    1067
    1068
    1069
    1070
    1071
    1072
    1073
    1074
    1075
    1076
    1077
    1078
    1079
    1080
    1081
    1082
    1083
    1084
    1085
    1086
    1087
    1088
    1089
    1090
    1091
    1092
    1093
    1094
    1095
    1096
    1097
    1098
    1099
    1100
    1101
    1102
    1103
    1104
    1105
    1106
    1107
    1108
    1109
    1110
    1111
    1112
    1113
    1114
    1115
    1116
    1117
    1118
    1119
    1120
    1121
    1122
    1123
    1124
    1125
    1126
    1127
    1128
    1129
    1130
    1131
    1132
    1133
    1134
    1135
    1136
    1137
    1138
    1139
    1140
    1141
    1142
    1143
    1144
    1145
    1146
    1147
    1148
    1149
    1150
    1151
    1152
    1153
    1154
    1155
    1156
    1157
    1158
    1159
    1160
    1161
    1162
    1163
    1164
    1165
    1166
    1167
    1168
    1169
    1170
    1171
    1172
    1173
    1174
    1175
    1176
    1177
    1178
    1179
    1180
    1181
    1182
    1183
    1184
    1185
    1186
    1187
    1188
    1189
    1190
    1191
    1192
    1193
    1194
    1195
    1196
    1197
    1198
    1199
    1200
    1201
    1202
    1203
    1204
    1205
    1206
    1207
    1208
    1209
    1210
    1211
    1212
    1213
    1214
    1215
    1216
    1217
    1218
    1219
    1220
    1221
    1222
    1223
    1224
    1225
    1226
    1227
    1228
    1229
    1230
    1231
    1232
    1233
    1234
    1235
    1236
    1237
    1238
    1239
    1240
    1241
    1242
    1243
    1244
    1245
    1246
    1247
    1248
    1249
    1250
    1251
    1252
    1253
    1254
    1255
    1256
    1257
    1258
    1259
    1260
    1261
    1262
    1263
    1264
    1265
    1266
    1267
    1268
    1269
    1270
    1271
    1272
    1273
    1274
    1275
    1276
    1277
    1278
    1279
    1280
    1281
    1282
    1283
    1284
    1285
    1286
    1287
    1288
    1289
    1290
    1291
    1292
    1293
    1294
    1295
    1296
    1297
    1298
    1299
    1300
    1301
    1302
    1303
    1304
    1305
    1306
    1307
    1308
    1309
    1310
    1311
    1312
    1313
    1314
    1315
    1316
    1317
    1318
    1319
    1320
    1321
    1322
    1323
    1324
    1325
    1326
    1327
    1328
    1329
    1330
    1331
    1332
    1333
    1334
    1335
    1336
    1337
    1338
    1339
    1340
    1341
    1342
    1343
    1344
    1345
    1346
    1347
    1348
    1349
    1350
    1351
    1352
    1353
    1354
    1355
    1356
    1357
    1358
    1359
    1360
    1361
    1362
    1363
    1364
    1365
    1366
    1367
    1368
    1369
    1370
    1371
    1372
    1373
    1374
    1375
    1376
    1377
    1378
    1379
    1380
    1381
    1382
    1383
    1384
    1385
    1386
    1387
    1388
    1389
    1390
    1391
    1392
    1393
    1394
    1395
    1396
    1397
    1398
    1399
    1400
    1401
    1402
    1403
    1404
    1405
    1406
    1407
    1408
    1409
    1410
    1411
    1412
    1413
    1414
    1415
    1416
    1417
    1418
    1419
    1420
    1421
    1422
    1423
    1424
    1425
    1426
    1427
    1428
    1429
    1430
    1431
    1432
    1433
    1434
    1435
    1436
    1437
    1438
    1439
    1440
    1441
    1442
    1443
    1444
    1445
    1446
    1447
    1448
    1449
    1450
    1451
    1452
    1453
    1454
    1455
    1456
    1457
    1458
    1459
    1460
    1461
    1462
    1463
    1464
    1465
    1466
    1467
    1468
    1469
    1470
    1471
    1472
    1473
    1474
    1475
    1476
    1477
    1478
    1479
    1480
    1481
    1482
    1483
    1484
    1485
    1486
    1487
    1488
    1489
    1490
    1491
    1492
    1493
    1494
    1495
    1496
    1497
    1498
    1499
    1500
    1501
    1502
    1503
    1504
    1505
    1506
    1507
    1508
    1509
    1510
    1511
    1512
    1513
    1514
    1515
    1516
    1517
    1518
    1519
    1520
    1521
    1522
    1523
    1524
    1525
    1526
    1527
    1528
    1529
    1530
    1531
    1532
    1533
    1534
    1535
    1536
    1537
    1538
    1539
    1540
    1541
    1542
    1543
    1544
    1545
    1546
    1547
    1548
    1549
    1550
    1551
    1552
    1553
    1554
    1555
    1556
    1557
    1558
    1559
    1560
    1561
    1562
    1563
    1564
    1565
    1566
    1567
    1568
    1569
    1570
    1571
    1572
    1573
    1574
    1575
    1576
    1577
    1578
    1579
    1580
    1581
    1582
    1583
    1584
    1585
    1586
    1587
    1588
    1589
    1590
    1591
    1592
    1593
    1594
    1595
    1596
    1597
    1598
    1599
    1600
    1601
    1602
    1603
    1604
    1605
    1606
    1607
    1608
    1609
    1610
    1611
    1612
    1613
    1614
    1615
    1616
    1617
    1618
    1619
    1620
    1621
    1622
    1623
    1624
    1625
    1626
    1627
    1628
    1629
    1630
    1631
    1632
    1633
    1634
    1635
    1636
    1637
    1638
    1639
    1640
    1641
    1642
    1643
    1644
    1645
    1646
    1647
    1648
    1649
    1650
    1651
    1652
    1653
    1654
    1655
    1656
    1657
    1658
    1659
    1660
    1661
    1662
    1663
    1664
    1665
    1666
    1667
    1668
    1669
    1670
    1671
    1672
    1673
    1674
    1675
    1676
    1677
    1678
    1679
    1680
    1681
    1682
    1683
    1684
    1685
    1686
    1687
    1688
    1689
    1690
    1691
    1692
    1693
    1694
    1695
    1696
    1697
    1698
    1699
    1700
    1701
    1702
    1703
    1704
    1705
    1706
    1707
    1708
    1709
    1710
    1711
    1712
    1713
    1714
    1715
    1716
    1717
    1718
    1719
    1720
    1721
    1722
    1723
    1724
    1725
    1726
    1727
    1728
    1729
    1730
    1731
    1732
    1733
    1734
    1735
    1736
    1737
    1738
    1739
    1740
    1741
    1742
    1743
    1744
    1745
    1746
    1747
    1748
    1749
    1750
    1751
    1752
    1753
    1754
    1755
    1756
    1757
    1758
    1759
    1760
    1761
    1762
    1763
    1764
    1765
    1766
    1767
    1768
    1769
    1770
    1771
    1772
    1773
    1774
    1775
    1776
    1777
    1778
    1779
    1780
    1781
    1782
    1783
    1784
    1785
    1786
    1787
    1788
    1789
    1790
    1791
    1792
    1793
    1794
    1795
    1796
    1797
    1798
    1799
    1800
    1801
    1802
    1803
    1804
    1805
    1806
    1807
    1808
    1809
    1810
    1811
    1812
    1813
    1814
    1815
    1816
    1817
    1818
    1819
    1820
    1821
    1822
    1823
    1824
    1825
    1826
    1827
    1828
    1829
    1830
    1831
    1832
    1833
    1834
    1835
    1836
    1837
    1838
    1839
    1840
    1841
    1842
    1843
    1844
    1845
    1846
    1847
    1848
    1849
    1850
    1851
    1852
    1853
    1854
    1855
    1856
    1857
    1858
    1859
    1860
    1861
    1862
    1863
    1864
    1865
    1866
    1867
    1868
    1869
    1870
    1871
    1872
    1873
    1874
    1875
    1876
    1877
    1878
    1879
    1880
    1881
    1882
    1883
    1884
    1885
    1886
    1887
    1888
    1889
    1890
    1891
    1892
    1893
    1894
    1895
    1896
    1897
    1898
    1899
    1900
    1901
    1902
    1903
    1904
    1905
    1906
    1907
    1908
    1909
    1910
    1911
    1912
    1913
    1914
    1915
    1916
    1917
    1918
    1919
    1920
    1921
    1922
    1923
    1924
    1925
    1926
    1927
    1928
    1929
    1930
    1931
    1932
    1933
    1934
    1935
    1936
    1937
    1938
    1939
    1940
    1941
    1942
    1943
    1944
    1945
    1946
    1947
    1948
    1949
    1950
    1951
    1952
    1953
    1954
    1955
    1956
    1957
    1958
    1959
    1960
    1961
    1962
    1963
    1964
    1965
    1966
    1967
    1968
    1969
    1970
    1971
    1972
    1973
    1974
    1975
    1976
    1977
    1978
    1979
    1980
    1981
    1982
    1983
    1984
    1985
    1986
    1987
    1988
    1989
    1990
    1991
    1992
    1993
    1994
    1995
    1996
    1997
    1998
    1999
    2000
    2001
    2002
    2003
    2004
    2005
    2006
    2007
    2008
    2009
    2010
    2011
    2012
    2013
    2014
    2015
    2016
    2017
    2018
    2019
    2020
    2021
    2022
    2023
    2024
    2025
    2026
    2027
    2028
    2029
    2030
    2031
    2032
    2033
    2034
    2035
    2036
    2037
    2038
    2039
    2040
    2041
    2042
    2043
    2044
    2045
    2046
    2047
    2048
    2049
    2050
    2051
    2052
    2053
    2054
    2055
    2056
    2057
    2058
    2059
    2060
    2061
    2062
    2063
    2064
    2065
    2066
    2067
    2068
    2069
    2070
    2071
    2072
    2073
    2074
    2075
    2076
    2077
    2078
    2079
    2080
    2081
    2082
    2083
    2084
    2085
    2086
    2087
    2088
    2089
    2090
    2091
    2092
    2093
    2094
    2095
    2096
    2097
    2098
    2099
    2100
    2101
    2102
    2103
    2104
    2105
    2106
    2107
    2108
    2109
    2110
    2111
    <!DOCTYPE html>
    <html lang="en" xmlns:th="http://www.thymeleaf.org">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport"
    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/static/search/css/index.css">
    <link rel="stylesheet" type="text/css" href="/static/search/font/iconfont.css">
    <script src="/static/search/js/jquery-1.12.4.js"></script>
    <title>详情页</title>
    </head>
    <body>
    <!--头部-->
    <div class="header_head">
    <div class="header_head_box">
    <b class="header_head_p">
    <div style="overflow: hidden">
    <a href="http://gulimall.com/" class="header_head_p_a1" style="width:73px;">
    谷粒商城首页
    </a>
    <a href="/list.html" class="header_head_p_a">
    北京</a>
    </div>
    <div class="header_head_p_cs">
    <a href="/list.html" style="background: #C81623;color: #fff;">北京</a>
    <a href="/list.html">上海</a>
    <a href="/list.html">天津</a>
    <a href="/list.html">重庆</a>
    <a href="/list.html">河北</a>
    <a href="/list.html">山西</a>
    <a href="/list.html">河南</a>
    <a href="/list.html">辽宁</a>
    <a href="/list.html">吉林</a>
    <a href="/list.html">黑龙江</a>
    <a href="/list.html">内蒙古</a>
    <a href="/list.html">江苏</a>
    <a href="/list.html">山东</a>
    <a href="/list.html">安徽</a>
    <a href="/list.html">浙江</a>
    <a href="/list.html">福建</a>
    <a href="/list.html">湖北</a>
    <a href="/list.html">湖南</a>
    <a href="/list.html">广东</a>
    <a href="/list.html">广西</a>
    <a href="/list.html">江西</a>
    <a href="/list.html">四川</a>
    <a href="/list.html">海南</a>
    <a href="/list.html">贵州</a>
    <a href="/list.html">云南</a>
    <a href="/list.html">西藏</a>
    <a href="/list.html">陕西</a>
    <a href="/list.html">甘肃</a>
    <a href="/list.html">青海</a>
    <a href="/list.html">宁夏</a>
    <a href="/list.html">新疆</a>
    <a href="/list.html">港澳</a>
    <a href="/list.html">台湾</a>
    <a href="/list.html">钓鱼岛</a>
    <a href="/list.html">海外</a>
    </div>
    </b>
    <ul>
    <li th:if="${session.loginUser} ==null">
    <a href="http://auth.gulimall.com/login.html" class="li_2">你好,请登录</a>
    </li>
    <li th:if="${session.loginUser} !=null">
    <a class="li_2">欢迎,[[${session.loginUser.username}]]</a>
    </li>
    <li th:if="${session.loginUser} !=null">
    <a href="http://auth.gulimall.com/oauth2.0/logout">退出登录</a>
    </li>
    <li th:if="${session.loginUser} ==null">
    <a href="http://auth.gulimall.com/reg.html" style="color: red;">免费注册</a>
    </li>
    <span>|</span>
    <li th:if="${session.loginUser} !=null">
    <a>我的订单</a>
    </li>
    <span>|</span>
    <li class="header_wdjd" style="width:80px;">
    <a href="/list.html">我的谷粒商城</a>
    <img src="/static/search/image/down-@1x.png"/>
    <div class="header_wdjd_txt">
    <ul>
    <li>
    <a href="/list.html">待处理订单</a>
    </li>
    <li>
    <a href="/list.html">消息</a>
    </li>
    <li>
    <a href="/list.html">返修退换货</a>
    </li>
    <li>
    <a href="/list.html">我的回答</a>
    </li>
    <li>
    <a href="/list.html">降价商品</a>
    </li>
    <li>
    <a href="/list.html">我的关注</a>
    </li>
    </ul>
    <ul>
    <li>
    <a href="/list.html">我的京豆</a>
    </li>
    <li>
    <a href="/list.html">我的优惠券</a>
    </li>
    <li>
    <a href="/list.html">我的白条</a>
    </li>
    <li>
    <a href="/list.html">我的理财</a>
    </li>
    </ul>
    </div>
    </li>
    <span>|</span>
    <li>
    <a href="/list.html">谷粒商城会员</a>
    </li>
    <span>|</span>
    <li>
    <a href="/list.html">企业采购</a>
    </li>
    <span>|</span>
    <li class="header_wdjd1">
    <a href="/list.html">客户服务</a>
    <img src="/static/search/image/down-@1x.png"/>
    <div class="header_wdjd_txt">
    <ul>
    <p style="width:100%;">客户</p>
    <li>
    <a href="/list.html">帮助中心</a>
    </li>
    <li>
    <a href="/list.html">售后服务</a>
    </li>
    <li>
    <a href="/list.html">在线客服</a>
    </li>
    <li>
    <a href="/list.html">意见建议</a>
    </li>
    <li>
    <a href="/list.html">电话客服</a>
    </li>
    <li>
    <a href="/list.html">客服邮箱</a>
    </li>
    <li>
    <a href="/list.html">金融资讯</a>
    </li>
    <li>
    <a href="/list.html">售全球客服</a>
    </li>
    </ul>
    <ul>
    <p style="width:100%;">商户</p>
    <li>
    <a href="/list.html">合作招商</a>
    </li>
    <li>
    <a href="/list.html">学习中心</a>
    </li>
    <li>
    <a href="/list.html">商家后台</a>
    </li>
    <li>
    <a href="/list.html">京麦工作台</a>
    </li>
    <li>
    <a href="/list.html">商家帮助</a>
    </li>
    <li>
    <a href="/list.html">规则平台</a>
    </li>
    </ul>
    </div>
    </li>
    <span>|</span>
    <li class="header_wzdh">
    <a href="/list.html">网站导航</a>
    <img src="/static/search/image/down-@1x.png"/>
    <!--<b class="glyphicon glyphicon-menu-down"></b>-->
    <div class="header_wzdh_txt">
    <ul style="width: 25%;">
    <p style="width:100%;">特色主题</p>
    <li>
    <a href="/list.html">谷粒商城试用</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城金融</a>
    </li>
    <li>
    <a href="/list.html">全球售</a>
    </li>
    <li>
    <a href="/list.html">国际站</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城会员</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城预售</a>
    </li>
    <li>
    <a href="/list.html">买什么</a>
    </li>
    <li>
    <a href="/list.html">俄语站</a>
    </li>
    <li>
    <a href="/list.html">装机大师</a>
    </li>
    <li>
    <a href="/list.html">0元评测</a>
    </li>
    <li>
    <a href="/list.html">定期送</a>
    </li>
    <li>
    <a href="/list.html">港澳售</a>
    </li>
    <li>
    <a href="/list.html">优惠券</a>
    </li>
    <li>
    <a href="/list.html">秒杀</a>
    </li>
    <li>
    <a href="/list.html">闪购</a>
    </li>
    <li>
    <a href="/list.html">印尼站</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城金融科技</a>
    </li>
    <li>
    <a href="/list.html">In货推荐</a>
    </li>
    <li>
    <a href="/list.html">陪伴计划</a>
    </li>
    <li>
    <a href="/list.html">出海招商</a>
    </li>
    </ul>
    <ul style="width: 20%;">
    <p style="width:100%;">行业频道</p>
    <li>
    <a href="/list.html">手机</a>
    </li>
    <li>
    <a href="/list.html">智能数码</a>
    </li>
    <li>
    <a href="/list.html">玩3c</a>
    </li>
    <li>
    <a href="/list.html">电脑办公</a>
    </li>
    <li>
    <a href="/list.html">家用电器</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城智能</a>
    </li>
    <li>
    <a href="/list.html">服装城</a>
    </li>
    <li>
    <a href="/list.html">美妆馆</a>
    </li>
    <li>
    <a href="/list.html">家装城</a>
    </li>
    <li>
    <a href="/list.html">母婴</a>
    </li>
    <li>
    <a href="/list.html">食品</a>
    </li>
    <li>
    <a href="/list.html">运动户外</a>
    </li>
    <li>
    <a href="/list.html">农资频道</a>
    </li>
    <li>
    <a href="/list.html">整车</a>
    </li>
    <li>
    <a href="/list.html">图书</a>
    </li>
    </ul>
    <ul style="width: 21%;">
    <p style="width:100%;">生活服务</p>
    <li>
    <a href="/list.html">白条</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城金融App</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城小金库</a>
    </li>
    <li>
    <a href="/list.html">理财</a>
    </li>
    <li>
    <a href="/list.html">智能家电</a>
    </li>
    <li>
    <a href="/list.html">话费</a>
    </li>
    <li>
    <a href="/list.html">水电煤</a>
    </li>
    <li>
    <a href="/list.html">彩票</a>
    </li>
    <li>
    <a href="/list.html">旅行</a>
    </li>
    <li>
    <a href="/list.html">机票酒店</a>
    </li>
    <li>
    <a href="/list.html">电影票</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城到家</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城众测</a>
    </li>
    <li>
    <a href="/list.html">游戏</a>
    </li>
    </ul>
    <ul style="width: 23%; border-right: 0;">
    <p style="width:100%;">更多精选</p>
    <li>
    <a href="/list.html">合作招商</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城通信</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城E卡</a>
    </li>
    <li>
    <a href="/list.html">企业采购</a>
    </li>
    <li>
    <a href="/list.html">服务市场</a>
    </li>
    <li>
    <a href="/list.html">办公生活馆</a>
    </li>
    <li>
    <a href="/list.html">乡村招募</a>
    </li>
    <li>
    <a href="/list.html">校园加盟</a>
    </li>
    <li>
    <a href="/list.html">京友帮</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城社区</a>
    </li>
    <li>
    <a href="/list.html">智能社区</a>
    </li>
    <li>
    <a href="/list.html">游戏社区</a>
    </li>
    <li>
    <a href="/list.html">知识产权维权</a>
    </li>
    </ul>
    </div>
    </li>
    <span>|</span>
    <li class="header_sjjd">
    <a href="/list.html">手机谷粒商城</a>
    <div class="header_sjjd_div">
    <img src="/static/search/img/01.png"/>
    </div>
    </li>
    </ul>
    </div>
    </div>

    <!--搜索导航-->
    <div class="header_sous">
    <div class="logo">
    <a href="http://gulimall.com/"><img src="/static/search/./image/logo1.jpg" alt=""></a>
    </div>
    <div class="header_form">
    <input id="keyword_input" type="text" placeholder="手机" th:value="${param.keyword}"/>
    <a href="javascript:searchByKeyword();">搜索</a>
    </div>
    <div class="header_ico">
    <div class="header_gw">
    <span><a href="/list.html">我的购物车</a></span>
    <img src="/static/search/image/settleup-@1x.png"/>
    <span>0</span>
    </div>
    <div class="header_ko">
    <p>购物车中还没有商品,赶紧选购吧!</p>
    </div>
    </div>
    <div class="header_form_nav">
    <ul>
    <li>
    <a href="/list.html">谷粒商城之家</a>
    </li>
    <li>
    <a href="/list.html">谷粒商城专卖店</a>
    </li>
    <li>
    <a href="/list.html">平板</a>
    </li>
    <li>
    <a href="/list.html">电脑</a>
    </li>
    <li>
    <a href="/list.html">ipad</a>
    </li>
    </ul>
    </div>
    <nav>
    <ul>
    <li class="nav_li1">
    <a href="/list.html">全部商品分类</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">服装城</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">美装馆</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">超市</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">生鲜</a>
    </li>
    </ul>
    <div class="spacer">|</div>
    <ul>
    <li class="nav_li">
    <a href="/list.html">全球购</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">闪购</a>
    </li>
    <li class="nav_li">
    <a href="/list.html">拍卖</a>
    </li>
    </ul>
    <div class="spacer">|</div>
    <ul>
    <li class="nav_li">
    <a href="/list.html">金融</a>
    </li>
    </ul>

    </nav>
    <div class="header_main_left">
    <ul>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>家用电器</b></a>
    </li>
    <li class="header_li2">
    <a href="/list.html" class="header_main_left_a"><b>手机</b> / <b>运营商</b> / <b>数码</b></a>
    <div class="header_main_left_main">
    <div class="header_sj">
    <a href="/list.html" class="header_sj_a">玩3c</a>
    <a href="/list.html" class="header_sj_a">手机频道</a>
    <a href="/list.html" class="header_sj_a">网上营业厅</a>
    <a href="/list.html" class="header_sj_a">配件选购中心</a>
    <a href="/list.html" class="header_sj_a">企业购</a>
    <a href="/list.html" class="header_sj_a">以旧换新</a>
    </div>
    <ol class="header_ol">
    <a href="/list.html" style="color: #111;" class="aaa">手机通讯 ></a>
    <li>
    <a href="/list.html" style="color: #999;">手机</a>
    <a href="/list.html" style="color: #999;">对讲机</a>
    <a href="/list.html" style="color: #999;">手机维修</a>
    <a href="/list.html" style="color: #999;">以旧换新</a>
    </li>
    <a href="/list.html" style="color: #111;" class="aaa">运营商 ></a>
    <li>
    <a href="/list.html" style="color: #999;">合约机</a>
    <a href="/list.html" style="color: #999;">固话宽带</a>
    <a href="/list.html" style="color: #999;">办套餐</a>
    <a href="/list.html" style="color: #999;">从话费/流量</a>
    <a href="/list.html" style="color: #999;">中国电信</a>
    <a href="/list.html" style="color: #999;">中国移动</a>
    <a href="/list.html" style="color: #999;">中国联通</a>
    <a href="/list.html" style="color: #999;">谷粒商城通信</a>
    <a href="/list.html" style="color: #999;">170选号</a>
    </li>
    <a href="/list.html" style="color: #111;" class="aaa">手机配件 ></a>
    <li style="height: 60px;">

    <a href="/list.html" style="color: #999;">手机壳</a>
    <a href="/list.html" style="color: #999;">贴膜</a>
    <a href="/list.html" style="color: #999;">手机储存卡</a>
    <a href="/list.html" style="color: #999;">数据线</a>
    <a href="/list.html" style="color: #999;">存电器</a>
    <a href="/list.html" style="color: #999;">手机耳机</a>
    <a href="/list.html" style="color: #999;">创业配件</a>
    <a href="/list.html" style="color: #999;">手机饰品</a>
    <a href="/list.html" style="color: #999;">手机电池</a>
    <a href="/list.html" style="color: #999;">苹果周边</a>
    <a href="/list.html" style="color: #999;">移动电源</a>
    <a href="/list.html" style="color: #999;">蓝牙耳机</a>
    <a href="/list.html" style="color: #999;">手机支架</a>
    <a href="/list.html" style="color: #999;">车载配件</a>
    <a href="/list.html" style="color: #999;">拍照配件</a>

    </li>
    <a href="/list.html" style="color: #111;" class="aaa">摄影摄像 ></a>
    <li style="height: 60px;">

    <a href="/list.html" style="color: #999;">数码相机</a>
    <a href="/list.html" style="color: #999;">单电/微单相机</a>
    <a href="/list.html" style="color: #999;">单反相机</a>
    <a href="/list.html" style="color: #999;">拍立得</a>
    <a href="/list.html" style="color: #999;">运动相机</a>
    <a href="/list.html" style="color: #999;">摄像机</a>
    <a href="/list.html" style="color: #999;">镜头</a>
    <a href="/list.html" style="color: #999;">户外器材</a>
    <a href="/list.html" style="color: #999;">影棚器材</a>
    <a href="/list.html" style="color: #999;">冲印服务</a>
    <a href="/list.html" style="color: #999;">数码相框</a>
    </li>
    <a href="/list.html" style="color: #111;" class="aaa">数码配件 ></a>
    <li style="height: 60px;">

    <a href="/list.html" style="color: #999;">三脚架/云台</a>
    <a href="/list.html" style="color: #999;">相机包</a>
    <a href="/list.html" style="color: #999;">滤镜</a>
    <a href="/list.html" style="color: #999;">散光灯/手柄</a>
    <a href="/list.html" style="color: #999;">相机清洁</a>
    <a href="/list.html" style="color: #999;">机身附件</a>
    <a href="/list.html" style="color: #999;">镜头附件</a>
    <a href="/list.html" style="color: #999;">读卡器</a>
    <a href="/list.html" style="color: #999;">支架</a>
    <a href="/list.html" style="color: #999;">电池/存电器</a>

    </li>
    <a href="/list.html" style="color: #111;" class="aaa">影音娱乐 ></a>
    <li>

    <a href="/list.html" style="color: #999;">耳机/耳麦</a>
    <a href="/list.html" style="color: #999;">音箱/音响</a>
    <a href="/list.html" style="color: #999;">智能音箱</a>
    <a href="/list.html" style="color: #999;">便携/无线音箱</a>
    <a href="/list.html" style="color: #999;">收音机</a>
    <a href="/list.html" style="color: #999;">麦克风</a>
    <a href="/list.html" style="color: #999;">MP3/MP4</a>
    <a href="/list.html" style="color: #999;">专业音频</a>
    </li>
    <a href="/list.html" style="color: #111;" class="aaa">智能设备 ></a>
    <li style="height: 60px;">

    <a href="/list.html" style="color: #999;">智能手环</a>
    <a href="/list.html" style="color: #999;">智能手表</a>
    <a href="/list.html" style="color: #999;">智能眼镜</a>
    <a href="/list.html" style="color: #999;">智能机器人</a>
    <a href="/list.html" style="color: #999;">运动跟踪器</a>
    <a href="/list.html" style="color: #999;">健康监测</a>
    <a href="/list.html" style="color: #999;">智能配饰</a>
    <a href="/list.html" style="color: #999;">智能家居</a>
    <a href="/list.html" style="color: #999;">体感车</a>
    <a href="/list.html" style="color: #999;">无人机</a>
    <a href="/list.html" style="color: #999;">其他配件</a>
    </li>
    <a href="/list.html" style="color: #111;" class="aaa">电子教育 ></a>
    <li>
    <a href="/list.html" style="color: #999;">学生平板</a>
    <a href="/list.html" style="color: #999;">点读机</a>
    <a href="/list.html" style="color: #999;">早教益智</a>
    <a href="/list.html" style="color: #999;">录音笔</a>
    <a href="/list.html" style="color: #999;">电纸书</a>
    <a href="/list.html" style="color: #999;">电子词典</a>
    <a href="/list.html" style="color: #999;">复读机</a>
    </li>
    </ol>
    <div class="header_r">
    <div class="header_r_tu">
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    <a href="/list.html"><img src="/static/search/img/56b2f385n8e4eb051.jpg"/></a>
    </div>
    <div class="header_r_tu1">
    <a href="/list.html"><img src="/static/search/img/JD_ash7 - 副本.png"/></a>
    <a href="/list.html"><img src="/static/search/img/JD_ash6.png"/></a>
    </div>
    </div>
    </div>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>电脑</b> / <b>办公</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>家居</b> / <b>家具</b> / <b>家装</b> / <b>厨具</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>男装</b> / <b>女装</b> / <b>童装</b> / <b>内衣</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>美妆个护 </b>/ <b>宠物</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>女鞋</b> / <b>箱包</b> / <b>钟表</b> / <b>珠宝</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>男鞋</b> / <b>运动</b> / <b>户外</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>汽车</b> / <b>汽车用品</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>母婴</b> / <b>玩具乐器</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>食品</b> / <b>酒类</b> / <b>生鲜</b> / <b>特产</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>礼品鲜花</b> / <b>农资绿植</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>医药保健</b> / <b>计生情趣</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>图书</b> / <b>音箱</b>/ <b>电子书</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>机票</b> / <b>酒店</b> / <b>旅游</b> / <b>生活</b></a>
    </li>
    <li>
    <a href="/list.html" class="header_main_left_a"><b>理财</b> / <b>众筹</b> / <b>白条</b> / <b>保险</b></a>
    </li>
    </ul>

    </div>
    </div>

    <hr style="border: 1px solid red;margin-top: -7px;">

    <!--热卖促销-->
    <div class="JD_temai">
    <div class="JD_main">
    <div class="JD_left">
    <div class="hd">
    热卖推荐
    </div>
    <div class="bd mc">
    <ul class="mc">
    <li>
    <a href="/list.html" class="mc_a"><img src="/static/search/./img/5a28b5a1n8a5c095f.jpg" alt=""></a>
    <div class="mc_div">
    <a href="/list.html" class="mc_div_a1">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <p>
    <strong>
    <em class="number J-p-5963064">¥2999.00</em>
    </strong>
    </p>
    <a href="/list.html" class="mc_div_a2">立即抢购</a>
    </div>
    </li>
    <li>
    <a href="/list.html" class="mc_a"><img src="/static/search/./img/59f5eef1n99542494.jpg" alt=""></a>
    <div class="mc_div">
    <a href="/list.html" class="mc_div_a1">
    <em>【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    <p>
    <strong>
    <em class="number J-p-5963064">¥1699.00</em>
    </strong>
    </p>
    <a href="/list.html" class="mc_div_a2">立即抢购</a>
    </div>
    </li>
    <li style="margin-right: 0">
    <a href="/list.html" class="mc_a"><img src="/static/search/./img/59f5eef1n99542494.jpg" alt=""></a>
    <div class="mc_div">
    <a href="/list.html" class="mc_div_a1">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <p>
    <strong>
    <em class="number J-p-5963064">¥2999.00</em>
    </strong>
    </p>
    <a href="/list.html" class="mc_div_a2">立即抢购</a>
    </div>
    </li>
    </ul>
    </div>
    </div>
    <div class="JD_right">
    <div class="hd"> 促销活动</div>
    <div class="bd">
    <ul>
    <li> . <a href="/list.html">红米千元全面屏手机上市</a></li>
    <li> . <a href="/list.html">锤子坚果Pro2火爆预约中</a></li>
    <li> . <a href="/list.html">大牌新品 疯狂抢购</a></li>
    <li> . <a href="/list.html">X20 vivo蓝新色上市</a></li>
    <li> . <a href="/list.html">荣耀畅玩7X新品上市</a></li>
    </ul>
    </div>
    </div>
    </div>
    </div>

    <!--手机-->
    <div class="JD_ipone">
    <div class="JD_ipone_bar">
    <div class="JD_ipone_one a">
    <a href="/list.html">手机</a>
    </div>
    <i><img src="/static/search/image/right-@1x.png" alt=""></i>
    <div class="JD_ipone_one b">
    <a href="/list.html" class="qqq">手机通讯录 <img src="/static/search/image/down-@1x.png" alt=""></a>
    <div>
    <a href="/list.html">手机通讯</a>
    <a href="/list.html">运营商</a>
    <a href="/list.html">手机配件</a>
    <a href="/list.html">手机服务</a>
    </div>
    </div>
    <i><img src="/static/search/image/right-@1x.png" alt=""></i>
    <div class="JD_ipone_one c">
    <a href="/list.html" class="qqq">手机 <img src="/static/search/image/down-@1x.png" alt=""></a>
    <div>
    <a href="/list.html">手机</a>
    <a href="/list.html">老人机</a>
    <a href="/list.html">对讲机</a>
    <a href="/list.html">女性手机</a>
    <a href="/list.html">超续航手机</a>
    <a href="/list.html">全面屏手机</a>
    <a href="/list.html">拍照手机</a>
    <a href="/list.html">游戏手机</a>
    </div>
    </div>
    <!-- 便利面包屑 -->
    <div class="JD_ipone_one c">
    <a th:href="${nav.link}" th:each="nav : ${result.navs}"><span th:text="${nav.name}"></span><span
    th:text="${nav.navValue}"></span> × </a>
    </div>
    <i><img src="/static/search/image/right-@1x.png" alt=""></i>
    </div>
    </div>

    <!--商品筛选和排序-->
    <div class="JD_banner w">
    <div class="JD_nav">
    <div class="JD_selector">
    <!--手机商品筛选-->
    <div class="title">
    <h3><b>手机</b><em>商品筛选</em></h3>
    <div class="st-ext">共&nbsp;<span>10135</span>个商品</div>
    </div>
    <div class="JD_nav_logo" th:with="brandid = ${param.brandId}">
    <!--品牌-->
    <div th:if="${#strings.isEmpty(brandid)}" class="JD_nav_wrap">
    <div class="sl_key">
    <span><b>品牌:</b></span>
    </div>
    <div class="sl_value">
    <div class="sl_value_logo">
    <ul>
    <li th:each="brand : ${result.brands}">
    <a th:href="${'javascript:searchProduct(&quot;brandId&quot;, ' + brand.brandId + ')'}">
    <img th:src="${brand.brandImg}" alt="">
    <div th:text="${brand.brandName}">
    默认华为(HUAWEI)
    </div>
    </a>
    </li>
    </ul>
    </div>
    </div>
    <div class="sl_ext">
    <a href="/list.html">
    更多
    <i style='background: url("image/search.ele.png")no-repeat 3px 7px'></i>
    <b style='background: url("image/search.ele.png")no-repeat 3px -44px'></b>
    </a>
    <a href="/list.html">
    多选
    <i>+</i>
    <span>+</span>
    </a>
    </div>
    </div>

    <div class="JD_pre">
    <div class="sl_key">
    <span><b>分类:</b></span>
    </div>
    <div class="sl_value">
    <ul>
    <li th:each="catalog : ${result.catalogs}">
    <a th:href="${'javascript:searchProduct(&quot;catalog3Id&quot;, ' + catalog.catalogId + ')'}"
    th:text="${catalog.catalogName}">
    默认分类名字
    </a>
    </li>
    </ul>
    </div>
    <div class="sl_ext">
    <a href="/list.html">
    更多
    <i style='background: url("image/search.ele.png")no-repeat 3px 7px'></i>
    <b style='background: url("image/search.ele.png")no-repeat 3px -44px'></b>
    </a>
    <a href="/list.html">
    多选
    <i>+</i>
    <span>+</span>
    </a>
    </div>
    </div>
    <!--遍历所有需要展示的属性-->
    <div class="JD_pre" th:each="attr : ${result.attrs}"
    th:if="${!#lists.contains(result.attrIds,attr.attrId)}">
    <div class="sl_key">
    <span th:text="${attr.attrName}">属性名字</span>
    </div>
    <div class="sl_value">
    <ul>
    <li th:each="val : ${attr.attrValue}"><a
    th:href="${'javascript:searchProduct(&quot;attrs&quot;, &quot;' + attr.attrId + '_' + val + '&quot;)'}"
    th:text="${val}">显示所有属性值</a></li>
    </ul>
    </div>
    </div>
    </div>
    <div class="JD_show">
    <a href="/list.html">
    <span>
    更多选项( CPU核数、网络、机身颜色 等)
    </span>
    </a>
    </div>
    </div>
    <!--排序-->
    <div class="JD_banner_main">
    <!--商品精选-->
    <div class="JD_con_left">
    <div class="JD_con_left_bar">
    <div class="JD_con_one">
    <div class="mt">
    <h3>商品精选</h3>
    <span>广告</span>
    </div>
    <div class="mc">
    <ul>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/59bf3c47n91d65c73.jpg" alt=""></a>
    <a href="/list.html" title="【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥2999.00</span>
    </strong>
    <span class="mc-ico" title="购买本商品送赠品">
    <i class="goods-icons">赠品</i>
    </span>
    </div>
    <div class="mc_rev">
    已有
    <a href="/list.html" class="number">12466</a>
    人评价
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/59bf3c47n91d65c73.jpg" alt=""></a>
    <a href="/list.html" title="【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥2999.00</span>
    </strong>
    <span class="mc-ico" title="购买本商品送赠品">
    <i class="goods-icons">赠品</i>
    </span>
    </div>
    <div class="mc_rev">
    已有
    <a href="/list.html" class="number">12466</a>
    人评价
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/593ba628n8794c6a6.jpg" alt=""></a>
    <a href="/list.html" title="【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥1799.00</span>
    </strong>
    <span class="mc-ico" title="购买本商品送赠品">
    <i class="goods-icons">赠品</i>
    </span>
    </div>
    <div class="mc_rev">
    已有
    <a href="/list.html" class="number">15600</a>
    人评价
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/5919637an271a1301.jpg" alt=""></a>
    <a href="/list.html" title="【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>vivo Xplay6 全网通 6GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥3498.00</span>
    </strong>
    <span class="mc-ico" title="购买本商品送赠品">
    <i class="goods-icons">赠品</i>
    </span>
    </div>
    <div class="mc_rev">
    已有
    <a href="/list.html" class="number">5369</a>
    人评价
    </div>
    </li>
    </ul>
    </div>
    </div>
    <div class="JD_con_one">
    <div class="mt">
    <h3>达人选购</h3>
    </div>
    <div class="mc">
    <ul>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/59bf3c47n91d65c73.jpg" alt=""></a>
    <a href="/list.html">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥2999.00</span>
    </strong>
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/59bf3c47n91d65c73.jpg" alt=""></a>
    <a href="/list.html">
    <em>华为 HUAWEI nova 2S 全面屏四摄 6GB +64GB 曜石黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥2999.00</span>
    </strong>
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/593ba628n8794c6a6.jpg" alt=""></a>
    <a href="/list.html">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥1799.00</span>
    </strong>
    </div>
    </li>
    <li>
    <a href="/list.html" title="vivo X9s 全网通 4GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待"><img
    src="/static/search/img/5919637an271a1301.jpg" alt=""></a>
    <a href="/list.html">
    <em>vivo Xplay6 全网通 6GB+64GB 磨砂黑 移动联通电信4G手机 双卡双待</em>
    </a>
    <div class="mc_price">
    <strong class="price">
    <span class="J-p-5963064">¥3498.00</span>
    </strong>
    </div>
    </li>
    </ul>
    </div>
    </div>
    <div class="JD_con_one" style="border:none;">
    <div class="mt">
    <h3>商品精选</h3>
    <span>广告</span>
    </div>
    <div class="mc">
    <ul>
    <li>
    <a href="/list.html"><img src="/static/search/img/599a806bn9d829c1c.jpg" alt=""></a>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/593e4de0n5ff878a4.jpg" alt=""></a>
    </li>
    </ul>
    </div>
    </div>
    </div>
    </div>
    <!--综合排序-->
    <div class="JD_con_right">
    <div class="filter">
    <!--综合排序-->
    <div class="filter_top">
    <!-- 不能直接用 param.sort去判断 所以用p来做中间替换 p当作text类型来用-->
    <div class="filter_top_left" th:with="p = ${param.sort}, priceRange = ${param.skuPrice}">
    <!-- 如果 param.sort 是空或者 他是以 hotScore 开头的就设置高亮样式 -->
    <a th:class="${(!#strings.isEmpty(p) && #strings.startsWith(p,'hotScore') && #strings.endsWith(p,'desc'))?'sort_a desc':'sort_a'}"
    sort="hotScore"
    th:attr="style=${(#strings.isEmpty(p) || #strings.startsWith(p,'hotScore'))?'color: #FFF;border-color:#e4393c;background: #e4393c':'color: #333;border-color:#ccc;background: #FFF'}"
    href="/list.html">综合排序 [[${(!#strings.isEmpty(p) && #strings.startsWith(p,'hotScore') &&
    #strings.endsWith(p,'desc'))?'↓':'↑'}]]</a>
    <!-- 排序字段不能为空 并且字段为 saleCount 或者 skuPrice -->
    <a th:class="${(!#strings.isEmpty(p) && #strings.startsWith(p,'saleCount') && #strings.endsWith(p,'desc'))?'sort_a desc':'sort_a'}"
    sort="saleCount"
    th:attr="style=${(!#strings.isEmpty(p) && #strings.startsWith(p,'saleCount'))?'color: #FFF;border-color:#e4393c;background: #e4393c':'color: #333;border-color:#ccc;background: #FFF'}"
    href="/list.html">销量 [[${(!#strings.isEmpty(p) && #strings.startsWith(p,'saleCount') &&
    #strings.endsWith(p,'desc'))?'↓':'↑'}]]</a>
    <a th:class="${(!#strings.isEmpty(p) && #strings.startsWith(p,'skuPrice') && #strings.endsWith(p,'desc'))?'sort_a desc':'sort_a'}"
    sort="skuPrice"
    th:attr="style=${(!#strings.isEmpty(p) && #strings.startsWith(p,'skuPrice'))?'color: #FFF;border-color:#e4393c;background: #e4393c':'color: #333;border-color:#ccc;background: #FFF'}"
    href="/list.html">价格 [[${(!#strings.isEmpty(p) && #strings.startsWith(p,'skuPrice') &&
    #strings.endsWith(p,'desc'))?'↓':'↑'}]]</a>
    <a href="/list.html">评论分</a>
    <a href="/list.html">上架时间</a>
    <!-- #strings.substringAfter(priceRange,"_") -->
    <input id="skuPriceFrom" type="number" style="width: 100px;margin-left: 30px"
    th:value="${#strings.isEmpty(priceRange)?'':#strings.substringBefore(priceRange,'_')}">
    - <input id="skuPriceTo" type="number" style="width: 100px;"
    th:value="${#strings.isEmpty(priceRange)?'':#strings.substringAfter(priceRange,'_')}">
    <button id="skuPriceSearchBtn">确定</button>
    </div>
    <div class="filter_top_right">
    <span class="fp-text">
    <b>1</b><em>/</em><i>169</i>
    </span>
    <a href="/list.html" class="prev"><</a>
    <a href="/list.html" class="next"> > </a>
    </div>
    </div>
    <!--收货地址-->
    <div class="filter_bottom">
    <div class="filter_bottom_left">
    <div class="fs-cell">收货地</div>
    <div class="dizhi">
    <div class="dizhi_show">
    <em>北京朝阳区三环以内</em>
    <b></b>
    </div>
    </div>
    <div class="dizhi_con">
    <ul id="tab">
    <li id="tab1" value="1">北京 <img src="/static/search/image/down-@1x.png" alt=""></li>
    <li id="tab2" value="2">朝阳 <img src="/static/search/image/down-@1x.png" alt=""></li>
    <li id="tab3" value="3">三环以内 <img src="/static/search/image/down-@1x.png" alt="">
    </li>
    </ul>
    <div id="container">
    <div id="content1" style="z-index: 1;">
    <a href="/list.html">北京</a>
    <a href="/list.html">上海</a>
    <a href="/list.html">天津</a>
    <a href="/list.html">重庆</a>
    <a href="/list.html">河北</a>
    <a href="/list.html">山西</a>
    <a href="/list.html">河南</a>
    <a href="/list.html">辽宁</a>
    <a href="/list.html">吉林</a>
    <a href="/list.html">黑龙江</a>
    <a href="/list.html">内蒙古</a>
    <a href="/list.html">江苏</a>
    <a href="/list.html">山东</a>
    <a href="/list.html">安徽</a>
    <a href="/list.html">浙江</a>
    <a href="/list.html">福建</a>
    <a href="/list.html">湖北</a>
    <a href="/list.html">湖南</a>
    <a href="/list.html">广东</a>
    <a href="/list.html">广西</a>
    <a href="/list.html">江西</a>
    <a href="/list.html">四川</a>
    <a href="/list.html">海南</a>
    <a href="/list.html">贵州</a>
    <a href="/list.html">云南</a>
    <a href="/list.html">西藏</a>
    <a href="/list.html">陕西</a>
    <a href="/list.html">甘肃</a>
    <a href="/list.html">青海</a>
    <a href="/list.html">宁夏</a>
    <a href="/list.html">新疆</a>
    <a href="/list.html">港澳</a>
    <a href="/list.html">台湾</a>
    <a href="/list.html">钓鱼岛</a>
    <a href="/list.html">海外</a>

    </div>
    <div id="content2">
    <a href="/list.html">朝阳区</a>
    <a href="/list.html">海淀区</a>
    <a href="/list.html">西城区</a>
    <a href="/list.html">东城区</a>
    <a href="/list.html">大兴区</a>
    <a href="/list.html">丰台区</a>
    <a href="/list.html">昌平区</a>
    <a href="/list.html">顺义区</a>

    </div>
    <div id="content3">
    <a href="/list.html">三环以内</a>
    <a href="/list.html">管庄</a>
    <a href="/list.html">北苑</a>
    <a href="/list.html">定福庄</a>
    <a href="/list.html">三环到四环之间</a>
    <a href="/list.html">四环到五环之间</a>
    <a href="/list.html">五环到六环之间</a>
    </div>
    </div>
    </div>
    </div>
    <div class="filter_bottom_right">
    <ul>
    <li>
    <a href="/list.html">
    <i></i>
    谷粒商城配送
    </a>
    </li>
    <li>
    <a href="/list.html">
    <i></i>
    京尊达 </a>
    </li>
    <li>
    <a href="/list.html">
    <i></i>
    货到付款
    </a>
    </li>
    <li>
    <a href="#" th:with="check=${param.hasStock}">
    <input id="showHasStock" type="checkbox"
    th:checked="${#strings.equals(check,'1')?true:false}">
    仅显示有货
    </a>
    </li>
    <li>
    <a href="/list.html">
    <i></i>
    可配送全球
    </a>
    </li>
    </ul>
    </div>

    </div>
    <!--排序内容; 商品 每四个是一组-->
    <div class="rig_tab">
    <div th:each="product : ${result.getProducts()}">
    <div class="ico">
    <i class="iconfont icon-weiguanzhu"></i>
    <a href="/list.html">关注</a>
    </div>
    <p class="da">
    <a th:href="|http://item.gulimall.com/${product.skuId}.html|">
    <img th:src="${product.skuImg}" class="dim">
    </a>
    </p>
    <ul class="tab_im">
    <li><a href="/list.html" title="黑色">
    <img th:src="${product.skuImg}"></a></li>
    </ul>
    <p class="tab_R">
    <span th:text="'¥' + ${product.skuPrice}">¥5199.00</span>
    </p>
    <p class="tab_JE">
    <a href="/list.html" th:utext="${product.skuTitle}">
    HUAWEI P40 Pro+ 麒麟990 5G 流光幻镜 套餐二 麒麟990 5G SoC芯片 5000万超感知徕卡五摄 100倍双目变焦 全网通5G
    </a>
    </p>
    <p class="tab_PI">已有<span>11万+</span>热门评价
    <a href="/list.html">二手有售</a>
    </p>
    <p class="tab_CP"><a href="/list.html" title="谷粒商城Apple产品专营店">谷粒商城Apple产品...</a>
    <a href='#' title="联系供应商进行咨询">
    <img src="/static/search/img/xcxc.png">
    </a>
    </p>
    <div class="tab_FO">
    <div class="FO_one">
    <p>自营
    <span>谷粒商城自营,品质保证</span>
    </p>
    <p>满赠
    <span>该商品参加满赠活动</span>
    </p>
    </div>
    </div>
    </div>
    </div>
    <!--分页-->
    <div class="filter_page">
    <div class="page_wrap">
    <span class="page_span1">
    <a class="page_a" th:attr="pn=${result.pageNum - 1}" th:href="${result.pageNum - 1}"
    th:if="${result.pageNum > 1}">
    < 上一页
    </a>
    <a class="page_a"
    th:attr="pn=${nav},style=${nav == result.pageNum? 'border: 0;color:#ee2222;background: #fff':''}"
    th:each="nav : ${result.pageNavs}">[[${nav}]]</a>
    <a class="page_a" th:attr="pn=${result.pageNum + 1}" th:href="${result.pageNum + 1}"
    th:if="${result.pageNum < result.totalPages}">
    下一页 >
    </a>
    </span>
    <span class="page_span2">
    <em>共<b>[[${result.totalPages}]]</b>页&nbsp;&nbsp;到第</em>
    <input type="number" value="1">
    <em>页</em>
    <a class="page_submit">确定</a>
    </span>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>

    <!--商品精选-->
    <div class="JD_jx">
    <div class="JD_jx_title">
    <div class="mt">
    <strong class="mt-title">商品精选</strong>
    <img src="/static/search/image/u-ad.gif" alt="">
    </div>
    <div class="mc">
    <ul>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="【假的页面】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <img src="/static/search/img/5a25ffc7N98b35d49.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="【假的页面】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    <span class="mc_ico" title="购买本商品送赠品">赠品</span>
    </div>
    <div class="mc_rev">
    <a href="/list.html">15930</a>
    <span>人好评</span>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <img src="/static/search/img/5a25ffc7N98b35d49.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    <span class="mc_ico" title="购买本商品送赠品">赠品</span>
    </div>
    <div class="mc_rev">
    <a href="/list.html">15930</a>
    <span>人好评</span>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <img src="/static/search/img/5a25ffc7N98b35d49.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    <span class="mc_ico" title="购买本商品送赠品">赠品</span>
    </div>
    <div class="mc_rev">
    <a href="/list.html">15930</a>
    <span>人好评</span>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <img src="/static/search/img/5a25ffc7N98b35d49.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    <span class="mc_ico" title="购买本商品送赠品">赠品</span>
    </div>
    <div class="mc_rev">
    <a href="/list.html">15930</a>
    <span>人好评</span>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <img src="/static/search/img/5a25ffc7N98b35d49.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="【假的页面版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待">
    <em>【预约版】华为 HUAWEI 畅享7S 全面屏双摄 4GB +64GB 黑色 移动联通电信4G手机 双卡双待</em>
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    <span class="mc_ico" title="购买本商品送赠品">赠品</span>
    </div>
    <div class="mc_rev">
    <a href="/list.html">15930</a>
    <span>人好评</span>
    </div>
    </li>
    </ul>


    </div>
    </div>
    </div>

    <!--猜你喜欢-->
    <div class="JD_cnxh">
    <div class="JD_jx_title">
    <div class="mt">
    <strong class="mt-title">猜你喜欢</strong>
    <a href="/list.html">
    <img src="/static/search/image/update.png" alt="">
    换一批
    </a>
    </div>
    <div class="mc">
    <ul>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="假的诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/59bf3c47n91d65c73.jpg" alt="">
    </a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="假的诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>假的 诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a28b5c6Ndec5088f.jpg" alt=""></a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="假的 诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>假的 诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="假的 诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机"><img
    src="/static/search/img/593e4de0n5ff878a4.jpg" alt=""></a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机"><img
    src="/static/search/img/593e4de0n5ff878a4.jpg" alt=""></a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机"><img
    src="/static/search/img/59c493a7N3f9b9c85 (1).jpg" alt=""></a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机"><img
    src="/static/search/img/59c493a7N3f9b9c85 (1).jpg" alt=""></a>
    </div>
    <div class="mc_name">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <em>诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机</em>
    </a>
    </div>
    <div class="mc_rev">
    <a href="/list.html">已有80万+人评价</a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥1999.00</span>
    </strong>
    </div>

    </li>
    </ul>


    </div>
    </div>
    </div>

    <!--我的足迹-->
    <div class="JD_zuji">
    <div class="JD_jx_title">
    <div class="mt">
    <strong class="mt-title">我的足迹</strong>
    <a href="/list.html">
    更多浏览记录
    </a>
    </div>
    <div class="mc">
    <ul>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/59e58a11Nc38676d5.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥2998.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a28acccN73689386.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥88.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a1690ddN441b5dce.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥199.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a02bde7N7d4453b1.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥799.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a122dbeN044ebf19.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥599.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/59c493a7N3f9b9c85.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥699.00</span>
    </strong>
    </div>
    </li>
    <li>
    <div class="mc_img">
    <a href="/list.html" title="诺基亚 7 (Nokia 7) 4GB+64GB 黑色 全网通 双卡双待 移动联通电信4G手机">
    <img src="/static/search/img/5a08f6f6N5bab2c1c.jpg" alt="">
    </a>
    </div>
    <div class="mc_price">
    <strong>
    <span>¥715.00</span>
    </strong>
    </div>
    </li>
    </ul>

    </div>
    </div>
    </div>

    <div style="width: 1210px;margin: 0 auto;margin-bottom: 10px"><img src="/static/search/img/5a33a2e0N9a04b4af.jpg"
    alt=""></div>
    <!--底部-->
    <footer class="footer">
    <div class="footer_top">
    <ul>
    <li>
    <span></span>
    <h3>品类齐全,轻松购物</h3>
    </li>
    <li>
    <span></span>
    <h3>多仓直发,极速配发</h3>
    </li>
    <li>
    <span></span>
    <h3>正品行货,精致服务</h3>
    </li>
    <li>
    <span></span>
    <h3>天天低价,畅选无忧</h3>
    </li>
    </ul>
    </div>
    <div class="footer_center">
    <ol>
    <li>购物指南</li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">购物流程</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">会员介绍</a>
    </li>
    <li><a href="/list.html">生活旅行</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">常见问题</a>
    </li>
    <li><a href="/list.html">大家电</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">联系客服</a>
    </li>
    </ol>
    <ol>
    <li>配送方式</li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">上门自提</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">211限时达</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">配送服务查询</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">配送费收取标准</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">海外配送</a>
    </li>
    </ol>
    <ol>
    <li>支付方式</li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">货到付款</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">在线支付</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">分期付款</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">邮局汇款</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">公司转账</a>

    </li>
    </ol>
    <ol>
    <li>售后服务</li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">售后政策</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">价格保护</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">退款说明</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">返修/退换货</a>
    </li>
    <li><a href="/list.html">取消订单</a>
    </li>
    </ol>
    <ol>
    <li>特色服务</li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">夺宝岛</a>
    </li>
    <li><a href="/list.html">DIY装机</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">延保服务</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">谷粒商城E卡</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">谷粒商城通信</a>
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">谷粒商城gulimall+</a>
    </li>
    </ol>
    <ol>
    <li>谷粒商城自营覆盖区域</li>
    <li>
    谷粒商城已向全国2661个区县提供自<br> 营配送服务,支持货到付款、
    <br> POS机刷卡和售后上门服务。
    </li>
    <li><a href="/list.html" style="color: rgb(114, 114, 114);">查看详情&gt;</a>
    </li>
    </ol>
    </div>
    <div class="footer_foot">
    <p class="footer_p p1">
    <a href="/list.html">关于我们</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">联系我们</a>
    <span></span>
    <a href="/list.html">联系客服</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">合作招商</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">商家帮助</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">营销中心</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">手机谷粒商城</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">友情链接</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">销售联盟</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">谷粒商城社区</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">风险监测</a>
    <span></span>
    <a href="/list.html">隐私政策</a>
    <span></span>
    <a href="/list.html">谷粒商城公益</a>
    <span></span>
    <a href="/list.html" style="color: rgb(114, 114, 114);">English Site</a>
    <span></span>
    <a href="/list.html">media &amp; IR</a>
    </p>
    <p class="footer_p">
    <a href="/list.html">湘ICP备20010402号</a>
    <span></span>
    <a href="/list.html">湘ICP证20010402号</a>
    <span></span>
    <a href="/list.html">互联网药品信息服务资格证编号(京)-经营性-2014-0008</a>
    <span></span>
    <a href="/list.html">新出发京零 字第大120007号</a>
    </p>
    <p class="footer_p">
    <a href="/list.html">互联网出版许可证编号新出网证(京)字150号</a>
    <span></span>
    <a href="/list.html">出版物经营许可证</a>
    <span></span>
    <a href="/list.html">网络文化经营许可证京网文[2014]2148-348号</a>
    <span></span>
    <a href="/list.html">违法和不良信息举报电话:4006561155</a>
    </p>
    <p class="footer_p">
    <a href="/list.html">Copyright © 2004 - 2017 谷粒商城JD.com 版权所有</a>
    <span></span>
    <a href="/list.html">消费者维权热线:4006067733</a>
    <a href="/list.html">经营证照</a>
    </p>
    <p class="footer_p">
    <a href="/list.html">谷粒商城旗下网站:</a>
    <a href="/list.html">谷粒商城支付</a>
    <span></span>
    <a href="/list.html">谷粒商城云</a>
    </p>
    <ul>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    <li></li>
    </ul>
    </div>
    </footer>

    <!--右侧侧边栏-->
    <div class="header_bar">
    <div class="header_bar_box">
    <ul>
    <li>
    <a href="/list.html"><img src="/static/search/img/wo.png"/></a>
    <div class="div">
    <a href="/list.html">谷粒商城会员</a>
    </div>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/gouwuche.png"/></a>
    <div class="div">
    <a href="/list.html">购物车</a>
    </div>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/taoxin.png"/></a>
    <div class="div">
    <a href="/list.html">我的关注</a>
    </div>
    </li>

    <li>
    <a href="/list.html"><img src="/static/search/img/shi.png"/></a>
    <div class="div">
    <a href="/list.html">我的足迹</a>
    </div>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/xinxi.png"/></a>
    <div class="div">
    <a href="/list.html">我的消息</a>
    </div>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/qianbao.png"/></a>
    <div class="div">
    <a href="/list.html">资讯JIMI</a>
    </div>
    </li>
    </ul>
    <ul>
    <li>
    <a href="/list.html"><img src="/static/search/img/fa3f24a70d38bd439261cb7439e517a5.png"/></a>
    <div class="div">
    <a href="/list.html">顶部</a>
    </div>
    </li>
    <li>
    <a href="/list.html"><img src="/static/search/img/xinxi.png"/></a>
    <div class="div">
    <a href="/list.html">反馈</a>
    </div>
    </li>
    </ul>
    </div>
    </div>

    <script>
    $(".sl_ext a:nth-child(1)").hover(function () {
    $(this).children("b").stop(true).animate({top: "3px"}, 50);
    $(this).children("i").stop(true).animate({top: "-23px"}, 50)
    }, function () {
    $(this).children("b").stop(true).animate({top: "24px"}, 50);
    $(this).children("i").stop(true).animate({top: "3px"}, 50)
    });
    $(".sl_ext a:nth-child(2)").hover(function () {
    $(this).children("span").stop(true).animate({top: "-1px"}, 100);
    $(this).children("i").stop(true).animate({top: "-14px"}, 100).css({display: "none"})
    }, function () {
    $(this).children("span").stop(true).animate({top: "14px"}, 100);
    $(this).children("i").stop(true).animate({top: "-1px"}, 100).css({display: "block"})
    });
    $('.tab_im img').hover(function () {
    var a = $(this).prop('src');
    var index = $(this).parents('li').index();
    $(this).parents('li').css('border', '2px solid red').siblings('li').css('border', '1px solid #ccc');
    $(this).parents('ul').prev().find('img').prop('src', a);
    $(this).parents('ul').siblings('.tab_JE').find('a').eq(list).css('display', 'block').siblings('a').css('display', 'none');
    $(this).parents('ul').siblings('.tab_R').find('span').eq(list).css('display', 'block').siblings('span').css('display', 'none')
    });

    $(".JD_ipone_one").hover(function () {
    $(this).children("div").css({display: "block"})
    }, function () {
    $(this).children("div").css({display: "none"})
    });

    $("#tab>li").click(function () {
    var i = $(this).index();
    $("#container>div").hide().eq(i).show()
    });
    $(".dizhi_show").hover(function () {
    $(".dizhi_con").css({display: "block"})
    }, function () {
    $(".dizhi_con").css({display: "none"})
    });
    $(".dizhi_con").hover(function () {
    $(this).css({display: "block"})
    }, function () {
    $(this).css({display: "none"})
    });
    //显示隐藏
    var $li = $(".JD_nav_logo>div:gt(3)").hide();
    $('.JD_show span').click(function () {
    if ($li.is(':hidden')) {
    $li.show();
    $(this).css({width: "86px"}).text('收起 ^');
    } else {
    $li.hide();
    $('.JD_show span').css({width: "291px"}).text('更多选项( CPU核数、网络、机身颜色 等)');
    }
    return false;
    });


    $(".rig_tab>div").hover(function () {
    var i = $(this).index();
    $(this).find('.ico').css({display: 'block'}).stop(true).animate({top: "190px"}, 300)
    }, function () {
    var i = $(this).index();
    $(this).find('.ico').css({display: 'none'}).stop(true).animate({top: "230px"})
    });

    $('.header_main_left>ul>li').hover(function () {
    $(this).css({
    background: "#f0f0f0"
    }).find('.header_main_left_main').stop(true).fadeIn(300)
    }, function () {
    $(this).css({
    background: "#fff"
    }).find(".header_main_left_a").css({
    color: "#000"
    });
    $(this).find('.header_main_left_main').stop(true).fadeOut(100)
    });
    $(".header_sj a").hover(function () {
    $(this).css({
    background: "#444"
    })
    }, function () {
    $(this).css({
    background: "#6e6568"
    })
    });


    $(".nav_li1 a").hover(function () {
    $(".header_main_left").stop(true).fadeIn()
    }, function () {
    $(".header_main_left").stop(true).fadeOut()
    });
    $(".header_main_left").hover(function () {
    $(this).stop(true).fadeIn()
    }, function () {
    $(this).stop(true).fadeOut()
    });


    //右侧侧边栏
    $(".header_bar_box ul li").hover(function () {
    $(this).css({
    background: "#7A6E6E"
    }).children(".div").css({
    display: "block"
    }).stop(true).animate({
    left: "-60px"
    }, 300)
    }, function () {
    $(this).css({
    background: "#7A6E6E"
    }).children(".div").css({
    display: "none"
    }).stop(true).animate({
    left: "0"
    }, 300)
    });


    //底部
    $(".footer_foot .p1 a").hover(function () {
    $(this).css("color", "#D70B1C")
    }, function () {
    $(this).css("color", "#727272")
    });

    $(".footer .footer_center ol li a").hover(function () {
    $(this).css("color", "#D70B1C")
    }, function () {
    $(this).css("color", "#727272")
    })

    function searchProduct(name, value) {
    location.href = replaceAndAddParamVal(location.href, name, value, true);
    }

    function searchByKeyword() {
    searchProduct("keyword", $("#keyword_input").val());
    }

    $(".page_a").click(function () {
    var pn = $(this).attr("pn");
    var href = location.href;
    if (href.indexOf("pageNum") != -1) {
    // 路劲包含这个就进行替换
    location.href = replaceAndAddParamVal(href, "pageNum", pn);
    } else {
    location.href = location.href + "&pageNum=" + pn;
    }
    return false;
    })

    function replaceAndAddParamVal(url, paramName, replaceVal, forceAdd) {
    var oUrl = url.toString();
    // 有pageNum参数就是替换 否则就是添加
    var nUrl = "";
    if (oUrl.indexOf(paramName) != -1) {
    if (forceAdd) {
    if (oUrl.indexOf("?") != -1) {
    nUrl = oUrl + "&" + paramName + "=" + replaceVal;
    } else {
    nUrl = oUrl + "?" + paramName + "=" + replaceVal;
    }
    } else {
    // /(skuPrice=)([^&]*)/gi
    var re = eval('/(' + paramName + '=)([^&]*)/gi');
    var nUrl = oUrl.replace(re, paramName + '=' + replaceVal);
    }
    } else {
    if (oUrl.indexOf("?") != -1) {
    nUrl = oUrl + "&" + paramName + "=" + replaceVal;
    } else {
    nUrl = oUrl + "?" + paramName + "=" + replaceVal;
    }
    }
    return nUrl;
    }

    $(".sort_a").click(function () {
    // 改变样式
    // changeStyle(this);
    $(this).toggleClass("desc")
    // 跳转到指定位置
    var sort = $(this).attr("sort");
    sort = $(this).hasClass("desc") ? sort + "_desc" : sort + "_asc";
    location.href = replaceAndAddParamVal(location.href, "sort", sort);
    return false;
    })

    // 当点击的时候改变按钮样式
    function changeStyle(ele) {
    // 默认样式 color: #333;border-color:#ccc;background: #FFF
    // 高亮样式 color: #FFF;border-color:#e4393c;background: #e4393c
    // 1.清空之前元素的样式 改变当前被点击的元素变成被选中状态
    $(".sort_a").css({"color": "#333", "border-color": "#ccc", "background": "#FFF"})
    // 去掉兄弟元素的标志
    $(".sort_a").each(function () {
    var text = $(this).text().replace("↓", "").replace("↑", "");
    $(this).text(text);
    })
    $(ele).css({"color": "#FFF", "border-color": "#e4393c", "background": "#e4393c"})
    // 2.改变升降序 被点击自动加上 desc的样式 再次点击就会取消
    var text = $(ele).text().replace("↓", "").replace("↑", "");
    $(ele).toggleClass("desc")
    if ($(ele).hasClass("desc")) {
    // 降序
    text = text + "↓";
    } else {
    text = text + "↑";
    }
    $(ele).text(text);
    }

    $("#skuPriceSearchBtn").click(function () {
    // 1.拼上价格区间
    var from = $("#skuPriceFrom").val();
    var to = $("#skuPriceTo").val();

    var query = from + "_" + to;

    location.href = replaceAndAddParamVal(location.href, "skuPrice", query);
    })

    $("#showHasStock").change(function () {
    // 如果是 true 选择有库存的
    if ($(this).prop('checked')) {
    location.href = replaceAndAddParamVal(location.href, "hasStock", 1)
    } else {
    // 没选中的状态
    var re = eval('/(hasStock=)([^&]*)/gi');
    location.href = (location.href + "").replace(re, '');
    }
    return false;
    })
    </script>
    </body>
    </html>

首页配置域名访问

域名访问流程:

  1. 输入域名访问到服务器
  2. 服务器的Nginx反向代理请求到网关
  3. 网关代理请求到微服务集群
  1. 配置Hosts文件,完成第一步使域名可以顺利访问到服务器(或者你有公网服务器+域名直接用线上环境也行)

  2. 配置Nginx代理请求到网关

    • 配置Server块

      我直接将原有default.conf删除了

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      11
      12
      13
      14
      15
      16
      17
      18
      server {
      listen 80;
      server_name gulimall.com *.gulimall.com localhost;

      #charset koi8-r;
      #access_log /var/log/nginx/log/host.access.log main;

      # 静态资源目录,将product项目的static目录拷贝到/mydata/nginx/html目录中
      location /static {
      root /usr/share/nginx/html;
      }

      location / {
      proxy_pass http://gulimall;
      proxy_set_header Host $host;
      }

      }
    • 配置Http块

      1
      2
      3
      upstream gulimall {
      server 192.168.149.1:88;
      }
  3. 网关配置路由规则

    1
    2
    3
    4
    - id: gulimall_host_route
    uri: lb://gulimall-product
    predicates:
    - Host=**.gulimall.com,gulimall.com
  4. 测试效果

文章作者: imxushuai
文章链接: https://www.imxushuai.com/2021/12/25/46.谷粒商城-分布式高级篇-01/
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 imxushuai
支付宝打赏
微信打赏