【文件属性】:
文件名称:go-secbuy-micro:基于Go-micro微服务的秒杀系统
文件大小:187KB
文件格式:ZIP
更新时间:2021-03-11 16:57:24
系统开源
去买微信
基于Go-micro微服务的秒杀系统
系统架构
一个经典的秒杀场景可以分为如下几个步骤
创建商品的库存信息
检查库存数量,满足数量就扣库存,否则失败
成功扣取库存后创建订单
创建支付记录
依据这个流程,系统分为如下几个服务
库存
订单
支付付款
系统架构:
环境准备
Go和Go-Micro
Micro开发框架和工具
## 安装go-micro
go get github.com/micro/go-micro
## 安装micro
go get github.com/micro/micro
协议
安装好protoc编译器后还需要安装micro服务对应的生成插件。
go get -u github.com/micro/protoc-gen-micro
go get -u github.com/micro/protobuf/protoc-gen-go
Postgres
可以通过doc
【文件预览】:
go-secbuy-micro-master
----stock-srv()
--------conf()
--------plugin.go(14B)
--------go.mod(398B)
--------main.go(892B)
--------proto()
--------utils()
--------go.sum(49KB)
--------model()
--------Dockerfile(65B)
--------README.md(1KB)
--------Makefile(316B)
--------handler()
----secbuy.jpg(12KB)
----payment-srv()
--------conf()
--------plugin.go(14B)
--------go.mod(505B)
--------main.go(1KB)
--------proto()
--------utils()
--------go.sum(45KB)
--------model()
--------Dockerfile(71B)
--------README.md(808B)
--------Makefile(310B)
--------handler()
----basic()
--------basic.go(380B)
--------go.mod(105B)
--------db()
--------go.sum(36KB)
--------config()
----stock-web()
--------plugin.go(14B)
--------go.mod(253B)
--------main.go(787B)
--------go.sum(38KB)
--------Dockerfile(90B)
--------html()
--------README.md(795B)
--------Makefile(202B)
--------handler()
----payment-web()
--------plugin.go(14B)
--------go.mod(382B)
--------main.go(787B)
--------go.sum(39KB)
--------Dockerfile(96B)
--------html()
--------README.md(817B)
--------Makefile(206B)
--------handler()
----test()
--------main.go(2KB)
--------config.json(89B)
----README.md(1KB)
----order-srv()
--------conf()
--------plugin.go(14B)
--------go.mod(632B)
--------main.go(987B)
--------proto()
--------utils()
--------go.sum(52KB)
--------model()
--------Dockerfile(65B)
--------README.md(796B)
--------Makefile(302B)
--------handler()
----order-web()
--------plugin.go(14B)
--------go.mod(433B)
--------main.go(772B)
--------go.sum(48KB)
--------Dockerfile(90B)
--------html()
--------README.md(795B)
--------Makefile(202B)
--------handler()
----.gitignore(16B)