Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wwwanlingxiao
mall
Commits
8ad969b1
Commit
8ad969b1
authored
May 18, 2018
by
zhh
Browse files
oss上传功能改进
parent
61d66f7c
Changes
6
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/controller/OssController.java
View file @
8ad969b1
...
...
@@ -32,9 +32,7 @@ public class OssController {
return
new
CommonResult
().
success
(
result
);
}
/**
* 上传成功回调方法
*/
@ApiOperation
(
value
=
"oss上传成功回调"
)
@RequestMapping
(
value
=
"callback"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
Object
callback
(
HttpServletRequest
request
)
{
...
...
mall-admin/src/main/java/com/macro/mall/dto/OssPolicyResult.java
View file @
8ad969b1
package
com.macro.mall.dto
;
/**
* 获取OSS上传授权返回结果
* Created by macro on 2018/5/17.
*/
public
class
OssPolicyResult
{
...
...
@@ -8,8 +9,7 @@ public class OssPolicyResult {
private
String
policy
;
private
String
signature
;
private
String
dir
;
private
String
callback
;
private
String
action
;
private
String
host
;
public
String
getAccessKeyId
()
{
return
accessKeyId
;
...
...
@@ -43,19 +43,11 @@ public class OssPolicyResult {
this
.
dir
=
dir
;
}
public
String
get
Callback
()
{
return
callback
;
public
String
get
Host
()
{
return
host
;
}
public
void
setCallback
(
String
callback
)
{
this
.
callback
=
callback
;
}
public
String
getAction
()
{
return
action
;
}
public
void
setAction
(
String
action
)
{
this
.
action
=
action
;
public
void
setHost
(
String
host
)
{
this
.
host
=
host
;
}
}
mall-admin/src/main/java/com/macro/mall/service/OssService.java
View file @
8ad969b1
...
...
@@ -6,6 +6,7 @@ import com.macro.mall.dto.OssPolicyResult;
import
javax.servlet.http.HttpServletRequest
;
/**
* oss上传管理Service
* Created by macro on 2018/5/17.
*/
public
interface
OssService
{
...
...
mall-admin/src/main/java/com/macro/mall/service/impl/OssServiceImpl.java
View file @
8ad969b1
...
...
@@ -4,11 +4,9 @@ import com.aliyun.oss.OSSClient;
import
com.aliyun.oss.common.utils.BinaryUtil
;
import
com.aliyun.oss.model.MatchMode
;
import
com.aliyun.oss.model.PolicyConditions
;
import
com.macro.mall.dto.OssCallbackParam
;
import
com.macro.mall.dto.OssCallbackResult
;
import
com.macro.mall.dto.OssPolicyResult
;
import
com.macro.mall.service.OssService
;
import
com.macro.mall.util.JsonUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -78,7 +76,7 @@ public class OssServiceImpl implements OssService {
result
.
setSignature
(
signature
);
result
.
setDir
(
dir
);
// result.setCallback(callbackData);
result
.
set
Action
(
action
);
result
.
set
Host
(
action
);
}
catch
(
Exception
e
)
{
LOGGER
.
error
(
"签名生成失败"
,
e
);
}
...
...
mall-demo/src/main/resources/templates/crud.html
View file @
8ad969b1
...
...
@@ -106,7 +106,7 @@ $(function() {
{
field
:
'
email
'
,
title
:
'
邮箱
'
,
sortable
:
true
,
halign
:
'
center
'
},
{
field
:
'
address
'
,
title
:
'
地址
'
,
sortable
:
true
,
halign
:
'
center
'
},
{
field
:
'
remark
'
,
title
:
'
备注
'
,
sortable
:
true
,
halign
:
'
center
'
},
{
field
:
'
action
'
,
title
:
'
操作
'
,
halign
:
'
center
'
,
align
:
'
center
'
,
formatter
:
'
actionFormatter
'
,
events
:
'
actionEvents
'
,
clickToSelect
:
false
}
{
field
:
'
host
'
,
title
:
'
操作
'
,
halign
:
'
center
'
,
align
:
'
center
'
,
formatter
:
'
actionFormatter
'
,
events
:
'
actionEvents
'
,
clickToSelect
:
false
}
]
}).
on
(
'
all.bs.table
'
,
function
(
e
,
name
,
args
)
{
$
(
'
[data-toggle="tooltip"]
'
).
tooltip
();
...
...
@@ -153,7 +153,7 @@ function createAction() {
confirm
:
{
text
:
'
确认
'
,
btnClass
:
'
waves-effect waves-button
'
,
action
:
function
()
{
host
:
function
()
{
$
.
alert
(
'
确认
'
);
}
},
...
...
@@ -190,7 +190,7 @@ function updateAction() {
confirm
:
{
text
:
'
确认
'
,
btnClass
:
'
waves-effect waves-button
'
,
action
:
function
()
{
host
:
function
()
{
$
.
alert
(
'
确认
'
);
}
},
...
...
@@ -228,7 +228,7 @@ function deleteAction() {
confirm
:
{
text
:
'
确认
'
,
btnClass
:
'
waves-effect waves-button
'
,
action
:
function
()
{
host
:
function
()
{
var
ids
=
new
Array
();
for
(
var
i
in
rows
)
{
ids
.
push
(
rows
[
i
].
systemId
);
...
...
mall-demo/src/main/resources/templates/index.html
View file @
8ad969b1
...
...
@@ -108,10 +108,10 @@
</a>
<ul
class=
"dropdown-menu dm-icon pull-right"
>
<li
class=
"hidden-xs"
>
<a
class=
"waves-effect"
data-ma-
action
=
"fullscreen"
href=
"javascript:fullPage();"
><i
class=
"zmdi zmdi-fullscreen"
></i>
全屏模式
</a>
<a
class=
"waves-effect"
data-ma-
host
=
"fullscreen"
href=
"javascript:fullPage();"
><i
class=
"zmdi zmdi-fullscreen"
></i>
全屏模式
</a>
</li>
<li>
<a
class=
"waves-effect"
data-ma-
action
=
"clear-localstorage"
href=
"javascript:;"
><i
class=
"zmdi zmdi-delete"
></i>
清除缓存
</a>
<a
class=
"waves-effect"
data-ma-
host
=
"clear-localstorage"
href=
"javascript:;"
><i
class=
"zmdi zmdi-delete"
></i>
清除缓存
</a>
</li>
<li>
<a
class=
"waves-effect"
href=
"javascript:;"
><i
class=
"zmdi zmdi-face"
></i>
隐私管理
</a>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment