添加oss功能

This commit is contained in:
zhh
2018-05-17 15:53:28 +08:00
parent 59bdc015f9
commit 61d66f7caa
9 changed files with 348 additions and 1 deletions

View File

@@ -0,0 +1,45 @@
package com.macro.mall.controller;
import com.macro.mall.dto.CommonResult;
import com.macro.mall.dto.OssCallbackResult;
import com.macro.mall.dto.OssPolicyResult;
import com.macro.mall.service.impl.OssServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* Oss相关操作接口
* Created by macro on 2018/4/26.
*/
@Controller
@Api(tags = "OssController",description = "Oss管理")
@RequestMapping("/aliyun/oss")
public class OssController {
@Autowired
private OssServiceImpl ossService;
@ApiOperation(value = "oss上传签名生成")
@RequestMapping(value = "/policy",method = RequestMethod.GET)
@ResponseBody
public Object policy() {
OssPolicyResult result = ossService.policy();
return new CommonResult().success(result);
}
/**
* 上传成功回调方法
*/
@RequestMapping(value = "callback",method = RequestMethod.POST)
@ResponseBody
public Object callback(HttpServletRequest request) {
OssCallbackResult ossCallbackResult = ossService.callback(request);
return new CommonResult().success(ossCallbackResult);
}
}