Parcourir la source

oss上传功能改进

zhh il y a 6 ans
Parent
commit
8ad969b131

+ 1 - 3
mall-admin/src/main/java/com/macro/mall/controller/OssController.java

@@ -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) {

+ 6 - 14
mall-admin/src/main/java/com/macro/mall/dto/OssPolicyResult.java

@@ -1,6 +1,7 @@
 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 getCallback() {
-        return callback;
+    public String getHost() {
+        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;
     }
 }

+ 1 - 0
mall-admin/src/main/java/com/macro/mall/service/OssService.java

@@ -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 {

+ 1 - 3
mall-admin/src/main/java/com/macro/mall/service/impl/OssServiceImpl.java

@@ -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.setAction(action);
+			result.setHost(action);
 		} catch (Exception e) {
 			LOGGER.error("签名生成失败", e);
 		}

+ 4 - 4
mall-demo/src/main/resources/templates/crud.html

@@ -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);

+ 2 - 2
mall-demo/src/main/resources/templates/index.html

@@ -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>