import java.util.HashMap; import java.util.Map; /** * @author reghao * @date 2023-05-23 10:43:25 */ @Deprecated public enum UploadChannel { // 网盘上传(单个文件最大 20GiB) disk(101, "file/", 1024L*1024*1024*20, 1005), // 视频上传(单个文件最大 10GiB) video(102, "video/playback/", 1024L*1024*1024*10, 1002), // 音频上传(单个文件最大 1GiB) audio(103, "audio/playback/", 1024L*1024*1024, 1003), // 用户头像上传(单个文件最大 2MiB) avatar(104, "image/a/", 1024L*1024*2, 1001), // 图片上传(单个文件最大 10MiB) image(105, "image/i/", 1024L*1024*10, 1001), // 用户状态照片上传(单个文件最大 100MiB) photo(106, "image/p/", 1024L*1024*100, 1001), img(107, "img/", 1024L*1024*10, 1001); private final int code; private final String prefix; private final long maxSize; private final int fileType; UploadChannel(int code, String prefix, long maxSize, int fileType) { this.code = code; this.prefix = prefix; this.maxSize = maxSize; this.fileType = fileType; } private static Map map = new HashMap<>(); private static Map map1 = new HashMap<>(); static { for (UploadChannel channel : UploadChannel.values()) { map.put(channel.code, channel); map1.put(channel.prefix, channel); } } public static UploadChannel getUploadChannel(int code) { return map.get(code); } public static UploadChannel getUploadChannel(String prefix) { return map1.get(prefix); } public int getCode() { return code; } public String getPrefix() { return prefix; } public long getMaxSize() { return maxSize; } public int getFileType() { return fileType; } }