update 优化 oss 远程调用 支持降级处理

2.X
疯狂的狮子Li 1 year ago
parent a54843924d
commit 883fa32e2c

@ -0,0 +1,37 @@
package org.dromara.resource.api;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.resource.api.domain.RemoteFile;
/**
* ()
*
* @author Lion Li
*/
@Slf4j
public class RemoteFileServiceMock implements RemoteFileService {
/**
*
*
* @param file
* @return
*/
public RemoteFile upload(String name, String originalFilename, String contentType, byte[] file) {
log.warn("服务调用异常 -> 降级处理");
return null;
}
/**
* ossIdurl
*
* @param ossIds ossId
* @return url
*/
public String selectUrlByIds(String ossIds) {
log.warn("服务调用异常 -> 降级处理");
return StringUtils.EMPTY;
}
}

@ -16,7 +16,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
@TranslationType(type = TransConstant.OSS_ID_TO_URL) @TranslationType(type = TransConstant.OSS_ID_TO_URL)
public class OssUrlTranslationImpl implements TranslationInterface<String> { public class OssUrlTranslationImpl implements TranslationInterface<String> {
@DubboReference @DubboReference(mock = "true")
private RemoteFileService ossService; private RemoteFileService ossService;
@Override @Override

Loading…
Cancel
Save