feat: 完成匿名字段功能
This commit is contained in:
@@ -18,19 +18,9 @@ public class ImageTaskOutput
|
||||
public string Prompt { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 参考图PrefixBase64列表(带前缀)
|
||||
/// 是否匿名
|
||||
/// </summary>
|
||||
// public List<string>? ReferenceImagesPrefixBase64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参考图URL列表
|
||||
/// </summary>
|
||||
// public List<string>? ReferenceImagesUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成图片PrefixBase64(包含前缀)
|
||||
/// </summary>
|
||||
// public string? StorePrefixBase64 { get; set; }
|
||||
public bool IsAnonymous { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成图片URL
|
||||
@@ -70,5 +60,5 @@ public class ImageTaskOutput
|
||||
/// <summary>
|
||||
/// 用户名称Id
|
||||
/// </summary>
|
||||
public Guid UserId { get; set; }
|
||||
public Guid? UserId { get; set; }
|
||||
}
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
/// </summary>
|
||||
public class PublishImageInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否匿名
|
||||
/// </summary>
|
||||
public bool IsAnonymous { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 任务ID
|
||||
/// </summary>
|
||||
|
||||
@@ -291,18 +291,29 @@ public class AiImageService : ApplicationService
|
||||
{
|
||||
Id = x.Id,
|
||||
Prompt = x.Prompt,
|
||||
IsAnonymous = x.IsAnonymous,
|
||||
StoreUrl = x.StoreUrl,
|
||||
TaskStatus = x.TaskStatus,
|
||||
PublishStatus = x.PublishStatus,
|
||||
Categories = x.Categories,
|
||||
CreationTime = x.CreationTime,
|
||||
ErrorInfo = null,
|
||||
UserName = x.UserName,
|
||||
UserId = x.UserId,
|
||||
|
||||
})
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
|
||||
;
|
||||
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total); ;
|
||||
|
||||
|
||||
output.ForEach(x =>
|
||||
{
|
||||
if (x.IsAnonymous)
|
||||
{
|
||||
x.UserName = null;
|
||||
x.UserId = null;
|
||||
}
|
||||
});
|
||||
|
||||
return new PagedResult<ImageTaskOutput>(total, output);
|
||||
}
|
||||
|
||||
@@ -330,9 +341,8 @@ public class AiImageService : ApplicationService
|
||||
throw new UserFriendlyException("该任务已发布");
|
||||
}
|
||||
|
||||
task.PublishStatus = PublishStatusEnum.Published;
|
||||
task.Categories = input.Categories ?? new List<string>();
|
||||
|
||||
//设置发布
|
||||
task.SetPublish(input.IsAnonymous,input.Categories);
|
||||
await _imageTaskRepository.UpdateAsync(task);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,11 @@ public class ImageStoreTaskAggregateRoot : FullAuditedAggregateRoot<Guid>
|
||||
[SugarColumn(IsJson = true)]
|
||||
public List<string> Categories { get; set; } = new();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否匿名
|
||||
/// </summary>
|
||||
public bool IsAnonymous { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 密钥id
|
||||
/// </summary>
|
||||
@@ -83,4 +87,18 @@ public class ImageStoreTaskAggregateRoot : FullAuditedAggregateRoot<Guid>
|
||||
TaskStatus = TaskStatusEnum.Success;
|
||||
StoreUrl = storeUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置发布
|
||||
/// </summary>
|
||||
/// <param name="isAnonymous"></param>
|
||||
/// <param name="categories"></param>
|
||||
public void SetPublish(bool isAnonymous,List<string> categories)
|
||||
{
|
||||
this.PublishStatus = PublishStatusEnum.Published;
|
||||
this.IsAnonymous = isAnonymous;
|
||||
this.Categories = categories;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user