Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Y
yudao-cloud
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
hblj
yudao-cloud
Commits
120fba6c
提交
120fba6c
authored
5月 01, 2019
作者:
YunaiV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
后端:增加获得七牛的 token 接口
上级
7f5038e5
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
108 行增加
和
17 行删除
+108
-17
ProductSkuAddOrUpdateTable.js
...-web/src/components/Product/ProductSkuAddOrUpdateTable.js
+2
-3
ProductSpuAddOrUpdate.js
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
+6
-7
pom.xml
admin/admin-application/pom.xml
+5
-0
MVCConfiguration.java
...coder/mall/admin/application/config/MVCConfiguration.java
+12
-4
QiniuConfiguration.java
...der/mall/admin/application/config/QiniuConfiguration.java
+21
-0
FileController.java
...l/admin/application/controller/admins/FileController.java
+33
-0
application.yaml
admin/admin-application/src/main/resources/application.yaml
+11
-2
AdminSecurityInterceptor.java
.../mall/admin/sdk/interceptor/AdminSecurityInterceptor.java
+10
-1
pom.xml
pom.xml
+8
-0
没有找到文件。
admin-web/src/components/Product/ProductSkuAddOrUpdateTable.js
浏览文件 @
120fba6c
...
@@ -78,8 +78,8 @@ export default class ProductSkuAddOrUpdateTable extends PureComponent {
...
@@ -78,8 +78,8 @@ export default class ProductSkuAddOrUpdateTable extends PureComponent {
return
<
SkuInputNumber
{...
props
}
/>
;
return
<
SkuInputNumber
{...
props
}
/>
;
}
}
});
});
return
<
Table
columns
=
{
columns
}
dataSource
=
{
skus
}
rowKey
=
"index"
/>
;
return
<
Table
columns
=
{
columns
}
dataSource
=
{
skus
}
rowKey
=
"index"
pagination
=
{
false
}
/>
;
// return <div />;
// return <div />;
}
}
}
}
\ No newline at end of file
admin-web/src/pages/Product/ProductSpuAddOrUpdate.js
浏览文件 @
120fba6c
...
@@ -239,12 +239,6 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -239,12 +239,6 @@ class ProductSpuAddOrUpdate extends Component {
initialValue
:
''
,
// TODO 修改
initialValue
:
''
,
// TODO 修改
})(
<
Input
placeholder
=
"请输入"
/>
)}
})(
<
Input
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"商品描述"
>
{
form
.
getFieldDecorator
(
'description'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入商品描述!'
}],
initialValue
:
''
,
// TODO 修改
})(
<
Input
.
TextArea
placeholder
=
"请输入"
/>
)}
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"分类编号"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"分类编号"
>
{
form
.
getFieldDecorator
(
'cid'
,
{
{
form
.
getFieldDecorator
(
'cid'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入分类编号!'
}],
rules
:
[{
required
:
true
,
message
:
'请输入分类编号!'
}],
...
@@ -279,7 +273,12 @@ class ProductSpuAddOrUpdate extends Component {
...
@@ -279,7 +273,12 @@ class ProductSpuAddOrUpdate extends Component {
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"规格明细"
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"规格明细"
>
{
/*<Table defaultExpandAllRows={true} columns={columns} rowKey="id" />*/
}
{
/*<Table defaultExpandAllRows={true} columns={columns} rowKey="id" />*/
}
<
ProductSkuAddOrUpdateTable
{...
productSkuProps
}
/
>
<
ProductSkuAddOrUpdateTable
{...
productSkuProps
}
/
>
<
/FormItem
>
<
FormItem
labelCol
=
{{
span
:
5
}}
wrapperCol
=
{{
span
:
15
}}
label
=
"商品描述"
>
{
form
.
getFieldDecorator
(
'description'
,
{
rules
:
[{
required
:
true
,
message
:
'请输入商品描述!'
}],
initialValue
:
''
,
// TODO 修改
})(
<
Input
.
TextArea
placeholder
=
"请输入"
/>
)}
<
Button
type
=
"primary"
htmlType
=
"submit"
style
=
{{
marginLeft
:
8
}}
onSubmit
=
{
this
.
handleSubmit
}
>
保存
<
/Button
>
<
Button
type
=
"primary"
htmlType
=
"submit"
style
=
{{
marginLeft
:
8
}}
onSubmit
=
{
this
.
handleSubmit
}
>
保存
<
/Button
>
<
/FormItem
>
<
/FormItem
>
<
/Form
>
<
/Form
>
...
...
admin/admin-application/pom.xml
浏览文件 @
120fba6c
...
@@ -75,6 +75,11 @@
...
@@ -75,6 +75,11 @@
<artifactId>
spring-boot-starter-actuator
</artifactId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
...
...
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/MVCConfiguration.java
浏览文件 @
120fba6c
...
@@ -5,11 +5,17 @@ import cn.iocoder.common.framework.servlet.CorsFilter;
...
@@ -5,11 +5,17 @@ import cn.iocoder.common.framework.servlet.CorsFilter;
import
cn.iocoder.mall.admin.sdk.interceptor.AdminAccessLogInterceptor
;
import
cn.iocoder.mall.admin.sdk.interceptor.AdminAccessLogInterceptor
;
import
cn.iocoder.mall.admin.sdk.interceptor.AdminSecurityInterceptor
;
import
cn.iocoder.mall.admin.sdk.interceptor.AdminSecurityInterceptor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.context.annotation.Import
;
import
org.springframework.web.servlet.config.annotation.*
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.Set
;
@EnableWebMvc
@EnableWebMvc
@Configuration
@Configuration
...
@@ -24,13 +30,15 @@ public class MVCConfiguration implements WebMvcConfigurer {
...
@@ -24,13 +30,15 @@ public class MVCConfiguration implements WebMvcConfigurer {
private
AdminSecurityInterceptor
adminSecurityInterceptor
;
private
AdminSecurityInterceptor
adminSecurityInterceptor
;
@Autowired
@Autowired
private
AdminAccessLogInterceptor
adminAccessLogInterceptor
;
private
AdminAccessLogInterceptor
adminAccessLogInterceptor
;
//
@Value
(
"${auth.ignore-urls}"
)
private
Set
<
String
>
ignoreUrls
;
@Override
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
// registry.addInterceptor(securityInterceptor).addPathPatterns("/user/**", "/admin/**"); // 只拦截我们定义的接口
registry
.
addInterceptor
(
adminAccessLogInterceptor
).
addPathPatterns
(
"/admins/**"
);
registry
.
addInterceptor
(
adminAccessLogInterceptor
).
addPathPatterns
(
"/admins/**"
);
registry
.
addInterceptor
(
adminSecurityInterceptor
).
addPathPatterns
(
"/admins/**"
)
registry
.
addInterceptor
(
adminSecurityInterceptor
.
setIgnoreUrls
(
ignoreUrls
)).
addPathPatterns
(
"/admins/**"
);
.
excludePathPatterns
(
"/admins/passport/login"
);
// 排除登陆接口
}
}
@Override
@Override
...
...
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/config/QiniuConfiguration.java
0 → 100644
浏览文件 @
120fba6c
package
cn
.
iocoder
.
mall
.
admin
.
application
.
config
;
import
com.qiniu.util.Auth
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
public
class
QiniuConfiguration
{
@Value
(
"${qiniu.access-key}"
)
private
String
accessKey
;
@Value
(
"${qiniu.secret-key}"
)
private
String
secretKey
;
@Bean
public
Auth
auth
()
{
return
Auth
.
create
(
accessKey
,
secretKey
);
}
}
admin/admin-application/src/main/java/cn/iocoder/mall/admin/application/controller/admins/FileController.java
0 → 100644
浏览文件 @
120fba6c
package
cn
.
iocoder
.
mall
.
admin
.
application
.
controller
.
admins
;
import
cn.iocoder.common.framework.vo.CommonResult
;
import
com.qiniu.util.Auth
;
import
io.swagger.annotations.Api
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"admins/file"
)
@Api
(
"文件模块"
)
public
class
FileController
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Autowired
private
Auth
auth
;
@Value
(
"${qiniu.bucket}"
)
private
String
bucket
;
@GetMapping
(
"/get_qiniu_token"
)
public
CommonResult
<
String
>
getQiniuToken
()
{
String
token
=
auth
.
uploadToken
(
bucket
);
logger
.
info
(
"[qiniu_token][token({}) get]"
,
token
);
return
CommonResult
.
success
(
token
);
}
}
admin/admin-application/src/main/resources/application.yaml
浏览文件 @
120fba6c
...
@@ -6,4 +6,14 @@ spring:
...
@@ -6,4 +6,14 @@ spring:
server
:
server
:
port
:
18083
port
:
18083
servlet
:
servlet
:
context-path
:
/admin-api/
context-path
:
/admin-api/
\ No newline at end of file
# auth
auth
:
ignore-urls
:
/admin-api/admins/admin/passport/login, /admin-api/admins/file/get_qiniu_token
# qiniu
qiniu
:
access-key
:
YldfyUC7OewoWM63TPYTairqnq8GMJvNek9EGoID
secret-key
:
zZ7Q8wwZRyaklVvkyLmVydA4WygOBqtc_gTYzalS
bucket
:
onemall
admin/admin-sdk/src/main/java/cn/iocoder/mall/admin/sdk/interceptor/AdminSecurityInterceptor.java
浏览文件 @
120fba6c
...
@@ -26,6 +26,15 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
...
@@ -26,6 +26,15 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
@Reference
(
validation
=
"true"
)
@Reference
(
validation
=
"true"
)
@Autowired
(
required
=
false
)
// TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
@Autowired
(
required
=
false
)
// TODO 芋艿,初始化时,会存在 spring boot 启动时,服务无法引用的情况,先暂时这么解决。
private
OAuth2Service
oauth2Service
;
private
OAuth2Service
oauth2Service
;
/**
* 忽略的 URL 集合,即无需经过认证
*/
private
Set
<
String
>
ignoreUrls
;
public
AdminSecurityInterceptor
setIgnoreUrls
(
Set
<
String
>
ignoreUrls
)
{
this
.
ignoreUrls
=
ignoreUrls
;
return
this
;
}
@Override
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
...
@@ -50,7 +59,7 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
...
@@ -50,7 +59,7 @@ public class AdminSecurityInterceptor extends HandlerInterceptorAdapter {
}
}
}
else
{
}
else
{
String
url
=
request
.
getRequestURI
();
String
url
=
request
.
getRequestURI
();
if
(
!
url
.
equals
(
"/admin/passport/login"
))
{
// TODO 临时写死。非登陆接口,必须已经认证身份,不允许匿名访问
if
(
ignoreUrls
!=
null
&&
!
ignoreUrls
.
contains
(
url
))
{
// TODO 临时写死。非登陆接口,必须已经认证身份,不允许匿名访问
throw
new
ServiceException
(
AdminErrorCodeEnum
.
OAUTH_NOT_LOGIN
.
getCode
(),
AdminErrorCodeEnum
.
OAUTH_NOT_LOGIN
.
getMessage
());
throw
new
ServiceException
(
AdminErrorCodeEnum
.
OAUTH_NOT_LOGIN
.
getCode
(),
AdminErrorCodeEnum
.
OAUTH_NOT_LOGIN
.
getMessage
());
}
}
}
}
...
...
pom.xml
浏览文件 @
120fba6c
...
@@ -44,6 +44,8 @@
...
@@ -44,6 +44,8 @@
<maven-compiler-plugin.version>
3.8.0
</maven-compiler-plugin.version>
<maven-compiler-plugin.version>
3.8.0
</maven-compiler-plugin.version>
<org.projectlombok.version>
1.16.14
</org.projectlombok.version>
<org.projectlombok.version>
1.16.14
</org.projectlombok.version>
<qiniu.version>
7.2.18
</qiniu.version>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
</properties>
</properties>
...
@@ -164,6 +166,12 @@
...
@@ -164,6 +166,12 @@
<!-- </exclusions>-->
<!-- </exclusions>-->
</dependency>
</dependency>
<dependency>
<groupId>
com.qiniu
</groupId>
<artifactId>
qiniu-java-sdk
</artifactId>
<version>
${qiniu.version}
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论