hfbin / seckill Goto Github PK
View Code? Open in Web Editor NEW🔥🔥🔥 基于 SpringBoot+Mybatis+Redis+RabbitMQ 秒杀系统
🔥🔥🔥 基于 SpringBoot+Mybatis+Redis+RabbitMQ 秒杀系统
我简单看了一下秒杀接口这里
--1、判断是否已经秒杀到了
--2、预减库存
--3、入mq
----4、判断商品数量
----5、判断是否已经秒杀到了
----6、商品库存减一、添加信息进订单、插入秒杀表
疑问:这里上层出现了redis预减库存,但真实减去库存是第六步数据库,这就会出现数据库还有库存,但是redis已经没有库存的情况。
比如:我同一个用户第一次秒杀成功,在订单没生成的时候继续秒杀。这就会出现redis减去了两次,但是在数据库中只减去了一次(极端情况下,数据库减去两次,同一个用户生成两个订单)。
我只是简单的看了下,没有具体运行操作。验证的话,直接在第六步写库之前写一个睡眠延长订单入库时间,请帮我验证并解答一下。
请问具体怎么进入订单详情页啊,输入域名http://localhost:8888/order/detail直接返回一个服务器异常的json字段
//预减库存
long stock = redisService.decr(GoodsKey.getSeckillGoodsStock, "" + goodsId);//10
if (stock < 0) {
localOverMap.put(goodsId, true);
return Result.error(CodeMsg.MIAO_SHA_OVER);
}
//判断是否已经秒杀到了
SeckillOrder order = seckillOrderService.getSeckillOrderByUserIdGoodsId(user.getId(), goodsId);
if (order != null) {
return Result.error(CodeMsg.REPEATE_MIAOSHA);
}
我配置完application文件尝试打开localhost:8888/page/login,浏览器的页面只显示404, 配置文件中的端口,thymeleaf和static的相关配置已经配上了,但是还是打开不了登录界面,页面只显示404,为什么。是不是需要把后端功能完善掉才可以正常打开啊?
SeckillOrderServiceImpl,我看你这里的逻辑,商品的查找更新库存还是直接找的是数据库,那么redis是否很好的发挥了作用呢?
请问大佬有这个项目的完整教程吗?类似视频资源
关键报错信息如下:
#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue 'seckill.queue' in vhost '/', class-id=50, method-id=10)
项目代码未更改,本地RabbitMQ已安装,并且可以打开Manager的web界面,之前没接触过RabbitMQ,网上搜了许多问题解答, 也是看得有点蒙,希望大佬能解答一下,万分感谢!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.