# gulimall **Repository Path**: divide-yan/gulimall ## Basic Information - **Project Name**: gulimall - **Description**: 谷粒商城项目,用于练习电商前后的完整流程以及各种技术的整合 - **Primary Language**: Java - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 1 - **Created**: 2022-03-07 - **Last Updated**: 2022-12-06 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # gulimall #### 介绍 旨在使用流行牛逼的技术打造高可用电商架构。项目后台管理系统采用了前后端分离的开发方式,使用vue+SpringBoot+Cloud的基本脚手架,用户页面的展示采用的是thymeleaf模板引擎,并且服务于服务 之间相互隔离,按照项目的功能模块将all in one拆分成了10个功能模块,2个公共模块以及1个专门负责后台管理系统的模块。 微服务之间采用Nacos作为注册中心和配置中心、OpenFeign进行远程调用、GateWay作为素有服务的入口网关、Sentinel进行熔断降级。搜索模块专门引入了Es、缓存、异步、消息队列等各种技术,并且在 最后使用DevOps进行一站式部署。 #### 笔记总结地址 https://www.yuque.com/queshe-aelrx/my7es1 #### 软件架构 谷粒商城架构图 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/1.jpg) ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/2.png) #### 微服务 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/3.png) #### 访问流程 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/4.png) #### 域名地址配置 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/5.png) #### 部分功能展示 1. ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/6.png) 2. ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/7.png) 3. ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/8.png) 4. ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/9.png) #### 使用说明 1. 使用人人开源的renren-admine和renren-fast生成好后台管理系统的前端和后端代码 2. 使用renren-generate生成项目的基础代码 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/10.png) 3. 服务全部进注册中心 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/11.png) 4. 微服务之间使用域名进行通信。更改本地host文件,并且配置nginx的转发地址 ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/12.png) ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/13.png) ![Image text](https://xmall-guli.oss-cn-beijing.aliyuncs.com/2022-03-25/14.png) 5. 配置网关转发的地址 ```yaml server: port: 88 spring: application: name: gulimall-gateway cloud: gateway: routes: # - id: test_route # uri: https://www.baidu.com # predicates: # - Query=url,baidu # # - id: qq_route # uri: https://www.qq.com # predicates: # - Query=url,qq # 商品相关的网关配置 - id: gulimall-product # 配置名称(随意) uri: lb://gulimall-product # lb:负载均衡 gulimall-product:注册中心中的服务名 predicates: - Path=/api/product/** # 从前端发送过来的所有请求。跳转到商品的服务中 filters: - RewritePath=/api/(?.*),/$\{segment} # 网关的路径重写,从api发送过来的请求,重写到商品服务下 # 秒杀相关的网关配置 - id: gulimall-coupon # 配置名称(随意) uri: lb://gulimall-coupon # lb:负载均衡 gulimall-coupon:注册中心中的服务名 predicates: - Path=/api/coupon/** # 从前端发送过来的所有请求。跳转到优惠的服务中 filters: - RewritePath=/api/(?.*),/$\{segment} # 网关的路径重写,从api发送过来的请求,重写到优惠服务下 # 会员相关的配置 - id: gulimall-member # 配置名称(随意) uri: lb://gulimall-member # lb:负载均衡 gulimall-product:注册中心中的服务名 predicates: - Path=/api/member/** # 从前端发送过来的所有请求。跳转到商品的服务中 filters: - RewritePath=/api/(?.*),/$\{segment} # 网关的路径重写,从api发送过来的请求,重写到商品服务下 # 三方服务的网关配置 - id: gulimall-thirdParty uri: lb://gulimall-third-party predicates: - Path=/api/thirdParty/** filters: - RewritePath=/api/thirdParty/(?.*),/$\{segment} #/renren-fast/ware/wareordertask/list === api/ware/wareordertask/list?t=1648380930186&page=1&limit=10&key= # 库存服务网关配置 - id: gulimall-ware uri: lb://gulimall-ware predicates: - Path=/api/ware/** filters: - RewritePath=/api/(?.*),/$\{segment} # 路由到人人开源的后台(配置越粗,就放在最下面) - id: admin_route # 配置名称(随意) uri: lb://renren-fast # lb:负载均衡 renren-fast:注册中心中的服务名 predicates: - Path=/api/** # 从前端发送过来的所有请求。跳转到renrenfast中 filters: - RewritePath=/api/(?.*),/renren-fast/$\{segment} # 网关的路径重写,从api发送过来的请求,重写到renren-fast下 # 匹配gulimall.com发送到网关,网关转到本地的服务 - id: host_product_route uri: lb://gulimall-product # lb:负载均衡 gulimall-product:注册中心中的服务名 predicates: - Host=gulimall.com,item.gulimall.com # 匹配gulimall.com发送到网关,网关转到本地的服务 - id: host_search_route uri: lb://gulimall-search # lb:负载均衡 gulimall-search:注册中心中的服务名 predicates: - Host=search.gulimall.com # 匹配auth.gulimall.com发送到网关,网关转到本地的服务 - id: host_auth_route uri: lb://gulimall-auth-server # lb:负载均衡 gulimall-auth-server:注册中心中的服务名 predicates: - Host=auth.gulimall.com # 匹配auth.gulimall.com发送到网关,网关转到本地的服务 - id: host_cart_route uri: lb://gulimall-cart # lb:负载均衡 gulimall-cart:注册中心中的服务名 predicates: - Host=cart.gulimall.com # 匹配auth.gulimall.com发送到网关,网关转到本地的服务 - id: host_order_route uri: lb://gulimall-order # lb:负载均衡 gulimall-order:注册中心中的服务名 predicates: - Host=order.gulimall.com - id: host_member_route uri: lb://gulimall-member # lb:负载均衡 gulimall-member :注册中心中的服务名 predicates: - Host=member.gulimall.com - id: host_seckill_route uri: lb://gulimall-seckill # lb:负载均衡 gulimall-seckill :注册中心中的服务名 predicates: - Host=seckill.gulimall.com nacos: discovery: server-addr: 127.0.0.1:8848