forked from gz-yami/mall4cloud
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98c9864
commit c1fc00e
Showing
46 changed files
with
328 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
`mall4cloud`是一个前后端分离的项目,所以由多个项目组成,如下: | ||
|
||
- `mall4cloud` : java微服务后台代码(包含后台、前端、所有微服务相关的接口) | ||
- `mall4cloud-multishop` : 商家端vue代码 | ||
- `mall4cloud-platform` : 平台端vue代码 | ||
- `mall4cloud-uniapp` : 移动端uniapp代码(包含 H5、小程序、android、ios) |
37 changes: 37 additions & 0 deletions
37
doc/代码目录结构/mall4cloud-multishop、mall4cloud-platform目录结构.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
后台基础框架采用使用mit开源协议的 `vue-element-admin` | ||
|
||
具体可以查看 [vue-element-admin 介绍](https://panjiachen.gitee.io/vue-element-admin-site/zh/guide/) | ||
|
||
https://panjiachen.gitee.io/vue-element-admin-site/zh/guide/ | ||
|
||
``` | ||
├── build # 构建相关 | ||
├── public # 静态资源 | ||
│ │── favicon.ico # favicon图标 | ||
│ └── index.html # html模板 | ||
├── src # 源代码 | ||
│ ├── api # 所有请求(根据不同后台不同的服务分包) | ||
│ ├── assets # 主题 字体等静态资源 | ||
│ ├── components # 全局公用组件 | ||
│ ├── directive # 全局指令 | ||
│ ├── filters # 全局 filter | ||
│ ├── icons # 项目所有 svg icons | ||
│ ├── lang # 国际化 language | ||
│ ├── layout # 全局 layout | ||
│ ├── router # 路由 | ||
│ ├── store # 全局 store管理 | ||
│ ├── styles # 全局样式 | ||
│ ├── utils # 全局公用方法 | ||
│ ├── views # views 所有页面 | ||
│ ├── App.vue # 入口页面 | ||
│ ├── main.js # 入口文件 加载组件 初始化等 | ||
│ └── permission.js # 权限管理 | ||
├── tests # 测试 | ||
├── .env.xxx # 环境变量配置 | ||
├── .eslintrc.js # eslint 配置项 | ||
├── .babelrc # babel-loader 配置 | ||
├── .travis.yml # 自动化CI配置 | ||
├── vue.config.js # vue-cli 配置 | ||
├── postcss.config.js # postcss 配置 | ||
└── package.json # package.json | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
``` | ||
├── public # 公共文件目录 | ||
│ └── index.html # html模版 | ||
├── src # 源代码 | ||
│ ├── components # 公共组件 | ||
│ ├── js_sdk # uniapp第三方插件目录 | ||
│ ├── packageActivities # 活动功能分包 | ||
│ ├── packageShop # 店铺功能分包 | ||
│ ├── pages # 主包 | ||
│ ├── static # 静态资源 | ||
│ │ │── empty-img # 提示图片 | ||
│ │ │── images # 各页面的图片资源 | ||
│ │ └── tabbar # 底部tab栏的图标 | ||
│ ├── utils # 存放通用工具 | ||
│ ├── wxs # wxs文件目录 | ||
│ ├── app.css # 全局样式 | ||
│ ├── App.vue # 入口页面 | ||
│ ├── main.js # 初始化入口文件 | ||
│ ├── mainfest.json # uniapp项目配置文件 | ||
│ ├── pages.json # 全局页面配置文件 | ||
│ ├── popup.css # 公共弹窗css样式 | ||
│ ├── router.js # 导航路由 | ||
│ └── uni.scss # uni-app内置的常用样式变量 | ||
├── .eslintignore # eslint忽略配置 | ||
├── .eslintrc.js # eslint规则制定文件 | ||
├── babel.config.js # babel配置 | ||
├── package-lock.json # 锁定安装时包的版本号 | ||
├── package.json # package.json 项目基本信息 | ||
├── postcss.config # postcss配置文件 | ||
└── vue.config.js # vue-cli 配置 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
> 为了让项目更加方便检测出代码规范的问题,我们在项目中使用的是阿里的规范(详细可以看https://github.com/alibaba/p3c 这里面的[Java开发手册(嵩山版).pdf](https://github.com/alibaba/p3c/blob/master/Java开发手册(嵩山版).pdf)),同时使用 `Alibaba Java Coding Guidelines` 这款插件进行规约扫描 | ||
|
||
|
||
我们先来看下规范当中的目录结构 | ||
|
||
![](../img/目录结构和规范/阿里应用分层.png) | ||
|
||
- 开放 API 层:可直接封装 Service 接口暴露成 RPC 接口;通过 Web 封装成 http 接口;网关控制层等。 | ||
- 终端显示层:各个端的模板渲染并执行显示的层。当前主要是 velocity 渲染,JS 渲染,JSP 渲染,移 动端展示等。 | ||
- Web 层:主要是对访问控制进行转发,各类基本参数校验,或者不复用的业务简单处理等。 | ||
- Service 层:相对具体的业务逻辑服务层。 | ||
- Manager 层:通用业务处理层,它有如下特征: | ||
- 1) 对第三方平台封装的层,预处理返回结果及转化异常信息,适配上层接口。 | ||
- 2) 对 Service 层通用能力的下沉,如缓存方案、中间件通用处理。 | ||
- 3) 与 DAO 层交互,对多个 DAO 的组合复用。 | ||
- DAO 层:数据访问层,与底层 MySQL、Oracle、Hbase、OB 等进行数据交互。 | ||
- 第三方服务:包括其它部门 RPC 服务接口,基础平台,其它公司的 HTTP 接口,如淘宝开放平台、支 付宝付款服务、高德地图服务等。 | ||
- 外部数据接口:外部(应用)数据存储服务提供的接口,多见于数据迁移场景中。 | ||
|
||
|
||
|
||
------ | ||
|
||
以上是阿里规范当中的目录结构,我们也有自己的目录结构 | ||
|
||
![](../img/目录结构和规范/应用分层.png) | ||
|
||
- VO(View Object):显示层对象,通常是 Web 向模板渲染引擎层传输的对象。 | ||
- DTO(Data Transfer Object):数据传输对象,前端像后台进行传输的对象,类似于param。 | ||
- BO(Business Object):业务对象,内部业务对象,只在内部传递,不对外进行传递。 | ||
- Model:模型层,此对象与数据库表结构一一对应,通过 Mapper 层向上传输数据源对象。 | ||
- Controller:主要是对外部访问控制进行转发,各类基本参数校验,或者不复用的业务简单处理等。为了简单起见,一些与事务无关的代码也在这里编写。 | ||
- FeignClient:由于微服务之间存在互相调用,这里是内部请求的接口。 | ||
- Controller:主要是对内部访问控制进行转发,各类基本参数校验,或者不复用的业务简单处理等。为了简单起见,一些与事务无关的代码也在这里编写。 | ||
- Service 层:相对具体的业务逻辑服务层。 | ||
- Manager 层:通用业务处理层,它有如下特征: | ||
- 1) 对第三方平台封装的层,预处理返回结果及转化异常信息,适配上层接口。 | ||
- 2) 对 Service 层通用能力的下沉,如缓存方案、中间件通用处理。 | ||
- 3) 与 DAO 层交互,对多个 DAO 的组合复用。 | ||
- Mapper持久层:数据访问层,与底层 MySQL进行数据交互。 | ||
- Task层:由于每个服务之间会存在定时任务,比如定时确认收货,定时将活动失效等情况,这里面的Task实际上连接的是`xxl-job`(具体可以查看 https://github.com/xuxueli/xxl-job )进行任务调度。 | ||
- Listener:监听 `RocketMQ` 进行处理,有时候会监听`easyexcel`相关数据。 | ||
|
||
|
||
|
||
关于`FeignClient`,由于微服务之间存在互相调用,`Feign` 是http协议,理论上是为了解耦,而实际上提供方接口进行修改,调用方却没有进行修改的时候,会造成异常,所以我们抽取出来。还有就是对内暴露的接口,是很多地方都公用的,所以我们还将接口抽取了出了一个模块,方便引用。可以看到`mall4cloud-api`这个模块下是所有对内`feign`接口的信息。 | ||
|
||
|
||
|
||
|
||
|
||
## 目录结构 | ||
|
||
``` | ||
mall4cloud | ||
├─mall4cloud-api -- 内网接口 | ||
│ ├─mall4cloud-api-auth -- 授权对内接口 | ||
│ ├─mall4cloud-api-biz -- biz对内接口 | ||
│ ├─mall4cloud-api-leaf -- 美团分布式id生成接口 | ||
│ ├─mall4cloud-api-multishop -- 店铺对内接口 | ||
│ ├─mall4cloud-api-order -- 订单对内接口 | ||
│ ├─mall4cloud-api-platform -- 平台对内接口 | ||
│ ├─mall4cloud-api-product -- 商品对内接口 | ||
│ ├─mall4cloud-api-rbac -- 用户角色权限对内接口 | ||
│ ├─mall4cloud-api-search -- 搜索对内接口 | ||
│ └─mall4cloud-api-user -- 用户对内接口 | ||
├─mall4cloud-auth -- 授权校验模块 | ||
├─mall4cloud-biz -- mall4cloud 业务代码。如图片上传/短信等 | ||
├─mall4cloud-common -- 一些公共的方法 | ||
│ ├─mall4cloud-common-cache -- 缓存相关公共代码 | ||
│ ├─mall4cloud-common-core -- 公共模块核心(公共中的公共代码) | ||
│ ├─mall4cloud-common-database -- 数据库连接相关公共代码 | ||
│ ├─mall4cloud-common-order -- 订单相关公共代码 | ||
│ ├─mall4cloud-common-product -- 商品相关公共代码 | ||
│ ├─mall4cloud-common-rocketmq -- rocketmq相关公共代码 | ||
│ └─mall4cloud-common-security -- 安全相关公共代码 | ||
├─mall4cloud-gateway -- 网关 | ||
├─mall4cloud-group -- 团购服务 | ||
├─mall4cloud-leaf -- 基于美团leaf的生成id服务 | ||
├─mall4cloud-multishop -- 商家端 | ||
├─mall4cloud-order -- 订单服务 | ||
├─mall4cloud-payment -- 支付服务 | ||
├─mall4cloud-platform -- 平台端 | ||
├─mall4cloud-product -- 商品服务 | ||
├─mall4cloud-rbac -- 用户角色权限模块 | ||
├─mall4cloud-search -- 搜索模块 | ||
└─mall4cloud-user -- 用户服务 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.