<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>leyou</artifactId> <groupId>com.leyou.parent</groupId> <version>1.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>com.leyou.seckill</groupId> <artifactId>leyou-secskill</artifactId> <dependencies> <!-- eureka --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!-- feign --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> </dependency> <!-- web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--商品微服务--> <dependency> <groupId>com.leyou.item.interface</groupId> <artifactId>leyou-item-interface</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
server: port: 8090 spring: application: name: secskill-service data: elasticsearch: cluster-name: elasticsearch cluster-nodes: 192.168.19.121:9300 rabbitmq: virtual-host: /leyou username: /leyou password: leyou host: 192.168.19.121 jackson: default-property-inclusion: non_null # 配置json处理时忽略空值 resources: add-mappings: true chain: enabled: true gzipped: true html-application-cache: true cache: period: 3600m eureka: client: service-url: defaultZone: http://127.0.0.1:10086/eureka registry-fetch-interval-seconds: 5 instance: instance-id: ${spring.application.name}:${server.port} prefer-ip-address: true #当你获取host时,返回的不是主机名,而是ip ip-address: 127.0.0.1 lease-expiration-duration-in-seconds: 10 #10秒不发送九过期 lease-renewal-interval-in-seconds: 5 #每隔5秒发一次心跳
秒杀商品展示页面:
秒杀商品详情页面:
image、title、price,seckill_stock
和普通商品详情页面一样
package com.leyou.seckill.vo; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Transient; import java.util.Date; /** * @Author: 98050 * @Time: 2018-11-10 11:48 * @Feature: 秒杀商品对象 */ @Table(name = "tb_seckill_spu") public class SeckillGoods { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private Long spuId; private Date startTime; private Date endTime; private Double seckillPrice; private String title; private String subTitle; private String image; @Transient private Integer stock; }
根据传入的商品id数组,将其设置为可以秒杀的商品。