去除下载模式,仅分成下载了或者未下载两种模式

This commit is contained in:
chuzhongzai 2023-12-27 17:20:22 +08:00
parent bb6a247381
commit 97c1e91f44
9 changed files with 23 additions and 40 deletions

View File

@ -29,11 +29,10 @@ public class GalleryManageController {
@PostMapping("")
public String create_task(String link, String targetResolution, String AuthCode,
@RequestParam(value = "tags", required = false) List<Integer> tags,
@RequestParam(value = "mode", defaultValue = "3", required = false)String mode){
@RequestParam(value = "tags", required = false) List<Integer> tags){
if(link == null || targetResolution == null)
return Response._failure("参数不全");
return galleryManageService.createTask(link, targetResolution, AuthCode, tags, Byte.parseByte(mode));
return galleryManageService.createTask(link, targetResolution, AuthCode, tags);
}
@GetMapping("")

View File

@ -9,8 +9,8 @@ public interface GalleryMapper {
@Insert("insert into gallery" +
" (gid, name, link, language, pages, status, fileSize, createTime, proceeding, resolution, displayFileSize, downloader, mode, thumb_link)\n" +
" values (#{gid}, #{name}, #{link}, #{language}, #{pages}, #{status}, #{fileSize}, #{createTime}, #{proceeding}, #{resolution}, #{displayFileSize}, #{downloader}, #{mode}, #{thumb_link})")
" (gid, name, link, language, pages, status, fileSize, createTime, proceeding, resolution, displayFileSize, downloader, thumb_link, is_download)\n" +
" values (#{gid}, #{name}, #{link}, #{language}, #{pages}, #{status}, #{fileSize}, #{createTime}, #{proceeding}, #{resolution}, #{displayFileSize}, #{downloader}, #{thumb_link}, #{is_download})")
void insertGallery(Gallery gallery);
@Select("select * from gallery where link=#{link}")
@ -38,7 +38,7 @@ public interface GalleryMapper {
@Update("""
update gallery set name=#{name}, link=#{link}, language=#{language},
pages=#{pages}, status=#{status}, fileSize=#{fileSize}, createTime=#{createTime},
proceeding=#{proceeding}, resolution=#{resolution}, displayFileSize=#{displayFileSize}, mode=#{mode}
proceeding=#{proceeding}, resolution=#{resolution}, displayFileSize=#{displayFileSize}, is_download=#{is_download}
where gid=#{gid}""")
void updateGallery(Gallery gallery);

View File

@ -12,11 +12,6 @@ import java.util.Map;
@Data
public class Gallery {
public static byte VIEW = 0;
public static byte SOURCE = 1;
public static byte PREVIEW = 2;
public static byte ALL = 3;
@JsonProperty("name")
private String name; //本子名字
@ -69,9 +64,9 @@ public class Gallery {
@JsonInclude(JsonInclude.Include.NON_NULL)
private Map<String, String> availableResolution; //可选分辨率
@JsonProperty("mode")
@JsonProperty("isDownload")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private byte mode; //0 仅查看 1 仅下载源文件 2 仅存储预览图 3 全部
private boolean is_download; //0 仅查看 1 仅下载源文件 2 仅存储预览图 3 全部
@JsonProperty("thumb_link")
@JsonInclude(JsonInclude.Include.NON_EMPTY)

View File

@ -17,24 +17,15 @@ public class GalleryTask {
public static byte COMPRESSING = 5;
public static byte DOWNLOAD_ALL = 3;
public static byte DOWNLOAD_PREVIEW = 2;
public static byte DOWNLOAD_SOURCE = 1;
@JsonInclude(JsonInclude.Include.NON_NULL)
private String name;
private int gid;
private int pages;
private byte status;
private int proceeding;
private byte type;
@JsonIgnore
private String path;
}

View File

@ -83,7 +83,7 @@ public class GalleryManageService {
* @param AuthCode 授权码用于记录是谁下载的
* @return 提交结果
*/
public String createTask(String link, String targetResolution, String AuthCode, List<Integer> tidS, byte mode) {
public String createTask(String link, String targetResolution, String AuthCode, List<Integer> tidS) {
Response response = Response.generateResponse();
User user = userMapper.selectUserByAuthCode(AuthCode);
// return Response._failure("调试中,请勿提交任务");
@ -120,7 +120,7 @@ public class GalleryManageService {
return response.toJSONString();
} else {
log.info("创建任务: {} 目标分辨率:{}", link, targetResolution);
if (remoteService.addGalleryToQueue(gallery, mode) != 0) {
if (remoteService.addGalleryToQueue(gallery) != 0) {
log.error("传送任务{}失败, 未知原因", gallery.getName());
response.failure("任务传送失败,未知原因");
pushService.taskCreateReport(user.getUsername(), link, response);
@ -142,7 +142,6 @@ public class GalleryManageService {
if (gallery.getStatus().equals("已提交")) {
response.success(gallery.toString());
gallery.setDownloader(user.getId());
gallery.setMode(mode);
galleryMapper.insertGallery(gallery);
long usedAmount = Long.parseLong(configurationMapper.selectConfiguration(CustomConfiguration.WEEK_USED_AMOUNT).getValue());
@ -563,7 +562,7 @@ public class GalleryManageService {
if(galleries != null && galleries.length != 0) {
log.info("发送未下载完成本子至节点,{}本", galleries.length);
for (Gallery gallery : galleries)
remoteService.addGalleryToQueue(gallery, gallery.getMode());
remoteService.addGalleryToQueue(gallery);
response.success(String.format("发送未下载完成本子至节点,%s本", galleries.length));
}else{
response.failure("当前没有未下载完成的本子");

View File

@ -105,10 +105,9 @@ public class RemoteService {
return channelFuture.channel() == null || !channelFuture.channel().isActive();
}
public byte addGalleryToQueue(Gallery gallery, byte type){
public byte addGalleryToQueue(Gallery gallery){
GalleryTask galleryTask = new GalleryTask();
galleryTask.setGid(gallery.getGid());
galleryTask.setType(type);
DownloadPostMessage dpm = new DownloadPostMessage();
dpm.messageId = atomicInteger.getAndIncrement();

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long