Skip to content

Commit d210936

Browse files
committed
管理后台-题目类型功能,添加网关配置
1 parent b734fb5 commit d210936

File tree

10 files changed

+94
-33
lines changed

10 files changed

+94
-33
lines changed

data/sql/passjava_chms_渠道微服务.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ create table chms_channel
99
name varchar(100) comment '渠道名称',
1010
appid varchar(100) comment '渠道appid',
1111
appsecret varchar(500) comment '渠道appsecret',
12+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
1213
create_time datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
1314
update_time datetime DEFAULT CURRENT_TIMESTAMP comment '更新时间',
1415
primary key (id)
@@ -28,6 +29,7 @@ create table chms_access_token
2829
access_token varchar(500) comment 'access_token',
2930
expire_time datetime comment '到期时间',
3031
channel_id bigint comment '渠道id',
32+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
3133
create_time datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
3234
update_time datetime DEFAULT CURRENT_TIMESTAMP comment '更新时间',
3335
primary key (id)

data/sql/passjava_cms_内容微服务.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ create table cms_banner
1212
enable tinyint comment '是否显示',
1313
render_type tinyint comment '跳转类型',
1414
render_url varchar(500) comment '跳转路径',
15+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
1516
create_time datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
1617
update_time datetime DEFAULT CURRENT_TIMESTAMP comment '更新时间',
1718
primary key (id)
@@ -32,6 +33,7 @@ create table cms_news
3233
display_order int comment '排序',
3334
render_url varchar(500) comment '跳转路径',
3435
enable tinyint comment '是否显示',
36+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
3537
create_time datetime DEFAULT CURRENT_TIMESTAMP comment '创建时间',
3638
update_time datetime DEFAULT CURRENT_TIMESTAMP comment '更新时间',
3739
primary key (id)

data/sql/passjava_qms_题目微服务.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ create table qms_question
1313
sub_title varchar(500) comment '副标题',
1414
type bigint comment '题目类型',
1515
enable tinyint comment '是否显示',
16+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
1617
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
1718
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
1819
primary key (id)
@@ -31,6 +32,7 @@ create table qms_type
3132
type char(64) comment '类型名称',
3233
comments char(64) comment '备注',
3334
logo_url varchar(500) comment '类型logo路径',
35+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
3436
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
3537
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
3638
primary key (id)

data/sql/passjava_sms_学习微服务.sql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ create table sms_study_time
88
id bigint not null auto_increment,
99
ques_type bigint comment '题目类型id',
1010
member_id bigint comment '用户id',
11-
total_time int comment '学习时常(分',
11+
total_time int comment '学习时常(分)',
12+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
1213
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
1314
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
1415
primary key (id)
@@ -27,6 +28,7 @@ create table sms_view_log
2728
ques_id bigint comment '题目id',
2829
ques_type bigint comment '题目类型id',
2930
member_id bigint comment '用户id',
31+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
3032
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
3133
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
3234
primary key (id)

data/sql/passjava_ums_用户微服务.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ create table ums_member
2222
source_type tinyint comment '用户来源',
2323
integration int comment '积分',
2424
register_time datetime comment '注册时间',
25+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
2526
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
2627
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
2728
primary key (id)
@@ -41,6 +42,7 @@ create table ums_growth_change_history
4142
change_count int comment '改变的值(正负计数)',
4243
note varchar(500) comment '备注',
4344
source_type tinyint comment '0->扫码;1->搜索;2->分享',
45+
del_flag tinyint(1) DEFAULT 0 COMMENT '删除标记(0-正常,1-删除)'
4446
create_time datetime default CURRENT_TIMESTAMP comment '创建时间',
4547
update_time datetime default CURRENT_TIMESTAMP comment '更新时间',
4648
primary key (id)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.jackson0714.passjava.gateway.config;
2+
3+
import org.springframework.context.annotation.Bean;
4+
import org.springframework.context.annotation.Configuration;
5+
import org.springframework.web.cors.CorsConfiguration;
6+
import org.springframework.web.cors.reactive.CorsWebFilter;
7+
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
8+
9+
@Configuration
10+
public class PassJavaCorsConfiguration {
11+
12+
@Bean
13+
public CorsWebFilter corsWebFilter() {
14+
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
15+
16+
CorsConfiguration corsConfiguration = new CorsConfiguration();
17+
18+
// 配置跨域
19+
corsConfiguration.addAllowedHeader("*"); // 允许所有请求头跨域
20+
corsConfiguration.addAllowedMethod("*"); // 允许所有请求方法跨域
21+
corsConfiguration.addAllowedOrigin("*"); // 允许所有请求来源跨域
22+
corsConfiguration.setAllowCredentials(true); //允许携带cookie跨域,否则跨域请求会丢失cookie信息
23+
24+
source.registerCorsConfiguration("/**", corsConfiguration);
25+
26+
return new CorsWebFilter(source);
27+
}
28+
}

passjava-gateway/src/main/resources/application.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ spring:
22
cloud:
33
gateway:
44
routes:
5-
- id: route_portal # 路由规则id
5+
- id: route_question # 题目微服务路由规则
6+
uri: lb://passjava-question # 负载均衡,将请求转发到注册中心注册的renren-fast服务
7+
predicates: # 断言
8+
- Path=/api/question/** # 如果前端请求路径包含 api/question,则应用这条路由规则
9+
filters: #过滤器
10+
- RewritePath=/api/(?<segment>.*),/$\{segment} # 将跳转路径中包含的api替换成question
11+
12+
- id: route_portal # renren-fast微服务路由规则
613
uri: lb://renren-fast # 负载均衡,renren-fast服务
714
predicates: # 断言
815
- Path=/api/** # 如果前端请求路径包含 api,则应用这条路由规则
916
filters: #过滤器
10-
- RewritePath=/api/(?<segment>.*),/renren-fast/$\{segment} # 将跳转路径中包含的api替换成renren-fast
17+
- RewritePath=/api/(?<segment>.*),/renren-fast/$\{segment} # 将跳转路径中包含的api替换成renren-fast,但是替换的url不会在前端显示,还是网关的访问路径。这里不是跳转到新的路径,而是转发请求。
18+
Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
spring:
2-
datasource:
3-
driver-class-name: com.mysql.cj.jdbc.Driver
4-
url: jdbc:mysql://129.211.188.xxxx:xxxx/passjava_qms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
5-
username: xxxx
6-
password: xxxx
7-
8-
cloud:
9-
nacos:
10-
discovery:
11-
server-addr: 127.0.0.1:8848
12-
application:
13-
name: passjava-question
14-
15-
mybatis-plus:
16-
mapper-locations: classpath:/mapper/**/*.xml
17-
global-config:
18-
db-config:
19-
id-type: auto
20-
21-
server:
22-
port: 11000
1+
#spring:
2+
# datasource:
3+
# driver-class-name: com.mysql.cj.jdbc.Driver
4+
# url: jdbc:mysql://129.211.188.xxxx:xxxx/passjava_qms?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
5+
# username: xxxx
6+
# password: xxxx
7+
#
8+
# cloud:
9+
# nacos:
10+
# discovery:
11+
# server-addr: 127.0.0.1:8848
12+
# application:
13+
# name: passjava-question
14+
#
15+
#mybatis-plus:
16+
# mapper-locations: classpath:/mapper/**/*.xml
17+
# global-config:
18+
# db-config:
19+
# id-type: auto
20+
#
21+
#server:
22+
# port: 11000
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
spring.application.name=passjava-question
2+
spring.cloud.nacos.config.server-addr=127.0.0.1:8848
3+
spring.cloud.nacos.config.namespace=passjava-question
4+
5+
spring.cloud.nacos.config.extension-configs[0].data-id=datasource.yml
6+
spring.cloud.nacos.config.extension-configs[0].group=dev
7+
spring.cloud.nacos.config.extension-configs[0].refresh=true
8+
9+
spring.cloud.nacos.config.extension-configs[1].data-id=mybatis.yml
10+
spring.cloud.nacos.config.extension-configs[1].group=dev
11+
spring.cloud.nacos.config.extension-configs[1].refresh=true
12+
13+
spring.cloud.nacos.config.extension-configs[2].data-id=more.yml
14+
spring.cloud.nacos.config.extension-configs[2].group=dev
15+
spring.cloud.nacos.config.extension-configs[2].refresh=true

renren-fast/src/main/java/io/renren/config/CorsConfig.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
@Configuration
1616
public class CorsConfig implements WebMvcConfigurer {
1717

18-
@Override
19-
public void addCorsMappings(CorsRegistry registry) {
20-
registry.addMapping("/**")
21-
.allowedOrigins("*")
22-
.allowCredentials(true)
23-
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
24-
.maxAge(3600);
25-
}
18+
// @Override
19+
// public void addCorsMappings(CorsRegistry registry) {
20+
// registry.addMapping("/**")
21+
// .allowedOrigins("*")
22+
// .allowCredentials(true)
23+
// .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
24+
// .maxAge(3600);
25+
// }
2626
}

0 commit comments

Comments
 (0)