#409 MixuQueuedPDFBooksAsync
This commit is contained in:
parent
e508c9815d
commit
e3cc338d37
@ -18514,6 +18514,20 @@
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.DeleteQueuedPDFBookAsync(System.Guid)">
|
||||
<summary>
|
||||
delete queued books
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.MixuQueuedPDFBooksAsync(System.Int32)">
|
||||
<summary>
|
||||
mix queued pdf books
|
||||
</summary>
|
||||
<param name="step"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.PDFLibraryService.BatchImportSohaLibraryAsync(System.Int32,System.Int32,System.Boolean)">
|
||||
<summary>
|
||||
batch import soha library
|
||||
@ -20231,6 +20245,20 @@
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.DeleteQueuedPDFBookAsync(System.Guid)">
|
||||
<summary>
|
||||
delete queued books
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IPDFLibraryService.MixuQueuedPDFBooksAsync(System.Int32)">
|
||||
<summary>
|
||||
mix queued pdf books
|
||||
</summary>
|
||||
<param name="step"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:RMuseum.Services.IPictureFileService">
|
||||
<summary>
|
||||
manipulating picture files
|
||||
|
||||
@ -458,5 +458,12 @@ namespace RMuseum.Services
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> DeleteQueuedPDFBookAsync(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// mix queued pdf books
|
||||
/// </summary>
|
||||
/// <param name="step"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<bool>> MixuQueuedPDFBooksAsync(int step);
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,5 +56,51 @@ namespace RMuseum.Services.Implementation
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// mix queued pdf books
|
||||
/// </summary>
|
||||
/// <param name="step"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> MixuQueuedPDFBooksAsync(int step)
|
||||
{
|
||||
try
|
||||
{
|
||||
var qSoha = await _context.QueuedPDFBooks.Where(t => t.OriginalSourceUrl.Contains("https://sohalibrary.com")).OrderBy(t => t.DownloadOrder).ToListAsync();
|
||||
var qElit = await _context.QueuedPDFBooks.Where(t => !t.OriginalSourceUrl.Contains("https://sohalibrary.com")).OrderBy(t => t.DownloadOrder).ToListAsync();
|
||||
|
||||
int downloadOrder = 0;
|
||||
int e = 0;
|
||||
for (var i = 0; i < qSoha.Count; i++)
|
||||
{
|
||||
qSoha[i].DownloadOrder = downloadOrder;
|
||||
downloadOrder++;
|
||||
if(i % step == 0)
|
||||
{
|
||||
if(e < qElit.Count)
|
||||
{
|
||||
qElit[e].DownloadOrder = downloadOrder;
|
||||
downloadOrder++;
|
||||
e++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = e;e < qElit.Count;e++)
|
||||
{
|
||||
qElit[e].DownloadOrder = downloadOrder;
|
||||
downloadOrder++;
|
||||
}
|
||||
|
||||
_context.UpdateRange(qSoha);
|
||||
_context.UpdateRange(qElit);
|
||||
await _context.SaveChangesAsync();
|
||||
return new RServiceResult<bool>(true);
|
||||
}
|
||||
catch (Exception exp)
|
||||
{
|
||||
return new RServiceResult<bool>(false, exp.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ namespace RMuseum.Services.Implementation
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<bool>> StartImportingKnownSourceAsync(string srcUrl)
|
||||
{
|
||||
if (srcUrl.Contains("https://sohalibrary.com/"))
|
||||
if (srcUrl.Contains("https://sohalibrary.com"))
|
||||
{
|
||||
return await StartImportingSohaLibraryUrlAsync(srcUrl);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user