diff --git a/admin-web/src/services/admin.js b/admin-web/src/services/admin.js index b3dca958e..35cbdcc52 100644 --- a/admin-web/src/services/admin.js +++ b/admin-web/src/services/admin.js @@ -197,7 +197,7 @@ export async function dictionaryDelete(params) { // file export async function fileGetQiniuToken() { - return request(`/admin-api/admins/file/get_qiniu_token`, { + return request(`/admin-api/admins/file/get-qiniu-token`, { method: 'GET', }); } diff --git a/system/system-rest/pom.xml b/system/system-rest/pom.xml index 6cdfd8ba9..224d9caad 100644 --- a/system/system-rest/pom.xml +++ b/system/system-rest/pom.xml @@ -30,6 +30,10 @@ mall-spring-boot-starter-swagger 1.0-SNAPSHOT + + com.qiniu + qiniu-java-sdk + diff --git a/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsFileController.java b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsFileController.java new file mode 100644 index 000000000..d752c492d --- /dev/null +++ b/system/system-rest/src/main/java/cn/iocoder/mall/system/rest/controller/admin/AdminsFileController.java @@ -0,0 +1,38 @@ +package cn.iocoder.mall.system.rest.controller.admin; + +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; + +/** + * 文件模块(Admins API) + * + * author: sin + * time: 2020/4/20 9:41 上午 + */ +@RestController +@RequestMapping("admins/file") +@Api(tags = "文件模块") +public class AdminsFileController { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private Auth auth; + @Value("${qiniu.bucket}") + private String bucket; + + @GetMapping("/get-qiniu-token") + public CommonResult getQiniuToken() { + String token = auth.uploadToken(bucket); + logger.info("[qiniu_token][token({}) get]", token); + return CommonResult.success(token); + } +} diff --git a/system/system-start/src/main/java/cn/iocoder/mall/system/application/controller/admins/FileController.java b/system/system-start/src/main/java/cn/iocoder/mall/system/application/controller/admins/FileController.java index b4e5256d3..5c3455130 100644 --- a/system/system-start/src/main/java/cn/iocoder/mall/system/application/controller/admins/FileController.java +++ b/system/system-start/src/main/java/cn/iocoder/mall/system/application/controller/admins/FileController.java @@ -23,7 +23,7 @@ public class FileController { @Value("${qiniu.bucket}") private String bucket; - @GetMapping("/get_qiniu_token") + @GetMapping("/get-qiniu-token") public CommonResult getQiniuToken() { String token = auth.uploadToken(bucket); logger.info("[qiniu_token][token({}) get]", token); diff --git a/system/system-start/src/main/resources/application.yaml b/system/system-start/src/main/resources/application.yaml index edd2d3eb0..b06d085a5 100644 --- a/system/system-start/src/main/resources/application.yaml +++ b/system/system-start/src/main/resources/application.yaml @@ -18,7 +18,7 @@ server: admins: security: - ignore_urls: /admin-api/admins/passport/login, /admin-api/admins/file/get_qiniu_token + ignore_urls: /admin-api/admins/passport/login, /admin-api/admins/file/get-qiniu-token # qiniu qiniu: