/// <summary> /// 获取商品评价相册图片的储存文件 /// </summary> /// <param name="id">订单商品Id</param> /// <param name="index">图片序号</param> /// <param name="type">商品相册的图片类型,原图或缩略图等</param> /// <returns></returns> public virtual IFileEntry GetAlbumImageStorageFile( Guid id, long index, ProductRatingAlbumImageType type) { var fileStorage = Application.Ioc.Resolve <IFileStorage>(); var indexString = index.ToString(); var suffix = type.GetAttribute <ProductRatingAlbumImageSuffixAttribute>().Suffix; var path = string.Format(AlbumImagePathFormat, id, indexString, suffix); return(fileStorage.GetStorageFile(path.Split('/').Skip(1).ToArray())); }
/// <summary> /// 获取商品评价相册图片的网页路径,不存在时返回null /// </summary> /// <param name="id">订单商品Id</param> /// <param name="index">图片序号</param> /// <param name="type">商品相册的图片类型,原图或缩略图等</param> /// <returns></returns> public virtual string GetAlbumImageWebPath( Guid id, long index, ProductRatingAlbumImageType type) { var storageFile = GetAlbumImageStorageFile(id, index, type); if (!storageFile.Exists) { return(null); } var indexString = index.ToString(); var suffix = type.GetAttribute <ProductRatingAlbumImageSuffixAttribute>().Suffix; var webPath = string.Format(AlbumImagePathFormat, id, indexString, suffix); webPath += "?mtime=" + storageFile.LastWriteTimeUtc.Ticks; return(webPath); }