/// <summary> /// 获取图片URL /// </summary> /// <param name="imgIds"></param> /// <param name="fileManager"></param> /// <returns></returns> public static async Task <List <KeyValuePair <long, string> > > GetImgUrlsAsync(List <long> imgIds, IFileManager fileManager) { List <KeyValuePair <long, string> > pairs = new List <KeyValuePair <long, string> >(); var files = await fileManager.GetFilesByIdsAsync(imgIds); foreach (var item in files) { pairs.Add(new KeyValuePair <long, string>(item.Id, OssOptionUtil.GetOSSUrl(item.OssKey))); } return(pairs); }
/// <summary> /// 获取素材分类下所有的素材 /// </summary> /// <returns></returns> public async Task <IActionResult> GetAllFile(long tagId, int page) { if (page == 0) { page = 1; } EntitySet <Interface.Models.Results.Commons.FileResult> files = await manager.GetAllFileAsync(tagId, page); foreach (var item in files.Entities) { item.Url = OssOptionUtil.GetOSSUrl(item.OssKey); } return(Json(files)); }