add 新增URL导入

This commit is contained in:
zyxucp
2024-02-05 00:13:06 +08:00
parent e2b101b2f2
commit 2e030d8b85
3 changed files with 21 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ namespace AntSK.Domain.Repositories
/// <summary>
/// 图标
/// </summary>
[Required]
public string Icon { get; set; }
/// <summary>
/// 名称

View File

@@ -16,11 +16,11 @@ namespace AntSK.Domain.Repositories
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
public string? FileName { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Url { get; set; }
public string? Url { get; set; }
/// <summary>
/// 类型 fileurl
/// </summary>
@@ -28,7 +28,7 @@ namespace AntSK.Domain.Repositories
/// <summary>
/// 数据数量
/// </summary>
public int DataCount { get; set; }
public int? DataCount { get; set; }
/// <summary>
/// 创建时间

View File

@@ -4,7 +4,9 @@ using AntSK.Models;
using AntSK.Services;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.KernelMemory;
using System.ComponentModel.DataAnnotations;
using System.Security.Policy;
namespace AntSK.Pages.Kms
{
@@ -32,7 +34,8 @@ namespace AntSK.Pages.Kms
[Inject]
protected IKmsDetails_Repositories _kmsDetails_Repositories { get; set; }
[Inject]
protected MemoryServerless _memory { get; set; }
protected override async Task OnInitializedAsync()
{
@@ -42,7 +45,7 @@ namespace AntSK.Pages.Kms
private async Task FileUpload()
{
}
public class UrlModel
@@ -52,7 +55,18 @@ namespace AntSK.Pages.Kms
}
private async Task UrlHandleOk(MouseEventArgs e)
{
string fileid = Guid.NewGuid().ToString();
await _memory.ImportWebPageAsync(urlModel.Url, fileid, new TagCollection() { { "kmsid", KmsId } }
, index: "kms");
KmsDetails detial = new KmsDetails()
{
Id = fileid,
KmsId = KmsId,
Type = "url",
Url = urlModel.Url
};
await _kmsDetails_Repositories.InsertAsync(detial);
_data = await _kmsDetails_Repositories.GetListAsync(p => p.KmsId == KmsId);
}
private void ShowUrlModal()