|
@@ -1,11 +1,10 @@
|
|
|
package cn.reghao.oss.store.rpc;
|
|
package cn.reghao.oss.store.rpc;
|
|
|
|
|
|
|
|
|
|
+import cn.reghao.oss.api.dto.ObjectChannel;
|
|
|
import cn.reghao.oss.store.config.OssProperties;
|
|
import cn.reghao.oss.store.config.OssProperties;
|
|
|
import cn.reghao.oss.store.util.JwtUtil;
|
|
import cn.reghao.oss.store.util.JwtUtil;
|
|
|
import cn.reghao.oss.api.constant.ChannelAction;
|
|
import cn.reghao.oss.api.constant.ChannelAction;
|
|
|
-import cn.reghao.oss.api.constant.UploadChannel;
|
|
|
|
|
import cn.reghao.oss.api.dto.OssPayload;
|
|
import cn.reghao.oss.api.dto.OssPayload;
|
|
|
-import cn.reghao.oss.api.dto.ServerInfo;
|
|
|
|
|
import cn.reghao.oss.api.iface.OssServerService;
|
|
import cn.reghao.oss.api.iface.OssServerService;
|
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -24,14 +23,15 @@ public class OssServerServiceImpl implements OssServerService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public ServerInfo getServerInfo(long userId, int channelId) {
|
|
|
|
|
|
|
+ public String getUploadToken(int channelId) {
|
|
|
|
|
+ long userId = 1;
|
|
|
String action = ChannelAction.upload.getName();
|
|
String action = ChannelAction.upload.getName();
|
|
|
long expireAt = System.currentTimeMillis() + 3600*1000;
|
|
long expireAt = System.currentTimeMillis() + 3600*1000;
|
|
|
OssPayload ossPayload = new OssPayload(action, channelId, userId);
|
|
OssPayload ossPayload = new OssPayload(action, channelId, userId);
|
|
|
- String token = JwtUtil.createToken(ossPayload, expireAt, ossProperties.getSecretKey());
|
|
|
|
|
|
|
+ return JwtUtil.createToken(ossPayload, expireAt, ossProperties.getSecretKey());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- String ossUrl = String.format("https://%s/", ossProperties.getDomain());
|
|
|
|
|
- long maxSize = UploadChannel.getUploadChannel(channelId).getMaxSize();
|
|
|
|
|
- return new ServerInfo(ossUrl, channelId, maxSize, token);
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void createChannel(long userId, ObjectChannel channel) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|