文件上传接口
This commit is contained in:
@@ -23,6 +23,7 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
registry.addInterceptor(gateWayInterceptor)
|
registry.addInterceptor(gateWayInterceptor)
|
||||||
.addPathPatterns("/**")
|
.addPathPatterns("/**")
|
||||||
.excludePathPatterns("/v1/user/login")
|
.excludePathPatterns("/v1/user/login")
|
||||||
|
.excludePathPatterns("/v1/file/**")
|
||||||
.excludePathPatterns("/v1/message/checkSend");
|
.excludePathPatterns("/v1/message/checkSend");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.lld.im.service.file;
|
||||||
|
|
||||||
|
import com.lld.im.common.ResponseVO;
|
||||||
|
import com.lld.im.common.model.SyncReq;
|
||||||
|
import com.lld.im.service.conversation.model.DeleteConversationReq;
|
||||||
|
import com.lld.im.service.conversation.model.UpdateConversationReq;
|
||||||
|
import com.lld.im.service.conversation.service.ConversationService;
|
||||||
|
import com.lld.im.service.utils.MinioUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: lld
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("v1/file")
|
||||||
|
public class FileController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ConversationService conversationService;
|
||||||
|
|
||||||
|
@PostMapping("/upload")
|
||||||
|
public ResponseVO PostMapping(@RequestParam("file") MultipartFile file) {
|
||||||
|
|
||||||
|
final String upload = MinioUtil.upload(file, "/test");
|
||||||
|
return ResponseVO.successResponse(upload);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,9 +19,9 @@ spring:
|
|||||||
min-idle: 10
|
min-idle: 10
|
||||||
password: dSMIXBQrCBXiHHjk123
|
password: dSMIXBQrCBXiHHjk123
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
host: 192.168.2.180
|
host: 119.45.242.222
|
||||||
port: 5672
|
port: 5672
|
||||||
addresses: 192.168.2.180
|
addresses: 119.45.242.222
|
||||||
username: guest
|
username: guest
|
||||||
password: guest
|
password: guest
|
||||||
# virtual-host:
|
# virtual-host:
|
||||||
@@ -55,7 +55,7 @@ server:
|
|||||||
appConfig:
|
appConfig:
|
||||||
appId: 10000
|
appId: 10000
|
||||||
privateKey: 123456
|
privateKey: 123456
|
||||||
zkAddr: 192.168.2.180:2181 # zk连接地址
|
zkAddr: 119.45.242.222:2181 # zk连接地址
|
||||||
zkConnectTimeOut: 50000 #zk超时时间
|
zkConnectTimeOut: 50000 #zk超时时间
|
||||||
imRouteWay: 3 # 路由策略1轮训 2随机 3hash
|
imRouteWay: 3 # 路由策略1轮训 2随机 3hash
|
||||||
consistentHashWay: 1 # 如果选用一致性hash的话具体hash算法 1 TreeMap 2 自定义Map
|
consistentHashWay: 1 # 如果选用一致性hash的话具体hash算法 1 TreeMap 2 自定义Map
|
||||||
@@ -123,4 +123,4 @@ minio:
|
|||||||
minio_url: http://43.139.240.200:9000
|
minio_url: http://43.139.240.200:9000
|
||||||
minio_name: admin
|
minio_name: admin
|
||||||
minio_pass: 12345678
|
minio_pass: 12345678
|
||||||
bucketName: im
|
bucketName: hd-im
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: prod
|
active: dev
|
||||||
|
|||||||
Reference in New Issue
Block a user