11 changed files with 101104 additions and 4367 deletions
Unified View
Diff Options
-
996835数据库设计/1hjz.cdm
-
13435数据库设计/1hjz.sql
-
4330235数据库设计/v2.4.0/1hjz.cdm
-
4952435数据库设计/v2.4.0/1hjz.pdm
-
192735数据库设计/v2.4.0/1hjz.sql
-
13235数据库设计/v2.4.0/1hjz_v2.4.0.sql
-
28338技术方案/API版本控制/API版本控制实施方案.md
-
15238技术方案/RESTful规范/RESTful规范.md
-
BIN38技术方案/角色权限后续开发说明/微信截图_20180820231347.png
-
BIN38技术方案/角色权限后续开发说明/微信截图_20180821101530.png
-
4938技术方案/角色权限后续开发说明/角色权限后续开发说明.md
9968
35数据库设计/1hjz.cdm
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
43302
35数据库设计/v2.4.0/1hjz.cdm
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
49524
35数据库设计/v2.4.0/1hjz.pdm
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1927
35数据库设计/v2.4.0/1hjz.sql
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,132 @@ |
|||||
|
/*==============================================================*/ |
||||
|
/* DBMS name: MySQL 5.0 */ |
||||
|
/* Created on: 2018/8/24 18:10:25 */ |
||||
|
/*==============================================================*/ |
||||
|
|
||||
|
|
||||
|
drop table if exists consumer_follow_overview; |
||||
|
|
||||
|
drop table if exists feedback_order; |
||||
|
|
||||
|
drop table if exists follow_detail; |
||||
|
|
||||
|
drop table if exists rel_admin_follow_consumer; |
||||
|
|
||||
|
drop table if exists service_evaluation; |
||||
|
|
||||
|
/*==============================================================*/ |
||||
|
/* Table: consumer_follow_overview */ |
||||
|
/*==============================================================*/ |
||||
|
create table consumer_follow_overview |
||||
|
( |
||||
|
id int not null auto_increment, |
||||
|
user_id bigint not null, |
||||
|
feedback_num int default 0 comment '回访次数', |
||||
|
follow_num int default 0 comment '跟进次数', |
||||
|
last_follow_at bigint default 0 comment '最近跟进时间', |
||||
|
status tinyint default 1 comment '状态:0-待跟进,1-跟进中', |
||||
|
create_source tinyint comment '来源:1-回访工单,2-用户跟进', |
||||
|
create_at bigint comment '创建时间', |
||||
|
create_by varchar(32) comment '创建人', |
||||
|
update_at bigint comment '更新时间', |
||||
|
update_by varchar(32) comment '更新人', |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
alter table consumer_follow_overview comment '消费者跟进状况'; |
||||
|
|
||||
|
/*==============================================================*/ |
||||
|
/* Table: feedback_order */ |
||||
|
/*==============================================================*/ |
||||
|
create table feedback_order |
||||
|
( |
||||
|
id int not null auto_increment, |
||||
|
feedback_user_id bigint, |
||||
|
book_detail_id bigint not null, |
||||
|
feedback_no varchar(32) comment '回访编号', |
||||
|
book_no varchar(32) comment '预约编号', |
||||
|
user_id char(10) comment '用户id', |
||||
|
merchant_no national varchar(32) not null comment '商家编号', |
||||
|
card_type tinyint default 0 comment '服务卡类型', |
||||
|
book_time date comment '预约日期', |
||||
|
book_week tinyint default 0 comment '预约星期', |
||||
|
time_type tinyint default 0 comment '时间类型', |
||||
|
address_telephone national varchar(16) comment '联系人号码', |
||||
|
linkman national varchar(16) comment '联系人姓名', |
||||
|
cleaner_name national varchar(32) comment '保洁师名称', |
||||
|
address_id bigint unsigned not null comment '地址id', |
||||
|
full_address national varchar(128) comment '服务地址', |
||||
|
channel_id bigint comment '渠道id', |
||||
|
created_at bigint unsigned default 0 comment '创建时间', |
||||
|
created_by national varchar(32) comment '创建者', |
||||
|
updated_at bigint unsigned default 0 comment '更新时间', |
||||
|
updated_by national varchar(32) comment '更新者', |
||||
|
attitude_score int comment '服务态度评分', |
||||
|
quality_score int comment '服务质量评分', |
||||
|
efficiency_score int comment '服务速度评分', |
||||
|
answers_status tinyint default 0 comment '应答状态:0-未接听,1-正常', |
||||
|
feedback_status tinyint default 0 comment '回访状态:0-未回访,1-已回访', |
||||
|
feedback_content varchar(255) comment '回访内容', |
||||
|
feedback_by varchar(32) comment '回访人', |
||||
|
feedback_at bigint comment '回访时间', |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
alter table feedback_order comment '回访工单'; |
||||
|
|
||||
|
/*==============================================================*/ |
||||
|
/* Table: follow_detail */ |
||||
|
/*==============================================================*/ |
||||
|
create table follow_detail |
||||
|
( |
||||
|
id int not null auto_increment, |
||||
|
follow_overview_id int not null, |
||||
|
level varchar(10) comment '用户等级', |
||||
|
follow_context varchar(255) comment '跟进内容', |
||||
|
create_at bigint comment '创建时间', |
||||
|
create_by varchar(32) comment '创建人', |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
alter table follow_detail comment '跟进明细'; |
||||
|
|
||||
|
/*==============================================================*/ |
||||
|
/* Table: rel_admin_follow_consumer */ |
||||
|
/*==============================================================*/ |
||||
|
create table rel_admin_follow_consumer |
||||
|
( |
||||
|
follow_overview_id int not null, |
||||
|
admin_id bigint not null, |
||||
|
status tinyint default 0 comment '跟进状态:1-跟进中,2-已移除', |
||||
|
feedback_num int default 0 comment '回访次数', |
||||
|
follow_num int default 0 comment '跟进次数', |
||||
|
create_source tinyint comment '来源:1-回访工单,2-用户跟进', |
||||
|
create_at bigint comment '创建时间', |
||||
|
create_by varchar(32) comment '创建人', |
||||
|
update_by varchar(32) comment '更新人', |
||||
|
update_at bigint comment '更新时间', |
||||
|
primary key (follow_overview_id, admin_id) |
||||
|
); |
||||
|
|
||||
|
alter table rel_admin_follow_consumer comment '员工与消费者跟进情况'; |
||||
|
|
||||
|
/*==============================================================*/ |
||||
|
/* Table: service_evaluation */ |
||||
|
/*==============================================================*/ |
||||
|
create table service_evaluation |
||||
|
( |
||||
|
id int not null auto_increment comment 'id', |
||||
|
book_id bigint not null, |
||||
|
user_id bigint not null, |
||||
|
book_no varchar(32) comment '预约编号', |
||||
|
evaluation_no varchar(32) comment '评价编号', |
||||
|
time_score int comment '准时到达评分', |
||||
|
service_score int comment '洁净标准评分', |
||||
|
profession_score int comment '专业高效评分', |
||||
|
create_at bigint comment '创建时间', |
||||
|
content varchar(255) comment '评价内容', |
||||
|
primary key (id) |
||||
|
); |
||||
|
|
||||
|
alter table service_evaluation comment '用户服务评价'; |
||||
|
|
||||
@ -0,0 +1,283 @@ |
|||||
|
#RESTful API版本控制实施方案 |
||||
|
|
||||
|
## 1、为什么要做API版本控制 |
||||
|
|
||||
|
- 随业务发展,需求的更变,原有API逻辑处理,返回数据等的处理已不再适应于当前需求,改动在所难免。为避免API接口变化给使用者带来的影响,我们有需要区分不同版本的API接口处理 |
||||
|
|
||||
|
## 2、怎么做? |
||||
|
|
||||
|
以下是主流的方式: |
||||
|
|
||||
|
- #### url路径携带版本号 |
||||
|
|
||||
|
例如: https://1hjz.3ncto.com.cn/v2/users |
||||
|
|
||||
|
好处:能直观展示当前版本号。使用者能方便的调用不同版本API,直接看到效果 |
||||
|
|
||||
|
坏处:不优雅,违背RESTful架构原则,添加版本号会混淆版本和资源的概念,使得架构会比较混乱。增加日后维护成本 |
||||
|
|
||||
|
- #### 请求参数传递版本号 |
||||
|
|
||||
|
例如: https://1hjz.3ncto.com.cn/v2/users?version=v2.3.0 |
||||
|
|
||||
|
|
||||
|
|
||||
|
- #### 自定义请求头添加版本号(推荐) |
||||
|
|
||||
|
在HTTP请求的header中使用自定义header标识版本。 |
||||
|
|
||||
|
例如: |
||||
|
|
||||
|
````http |
||||
|
Request Header |
||||
|
Accept: application/json, text/javascript, */*; q=0.01 |
||||
|
Accept-Encoding: gzip, deflate, br |
||||
|
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8 |
||||
|
Connection: keep-alive |
||||
|
Host: disqus.com |
||||
|
Content-Type: application/json |
||||
|
version: 2.3.0 |
||||
|
```` |
||||
|
|
||||
|
好处: 遵循RESTful API设计风格。请求url不发生改变。 |
||||
|
|
||||
|
坏处:版本不直观,需要能设置header的client才能调用查看该API的效果。 |
||||
|
|
||||
|
## 3、实施方案 |
||||
|
|
||||
|
###3.1 原理 |
||||
|
|
||||
|
扩展SpringBoot配置。通过我们自定义请求映射处理器, 匹配比较执行相应方法上。 |
||||
|
|
||||
|
实现效果:当请求接口带有版本号时,通过版本号的比较,执行相应版本。假若当前版本有v2.1.0,v2.3.0。 |
||||
|
|
||||
|
- 不带版本号,执行默认版本。 |
||||
|
- 请求version:1.1.0,找不到标识版本,将执行默认版本。 |
||||
|
- 请求version:2.1.0,执行的是2.1.0,执行相应版本。 |
||||
|
- 请求version:2.2.0,执行的是2.1.0,没有当前对应版本,将使用当前版本号下的最新版本。 |
||||
|
- 请求version:3.2.0,执行的是2.3.0,没有当前对应版本,将使用当前版本号下的最新版本。 |
||||
|
|
||||
|
##3.2 java实现方案 |
||||
|
|
||||
|
项目目录结构,以1hjz为例 |
||||
|
|
||||
|
```text |
||||
|
src.main.java |
||||
|
|-com.midou.tech |
||||
|
|- common |
||||
|
|- apiVersion API版本配置 |
||||
|
|- modules |
||||
|
|- admin |
||||
|
|- controller |
||||
|
|- web |
||||
|
|- AdminBookController 原API接口文件 |
||||
|
|- version |
||||
|
|- v2_3_0 |
||||
|
|- AdminBookControllerV230 v2.3.0版本API接口文件 |
||||
|
|- service |
||||
|
|- version |
||||
|
|- v230 |
||||
|
|- impl |
||||
|
|- BookServiceImplV230 v2.3.0版本业务逻辑处理 |
||||
|
|- BookServiceV230 |
||||
|
|- impl |
||||
|
|- AdminBookServiceImpl |
||||
|
|- AdminBookService |
||||
|
|
||||
|
|
||||
|
``` |
||||
|
|
||||
|
|
||||
|
|
||||
|
#### 3.2.1 实现自定义请求映射处理器 |
||||
|
|
||||
|
```java |
||||
|
@Configuration |
||||
|
public class MyWebMvcRegistrations implements WebMvcRegistrations { |
||||
|
|
||||
|
@Override |
||||
|
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() { |
||||
|
return new ApiVersionRequestMappingHandlerMapping(); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
ApiVersionRequestMappingHandlerMapping |
||||
|
|
||||
|
```java |
||||
|
public class ApiVersionRequestMappingHandlerMapping extends RequestMappingHandlerMapping { |
||||
|
|
||||
|
@Override |
||||
|
protected RequestCondition<?> getCustomTypeCondition(Class<?> handlerType) { |
||||
|
ApiVersion apiVersion = AnnotationUtils.findAnnotation(handlerType, ApiVersion.class); |
||||
|
return createCondition(apiVersion); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected RequestCondition<?> getCustomMethodCondition(Method method) { |
||||
|
ApiVersion apiVersion = AnnotationUtils.findAnnotation(method, ApiVersion.class); |
||||
|
return createCondition(apiVersion); |
||||
|
} |
||||
|
|
||||
|
private RequestCondition<ApiVersionCondition> createCondition(ApiVersion apiVersion) { |
||||
|
return apiVersion == null ? null : new ApiVersionCondition(apiVersion.value()); |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
#### 3.2.2 实现自定义匹配比较器 |
||||
|
|
||||
|
```java |
||||
|
|
||||
|
/** |
||||
|
* 自定义匹配比较器 |
||||
|
*/ |
||||
|
public class ApiVersionCondition implements RequestCondition<ApiVersionCondition> { |
||||
|
|
||||
|
/** |
||||
|
* 将不同筛选条件合并 |
||||
|
* @param other |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public ApiVersionCondition combine(ApiVersionCondition other) { |
||||
|
... |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据request查找匹配到的筛选条件 |
||||
|
* @param request |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public ApiVersionCondition getMatchingCondition(HttpServletRequest request) { |
||||
|
... |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 不同筛选条件比较,用于比较 |
||||
|
* @param other |
||||
|
* @param request |
||||
|
* @return |
||||
|
*/ |
||||
|
@Override |
||||
|
public int compareTo(ApiVersionCondition other, HttpServletRequest request) { |
||||
|
... |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
|
||||
|
#### 3.1.3 实现自定义注解@apiVersion |
||||
|
|
||||
|
使用@apiVersion标识方法版本号。通过匹配规则的获取@apiVersion标识的版本号,比较筛选符合的方法 |
||||
|
|
||||
|
```java |
||||
|
@Target({ElementType.METHOD, ElementType.TYPE}) |
||||
|
@Retention(RetentionPolicy.RUNTIME) |
||||
|
@Documented |
||||
|
@Mapping |
||||
|
public @interface ApiVersion { |
||||
|
String value() default ""; |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
##4、使用 |
||||
|
|
||||
|
#### controller层 |
||||
|
|
||||
|
原API接口 |
||||
|
|
||||
|
```java |
||||
|
@Api(description = "运营后台预约相关接口") |
||||
|
@RequestMapping(value = "/admin/web/book") |
||||
|
@RestController |
||||
|
public class AdminBookController extends AdminWebBaseController { |
||||
|
|
||||
|
@GetMapping(value = "/card/list") |
||||
|
public JSONObject getServiceCardList() { |
||||
|
... |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
版本控制API命名 |
||||
|
|
||||
|
原controller名称+版本号 |
||||
|
|
||||
|
示例:AdminBookControllerV2_3_0 |
||||
|
|
||||
|
```java |
||||
|
@Api(description = "运营后台预约相关接口") |
||||
|
@RequestMapping(value = "/admin/web/book") |
||||
|
@RestController |
||||
|
public class AdminBookControllerV2_3_0 extends AdminWebBaseController { |
||||
|
|
||||
|
@ApiVersion("2.3.0") |
||||
|
@GetMapping(value = "/card/list") |
||||
|
public JSONObject getServiceCardList() { |
||||
|
... |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
#### service层 |
||||
|
|
||||
|
继承原接口层 |
||||
|
|
||||
|
命名规则: 原service名称+版本号 |
||||
|
|
||||
|
例如:当前bookService,2.3.0版本改变 |
||||
|
|
||||
|
```java |
||||
|
public interface AdminBookServiceV2_3_0 extends AdminBookService { |
||||
|
... |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
实现类 |
||||
|
|
||||
|
```java |
||||
|
@Primary |
||||
|
@Service |
||||
|
public class AdminBookServiceImplV2_3_0 extends AdminBookServiceImpl |
||||
|
implements AdminBookServiceV2_3_0 { |
||||
|
... |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
|
||||
|
|
||||
|
## 5、前端接口调用 |
||||
|
|
||||
|
```javascript |
||||
|
"ajax": { |
||||
|
"url": url, |
||||
|
"type": 'GET', |
||||
|
"xhrFields": {// 允许跨域 |
||||
|
withCredentials: true |
||||
|
}, |
||||
|
"headers":{// API版本 |
||||
|
"version": "2.3.0" |
||||
|
}, |
||||
|
"crossDomain": true, |
||||
|
"data": function (d) { |
||||
|
... |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
问题: |
||||
|
|
||||
|
controller继承,方法重写请求内容 |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -0,0 +1,152 @@ |
|||||
|
#RESTful 规范 |
||||
|
|
||||
|
## 1、统一接口规范: |
||||
|
|
||||
|
RESTful架构风格规定,数据的元操作,即CRUD(create, read, update和delete,即数据的增删查改)操作,分别对应于HTTP方法:GET用来获取资源,POST用来新建资源(也可以用于更新资源),PUT用来更新资源,DELETE用来删除资源,这样就统一了数据操作的接口,仅通过HTTP方法,就可以完成对数据的所有增删查改工作。 |
||||
|
|
||||
|
即: |
||||
|
|
||||
|
- GET(SELECT):从服务器取出资源(一项或多项)。 |
||||
|
- POST(CREATE):在服务器新建一个资源。 |
||||
|
- PUT(UPDATE):在服务器更新资源(客户端提供完整资源数据)。 |
||||
|
- PATCH(UPDATE):在服务器更新资源(客户端提供需要修改的资源数据)。 |
||||
|
- DELETE(DELETE):从服务器删除资源。 |
||||
|
|
||||
|
## 2、项目中应用 |
||||
|
|
||||
|
```java |
||||
|
@Api(description = "账户管理API") |
||||
|
@RestController |
||||
|
@RequestMapping("/admin/web") |
||||
|
public class AdminAccountController extends AdminWebBaseController { |
||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(AdminAccountController.class); |
||||
|
|
||||
|
@Autowired |
||||
|
private AdminAccountService adminAccountService; |
||||
|
|
||||
|
@ApiOperation(value = "分页获取账户信息") |
||||
|
@RequestMapping(value = { "/accountinfo/list" }, method = RequestMethod.GET) |
||||
|
public JSONObject listAccountInfo( |
||||
|
@ApiParam(value = "当前页码", required = true) @RequestParam Integer pageNo, @ApiParam(value = "访问次数,前端传入,无需处理", required = true) @RequestParam Integer draw, @ApiParam(value = "每页显示条数,前端传入,无需处理", required = true) @RequestParam Integer pageSize ){ |
||||
|
return adminAccountService.queryForPaging(pageNo, pageSize, "", draw); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation(value = "删除账号") |
||||
|
@RequestMapping(value = {"/accountinfo/del"}, method = RequestMethod.POST) |
||||
|
public ResultTemplate delAccountInfo(@ApiParam(value = "用户id", required = true) |
||||
|
@RequestParam String userId) { |
||||
|
return adminAccountService.delByUserId(userId); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation(value = "添加账号") |
||||
|
@RequestMapping(value = {"/accountinfo/add"},method = RequestMethod.POST) |
||||
|
public ResultTemplate addAccountInfo(@ApiParam(value = "账户对象", required = true) @RequestBody String accountInfo){ |
||||
|
return adminAccountService.addAccountInfo(accountInfo); |
||||
|
} |
||||
|
|
||||
|
@ApiOperation("获取客户账户流水信息") |
||||
|
@GetMapping("/accountinfo/{userId}") |
||||
|
public JSONObject getAccountListByUserId( |
||||
|
@ApiParam(value = "用户id", required = true) @PathVariable String userId, |
||||
|
@ApiParam(value = "访问次数,前端传入,无需处理", required = true)@RequestParam Integer draw, |
||||
|
@ApiParam(value = "页码") @RequestParam(required = false, defaultValue = "0")int pageNo, |
||||
|
@ApiParam(value = "每页条目") @RequestParam(required = false, defaultValue = "10") int pageSize){ |
||||
|
return adminAccountService.getAccountListByUserId(userId, draw, pageNo, pageSize); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
``` |
||||
|
|
||||
|
###2.1 API接口调整说明 |
||||
|
|
||||
|
调整前: |
||||
|
|
||||
|
| -API | -请求方式 | -说明 | |
||||
|
| ------------------------------- | --------- | -------------------- | |
||||
|
| /admin/web/accountinfo/list | GET | 分页获取账户信息 | |
||||
|
| /admin/web/accountinfo/del | POST | 删除账号 | |
||||
|
| /admin/web/accountinfo/add | POST | 添加账号 | |
||||
|
| /admin/web/accountinfo/{userId} | GET | 获取客户账户流水信息 | |
||||
|
|
||||
|
调整后: |
||||
|
|
||||
|
| -API | -请求方式 | -说明 | |
||||
|
| -------------------------------- | --------- | -------------------- | |
||||
|
| /admin/web/accountinfos | GET | 分页获取账户信息 | |
||||
|
| /admin/web/accountinfos/{userId} | DELETE | 删除账号 | |
||||
|
| /admin/web/accountinfos | POST | 添加账号 | |
||||
|
| /admin/web/accountinfos/{userId} | GET | 获取客户账户流水信息 | |
||||
|
|
||||
|
### 2.2 API 返回数据格式说明 |
||||
|
|
||||
|
+ #####所有返回数据必须是 JSON 格式 |
||||
|
|
||||
|
|
||||
|
+ ##### *第一级数据必须有且只有code (状态码),msg (响应信息),data (数据内容)* |
||||
|
|
||||
|
**返回示例** |
||||
|
````json |
||||
|
{ |
||||
|
"code" : 0, |
||||
|
"msg" : "请求成功", |
||||
|
"data" : { |
||||
|
"draw": 1, |
||||
|
"recordsTotal": 10, |
||||
|
"recordsFiltered": 10, |
||||
|
"dataList": [ |
||||
|
{ |
||||
|
"name":"Angelica", |
||||
|
"age":"Ramos", |
||||
|
"office":"System Architect", |
||||
|
"address":"London", |
||||
|
"date":"9th Oct 09", |
||||
|
"salary":"$2,875" |
||||
|
}, |
||||
|
{ |
||||
|
"name":"Ashton", |
||||
|
"age":"Cox", |
||||
|
"office":"Technical Author", |
||||
|
"address":"San Francisco", |
||||
|
"date":"12th Jan 09", |
||||
|
"salary":"$4,800" |
||||
|
}, |
||||
|
... |
||||
|
] |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
```` |
||||
|
####2.2.1 状态码说明 `(code) ` |
||||
|
|
||||
|
+ #####*`code` 值必须是数字* |
||||
|
|
||||
|
+ #####通用状态码说明 |
||||
|
|
||||
|
| 状态码 | 响应信息 | |
||||
|
| ------ | -------- | |
||||
|
| 0 | 请求成功 | |
||||
|
| 1 | 请求失败 | |
||||
|
|
||||
|
#### 2.2.2 响应信息说明 `(msg)` |
||||
|
|
||||
|
+ ##### `msg` 必须只是字符串,不可为 `null`,`undefined` 等类型 |
||||
|
|
||||
|
### 2.2.3 数据内容说明 `(data)` |
||||
|
|
||||
|
+ ##### 任何情况下 `data` 只能为 `null` (无数据) 或 `object` (对象) 和 `array` (数组) 类型 |
||||
|
|
||||
|
## 3、待补充 |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
@ -0,0 +1,49 @@ |
|||||
|
# 角色权限后续开发流程 |
||||
|
|
||||
|
## 1、数据库设计 |
||||
|
|
||||
|
### 1.1 实体设计 |
||||
|
|
||||
|
+ 用户:admin_info |
||||
|
+ 角色: role_info |
||||
|
+ 用户角色:user_role |
||||
|
+ 菜单:permission_info |
||||
|
+ 角色菜单:role_permission |
||||
|
+ 功能权限:function_permission |
||||
|
|
||||
|
###1.2 ER关系图 |
||||
|
|
||||
|
 |
||||
|
|
||||
|
## 2、功能权限配置 |
||||
|
|
||||
|
### 2.1 新增API接口,页面跳转请求url配置 |
||||
|
|
||||
|
当后台新增接口时,需要把新增接口API说明,请求URL,请求方式配置到功能权限表中 |
||||
|
|
||||
|
正则匹配规则: |
||||
|
|
||||
|
+ 全匹配原则;例如/admin/web/accountinfo/list |
||||
|
+ 末端变量匹配原则;例如(/admin/web/activity/).*,则匹配的URL为以/admin/web/activity/前缀,后面跟任意的字符。 |
||||
|
+ 多变量匹配原则;例如(/admin/web/activity/).*(/status),则匹配的URL为以/admin/web/activity/前缀,后面跟任意的字符,以/status结尾。 |
||||
|
|
||||
|
示例: |
||||
|
|
||||
|
| id | name | url | method | RESTful url | |
||||
|
| ---- | ------------ | --------------------------------- | ------ | ------------------------------- | |
||||
|
| 1 | 获取账户信息 | /admin/web/accountinfo/list | GET | /admin/web/accountinfo/list | |
||||
|
| 2 | 获取活动详情 | (/admin/web/activity/).* | GET | /admin/web/activity/{id} | |
||||
|
| 3 | 活动状态切换 | (/admin/web/activity/).*(/status) | POST | /admin/web/activity/{id}/status | |
||||
|
|
||||
|
### 2.2 菜单配置 |
||||
|
|
||||
|
当后台运营系统功能模块前端调用接口发生改变时,我们需要相应的调整新增或删减该模块对应的功能权限。 |
||||
|
|
||||
|
配置入口:系统设置 -> 菜单管理,修改对应菜单的功能权限id,功能权限id则为2.1配置表中的id,以英文逗号分隔。 |
||||
|
|
||||
|
 |
||||
|
|
||||
|
## 3、开发生产配置保持同步 |
||||
|
|
||||
|
为保证上线正常访问,在开发阶段,需保证线上配置与开发库保持同步,以便于上线数据的更新。 |
||||
|
|
||||
Write
Preview
Loading…
Cancel
Save