|
@@ -96,6 +96,11 @@ namespace GxPress.Service.Implement.Collection
|
|
|
EndCollectionType = request.CollectionType,
|
|
|
};
|
|
|
var resultJson = await StructCollectionData(request.CollectionDataId, request.CollectionType, request.SourceUserId);
|
|
|
+ if (resultJson.ArticleImgUrl != null && resultJson.ArticleImgUrl.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < resultJson.ArticleImgUrl.Count; i++)
|
|
|
+ resultJson.ArticleImgUrl[i] = StringUtils.RemoveDomain(resultJson.ArticleImgUrl[i]);
|
|
|
+ }
|
|
|
collection.ResultJson = JsonConvert.SerializeObject(resultJson);
|
|
|
var query = new SqlKata.Query();
|
|
|
query.Where(nameof(Entity.Collection.UserId), request.UserId)
|
|
@@ -277,7 +282,23 @@ namespace GxPress.Service.Implement.Collection
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(item.FolderName))
|
|
|
item.FolderName = "根目录";
|
|
|
- item.Data = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
|
|
|
+ //item.Data = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
|
|
|
+ item.Data = JsonConvert.DeserializeObject<CollectionContentJsonData>(item.ResultJson);
|
|
|
+ if (item.Data != null)
|
|
|
+ {
|
|
|
+ item.Data.File = StringUtils.RemoveDomain(item.Data.File);
|
|
|
+ item.Data.MinFile = StringUtils.RemoveDomain(item.Data.MinFile);
|
|
|
+ item.Data.File = StringUtils.AddDomain(item.Data.File);
|
|
|
+ item.Data.MinFile = StringUtils.AddDomain(item.Data.MinFile);
|
|
|
+ }
|
|
|
+ if (item.Data.ArticleImgUrl != null && item.Data.ArticleImgUrl.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < item.Data.ArticleImgUrl.Count; i++)
|
|
|
+ {
|
|
|
+ item.Data.ArticleImgUrl[i] = StringUtils.RemoveDomain(item.Data.ArticleImgUrl[i]);
|
|
|
+ item.Data.ArticleImgUrl[i] = StringUtils.AddDomain(item.Data.ArticleImgUrl[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (string.IsNullOrWhiteSpace(item.Title))
|
|
|
{
|
|
|
item.Title = "";
|
|
@@ -344,7 +365,23 @@ namespace GxPress.Service.Implement.Collection
|
|
|
}
|
|
|
foreach (var item in result.Items)
|
|
|
{
|
|
|
- item.Data = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
|
|
|
+ //item.Data = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
|
|
|
+ item.Data = JsonConvert.DeserializeObject<CollectionContentJsonData>(item.ResultJson);
|
|
|
+ if (item.Data != null)
|
|
|
+ {
|
|
|
+ item.Data.File = StringUtils.RemoveDomain(item.Data.File);
|
|
|
+ item.Data.MinFile = StringUtils.RemoveDomain(item.Data.MinFile);
|
|
|
+ item.Data.File = StringUtils.AddDomain(item.Data.File);
|
|
|
+ item.Data.MinFile = StringUtils.AddDomain(item.Data.MinFile);
|
|
|
+ }
|
|
|
+ if (item.Data.ArticleImgUrl != null && item.Data.ArticleImgUrl.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < item.Data.ArticleImgUrl.Count; i++)
|
|
|
+ {
|
|
|
+ item.Data.ArticleImgUrl[i] = StringUtils.RemoveDomain(item.Data.ArticleImgUrl[i]);
|
|
|
+ item.Data.ArticleImgUrl[i] = StringUtils.AddDomain(item.Data.ArticleImgUrl[i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (string.IsNullOrWhiteSpace(item.Title))
|
|
|
{
|
|
|
item.Title = "";
|
|
@@ -782,5 +819,25 @@ namespace GxPress.Service.Implement.Collection
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
+
|
|
|
+ public async Task<bool> UpdateResultJosnAsync()
|
|
|
+ {
|
|
|
+ var query = Q.NewQuery();
|
|
|
+ query.WhereNull(nameof(Entity.Collection.ResultJson));
|
|
|
+ query.Limit(100);
|
|
|
+ var result = await _collectionRepository.GetAllAsync(query);
|
|
|
+ foreach (var item in result)
|
|
|
+ {
|
|
|
+ var jsonResult = await StructCollectionData(item.CollectionDataId, item.CollectionType, item.SourceUserId);
|
|
|
+ if (jsonResult.ArticleImgUrl != null && jsonResult.ArticleImgUrl.Count > 0)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < jsonResult.ArticleImgUrl.Count; i++)
|
|
|
+ jsonResult.ArticleImgUrl[i] = StringUtils.RemoveDomain(jsonResult.ArticleImgUrl[i]);
|
|
|
+ }
|
|
|
+ item.ResultJson = JsonConvert.SerializeObject(jsonResult);
|
|
|
+ await _collectionRepository.UpdateAsync(item);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|