README.md 10.8 KB
Newer Older
1
<p align="center">
H
haoxr 已提交
2
    <img src="https://img.shields.io/badge/SpringBoot-2.7.5-brightgreen.svg"/>
3
    <img src="https://img.shields.io/badge/SpringCloud & Alibaba -2021-green.svg"/>
4 5 6 7 8 9
    <a src="https://github.com/hxrui" target="_blank">
        <img src="https://img.shields.io/github/stars/youlaitech/youlai-mall.svg?style=social&label=Stars"/>
    </a>
    <a href="https://gitee.com/youlaitech/youlai-mall" target="_blank">
        <img src="https://gitee.com/youlaitech/youlai-mall/badge/star.svg"/>
    </a> 
10
    <br/>
11 12 13 14
    <img src="https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg"/>
    <a href="https://gitee.com/youlaiorg" target="_blank">
        <img src="https://img.shields.io/badge/Author-有来开源组织-orange.svg"/>
    </a>
15
</p>
16

17
<p align="center">
18 19
<a target="_blank" href="https://www.youlai.tech">官方文档</a> |
<a target="_blank" href="https://www.cnblogs.com/haoxianrui/"> 团队博客</a> 
20 21
</p>

22
## 🈶项目简介
23

24
[youlai-mall](https://gitee.com/haoxr) 是基于Spring Boot 2.7、Spring Cloud 2021 & Alibaba 2021、Vue3、Element-Plus、uni-app等全栈主流技术栈构建的开源商城项目,涉及 [后端微服务](https://gitee.com/youlaitech/youlai-mall)[前端管理](https://gitee.com/youlaitech/youlai-mall-admin)[微信小程序](https://gitee.com/youlaitech/youlai-mall-weapp)[APP应用](https://gitee.com/youlaitech/youlai-mall-weapp)等多端的开发。
25

26
##  ✨项目特色
27

28
- 项目使用皆是当前主流前后端技术栈(持续更新...),无过度自定义封装,易理解学习和二次扩展;
29
- 极速启动模式,无条件提供线上环境,1分钟之内拥有微服务环境;
30
- SpringBoot 2.7、SpringCloud 2021 & Alibaba 2021 一站式微服务开箱即用的解决方案;
31
- Spring Security OAuth2 、 Spring Cloud Gateway 、 JWT 统一认证鉴权和常用 OAuth2 授权模式扩展;
32
- 移动端采用终极跨平台解决方案 uni-app, 一套代码编译iOS、Android、H5和小程序等多个平台;
33
- Jenkins、K8s、Docker实现微服务持续集成与交付(CI/CD)。
34

35
## 💎在线演示
36

37 38 39 40 41 42 43
| 项目       | 演示地址                                      | 备用地址                                 |
| ---------- | --------------------------------------------- | ---------------------------------------- |
| 商城管理端 | https://admin.youlai.tech                     | http://vue3.youlai.tech                  |
| 移动应用端 | http://app.youlai.tech                        |                                          |
| 接口文档   | https://api.youlai.tech/doc.html              |                                          |
| 官网地址   | https://www.youlai.tech                       | https://doc.youlai.tech                  |
| 官方博客   | [博客园](https://www.cnblogs.com/haoxianrui/) | [CSDN](https://blog.csdn.net/u013737132) |
44

H
haoxr 已提交
45
## 💫源码地址
46

47 48 49 50 51
| 项目       | Gitee                                                  | Github                                                   | GitCode |
| ---------- | ------------------------------------------------------ | -------------------------------------------------------- | ------- |
| 微服务后端 | [youlai-mall](https://gitee.com/youlaiorg/youlai-mall) | [youlai-mall](https://github.com/youlaitech/youlai-mall) | -       |
| 商城管理端 | [mall-admin](https://gitee.com/youlaiorg/mall-admin)   | [mall-admin](https://github.com/youlaitech/mall-admin)   | -       |
| 移动应用端 | [mall-app](https://gitee.com/youlaiorg/mall-app)       | [mall-app](https://github.com/youlaitech/mall-app)       | -       |
H
haoxianrui@ 已提交
52

H
haoxr 已提交
53
##  🗂目录结构
H
haoxr 已提交
54

55
``` cassandra
H
haoxr 已提交
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
youlai-mall
├── docs  
    ├── nacos      -- Nacos配置
    ├── sql        -- SQL脚本
├── laboratory     -- 实验室
├── mall-oms       -- 订单服务
├── mall-pms       -- 商品服务
├── mall-sms       -- 营销服务
├── mall-ums       -- 会员服务
├── middleware     -- 中间件(nacos/seata)
├── youlai-auth    -- OAuth2认证授权中心
├── youlai-common  -- 公共依赖
├── youlai-gateway -- 网关
├── youlai-system  -- 系统服务
└── end
```
72

H
haoxr 已提交
73
## 🥇极速启动
74

75
> `极速启动` 是方便快速启动查看效果的启动方式,其中的数据库和Redis等中间件使用的是有来提供的云环境,切勿修改数据,有时间条件建议`本地启动`。
76

H
haoxr 已提交
77
1. **启动Nacos**
78

79

80
- IDEA 打开命令行终端 Terminal,输入 `cd middleware/nacos/bin` 切换到 Nacos 的 bin 目录,执行 `startup -m standalone` 启动 Nacos 服务。
81

82

83
2. **服务启动**
84

85
   - `youlai-gateway` 模块的启动类 GatewayApplication 启动网关;
86

87
   - `youlai-auth` 模块的启动类 AuthApplication 启动认证中心;
88

89
   - `youlai-system``system-boot` 模块的启动类 AdminApplication 启动系统服务;
90

91
   - 至此完成基础服务的启动,商城服务按需启动,启动方式和 `youlai-system` 一致;
92

93
   - 访问接口文档地址测试: [http://localhost:9999/doc.html](http://localhost:9999/doc.html)
94

H
haoxr 已提交
95
## 🥈本地启动
96

97
1. **中间件安装**
98

99
   > 为了避免数据和线上环境冲突,MySQL 和 Redis 必装,其他不安装可默认使用有来线上环境(🔴必装 ⚪可选)
100

101 102 103
   - 🔴 MySQL &nbsp;&nbsp;[Linux部署](https://www.youlai.tech/pages/vjoqc/)
   - 🔴 Redis &nbsp;&nbsp;[Linux部署](https://www.youlai.tech/pages/k2a20/)
   - ⚪ RabbitMQ &nbsp;&nbsp;[Linux部署](https://www.youlai.tech/pages/8znee/)
H
haoxr 已提交
104
   - ⚪ Seata &nbsp;&nbsp;[本地启动](https://www.youlai.tech/pages/0bzvi/) &nbsp; |&nbsp;[Linux部署](https://www.youlai.tech/pages/4vjq5/)
105 106
   - ⚪ Sentinel &nbsp;&nbsp;[本地启动]() &nbsp; | &nbsp;[Linux部署]()
   - ⚪ Canal &nbsp;&nbsp;[本地启动]() &nbsp; | &nbsp;[Linux部署]()
107

108
2. **数据库创建和数据初始化**
郝先瑞 已提交
109

110
   - **系统数据库**
111

112
     进入 `docs/sql` 目录 , 根据 MySQL 版本选择对应的脚本;
113

114
     先执行 `database.sql` 完成数据库的创建;
H
hxrui 已提交
115

116
     再执行 `youlai.sql` 、`oauth2.sql`、`mall_*.sql` 完成数据表的创建和数据初始化。
H
hxrui 已提交
117

118
   - **Nacos 数据库**
119

120
     创建名为 `nacos` 的数据库,执行 `middleware/nacos/conf/nacos-mysql.sql` 脚本完成 Nacos 数据库初始化。
H
hxrui 已提交
121

122
3. **Nacos 配置持久化至 MySQL**
123

124
   进入项目的 `middleware/nacos/conf/application.properties` 文件修改 Nacos 配置的数据连接,需要修改配置如下:
125

126 127 128 129 130 131 132
   ```properties
   spring.datasource.platform=mysql
   db.num=1
   db.url.0=jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
   db.user.0=root
   db.password.0=123456
   ```
133

134 135 136
4. **导入Nacos配置**

   IDEA 打开命令行终端 Terminal,输入 `cd middleware/nacos/bin` 切换到 Nacos 的 bin 目录,执行 `startup -m standalone` 启动 Nacos 服务。
137

138
   打开浏览器,地址栏输入 Nacos 控制台的地址 [ http://localhost:8848/nacos]( http://localhost:8848/nacos)
139

140
   输入用户名/密码:nacos/nacos ;
141

142
   进入控制台,点击左侧菜单 `配置管理``配置列表` 进入列表页面,点击 `导入配置` 选择项目中的 `docs/nacos/nacos_config.zip` 文件。
143

144
5. **修改Nacos配置**
145

146
   在 Nacos 控制台配置列表选择共享配置 `youlai-common.yaml` 进行编辑,修改 MySQL、Redis、RabbitMQ等中间件信息为您自己本地环境,默认「有来」线上环境。
147

148
6. **修改Nacos配置中心地址**
149

150
   批量替换应用的 bootstrap-dev.yml 文件的配置中心地址 `http://c.youlai.tech:8848``http://localhost:8848` ,默认「有来」线上的配置中心地址。
151

152
7. **服务启动**
153

154
   - 进入 `youlai-gateway` 模块的启动类 GatewayApplication 启动网关;
155

156
   - 进入 `youlai-auth` 模块的启动类 AuthApplication 启动认证授权中心;
157

158
   - 进入 `youlai-system``system-boot` 模块的启动类 AdminApplication 启动系统服务;
159

160
   - 至此完成基础服务的启动,商城服务按需启动,启动方式和 `youlai-system` 一致;
161

162
   - 访问接口文档地址测试:  [http://localhost:9999/doc.html](http://localhost:9999/doc.html)
163

164
##  🧩项目截图
H
hxrui 已提交
165

166 167 168 169 170
| 「App」Spring Security OAuth2 手机短信验证码模式             | 「小程序」Spring Security OAuth2 微信授权模式                |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| <img src="https://www.youlai.tech/files/blog/smsauth.gif" width="100%" height="400px"/> | <img src="https://www.youlai.tech/files/blog/wechatauth.gif" width="100%" height="400px"/> |
| **「管理前端」Spring Security OAuth2 密码模式**              | **「管理前端」Spring Security OAuth2 验证码模式**            |
| <img src="https://www.youlai.tech/files/blog/passwordauth.gif" width="100%" height="400px"/> | <img src="https://www.youlai.tech/files/blog/captchaauth.gif" width="100%" height="400px"/> |
171

172
## 
173

H
haoxr 已提交
174
## 💹趋势统计
175 176


177

178 179
[![Star History Chart](https://api.star-history.com/svg?repos=youlaitech/youlai-mall&type=Timeline)](https://star-history.com/#youlaitech/youlai-mall&Timeline)

H
haoxr 已提交
180
## 💻贡献者们
181 182


183 184 185

<a href="https://github.com/youlaitech/youlai-mall/graphs/contributors"><img src="https://opencollective.com/youlai-mall/contributors.svg?width=890" /></a>

186

187

188

189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207

## 💥加入我们

- 添加开发者微信,备注「有来」进群, 🈲一切利益性行为!

- 开发申请入口:  https://gitee.com/youlaiorg

- 开发者

| ![](https://www.youlai.tech/files/blog/rui.jpg) | ![](https://www.youlai.tech/files/blog/chuan.jpg) |
| ----------------------------------------------- | ------------------------------------------------- |

- 微信公众号

| ![](https://s2.loli.net/2022/11/19/OGjum9wr8f6idLX.png) |
| ------------------------------------------------------- |



H
haoxr 已提交
208
## 📰开源协议
209 210 211 212 213 214 215 216 217

Apache Licence 2.0 是著名的非盈利开源组织Apache采用的协议。该协议鼓励代码共享和尊重原作者的著作权,商用或二次开源须要满足的条件:

- 需要给代码的用户一份Apache Licence。
- 如果你修改了代码,需要在被修改的文件中说明。
- 在延伸的代码中(修改和有源代码衍生的代码中)需要带有原来代码中的协议,商标,专利声明和其他原来作者规定需要包括的说明。
- 如果再发布的产品中包含一个Notice文件,则在Notice文件中需要带有Apache Licence。你可以在Notice中增加自己的许可,但不可以表现为对Apache Licence构成更改。 Apache Licence也是对商业应用友好的许可。使用者也可以在需要的时候修改代码来满足需要并作为开源或商业产品发布/销售。
- 如果你参考或借鉴了本项目的源码,请你在项目的说明文档添加对本项目的引用申明和添加Git仓库地址(https://gitee.com/youlaitech/youlai-mall)。