|
@@ -6,6 +6,7 @@ import cn.reghao.oss.store.api.dto.ObjectChannel;
|
|
|
import cn.reghao.oss.store.api.dto.ObjectMeta;
|
|
import cn.reghao.oss.store.api.dto.ObjectMeta;
|
|
|
import cn.reghao.oss.store.db.repository.ObjectRepository;
|
|
import cn.reghao.oss.store.db.repository.ObjectRepository;
|
|
|
import cn.reghao.oss.store.service.GetObjectService;
|
|
import cn.reghao.oss.store.service.GetObjectService;
|
|
|
|
|
+import cn.reghao.oss.store.service.StoreChannelService;
|
|
|
import cn.reghao.oss.store.service.StoreLocalCache;
|
|
import cn.reghao.oss.store.service.StoreLocalCache;
|
|
|
import cn.reghao.oss.store.util.JwtUtil;
|
|
import cn.reghao.oss.store.util.JwtUtil;
|
|
|
import cn.reghao.oss.store.util.ObjectUtil;
|
|
import cn.reghao.oss.store.util.ObjectUtil;
|
|
@@ -27,13 +28,16 @@ public class ObjectGetController {
|
|
|
private final Cache<String, Object> cache;
|
|
private final Cache<String, Object> cache;
|
|
|
private final StoreLocalCache storeLocalCache;
|
|
private final StoreLocalCache storeLocalCache;
|
|
|
private final ObjectRepository objectRepository;
|
|
private final ObjectRepository objectRepository;
|
|
|
|
|
+ private StoreChannelService storeChannelService;
|
|
|
|
|
|
|
|
public ObjectGetController(GetObjectService getObjectService, StoreLocalCache storeLocalCache,
|
|
public ObjectGetController(GetObjectService getObjectService, StoreLocalCache storeLocalCache,
|
|
|
- Cache<String, Object> cache, ObjectRepository objectRepository) {
|
|
|
|
|
|
|
+ Cache<String, Object> cache, ObjectRepository objectRepository,
|
|
|
|
|
+ StoreChannelService storeChannelService) {
|
|
|
this.getObjectService = getObjectService;
|
|
this.getObjectService = getObjectService;
|
|
|
this.cache = cache;
|
|
this.cache = cache;
|
|
|
this.storeLocalCache = storeLocalCache;
|
|
this.storeLocalCache = storeLocalCache;
|
|
|
this.objectRepository = objectRepository;
|
|
this.objectRepository = objectRepository;
|
|
|
|
|
+ this.storeChannelService = storeChannelService;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping(value = "/**", method = RequestMethod.HEAD)
|
|
@RequestMapping(value = "/**", method = RequestMethod.HEAD)
|
|
@@ -93,7 +97,7 @@ public class ObjectGetController {
|
|
|
OssPayload ossPayload = JwtUtil.getOssPayload(token, storeLocalCache.getSecretKey());
|
|
OssPayload ossPayload = JwtUtil.getOssPayload(token, storeLocalCache.getSecretKey());
|
|
|
int loginUser = ossPayload.getUserId();
|
|
int loginUser = ossPayload.getUserId();
|
|
|
int channelId = ossPayload.getChannelId();
|
|
int channelId = ossPayload.getChannelId();
|
|
|
- ObjectChannel objectChannel = storeLocalCache.getObjectChannel(loginUser, channelId);
|
|
|
|
|
|
|
+ ObjectChannel objectChannel = storeChannelService.getChannelByChannelId(loginUser, channelId);
|
|
|
if (objectChannel == null) {
|
|
if (objectChannel == null) {
|
|
|
String payload = String.format("channel_id %s not exist", channelId);
|
|
String payload = String.format("channel_id %s not exist", channelId);
|
|
|
getObjectService.writeResponse(HttpServletResponse.SC_FORBIDDEN, payload);
|
|
getObjectService.writeResponse(HttpServletResponse.SC_FORBIDDEN, payload);
|