|
@@ -35,20 +35,18 @@ namespace GxPress.Api.AppControllers
|
|
|
try
|
|
|
{
|
|
|
var path = Common.Tools.StringUtils.GetWebRootPath(_environment.WebRootPath);
|
|
|
- var filepath = path + "/cache/20200428/music.mp4";
|
|
|
+ var filepath = path + "/cache/20200428/1588144602647614.mp4";
|
|
|
FileInfo fileInfo = new FileInfo(filepath);
|
|
|
- var key = $"music.mp4{page}";
|
|
|
+ var key = $"15881446026476141.mp4{page}";
|
|
|
var result = _cache.Get(key);
|
|
|
if (result != null)
|
|
|
- {
|
|
|
return File(result, "application/octet-stream", fileInfo.Name);
|
|
|
- }
|
|
|
- var blength = 1024 * 1024 * 5;
|
|
|
+ var blength = 1024 * 1024 * 1;
|
|
|
byte[] bytsize = new byte[blength];
|
|
|
//获取文件名后缀
|
|
|
string extension = Path.GetExtension(filepath);
|
|
|
//
|
|
|
- videoService.RedisVideo(filepath, bytsize, blength, "music.mp4");
|
|
|
+ videoService.RedisVideo(filepath, bytsize, blength, "15881446026476141.mp4");
|
|
|
//获取文件流
|
|
|
using (FileStream stream = new FileStream(filepath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
|
|
|
{
|
|
@@ -63,7 +61,7 @@ namespace GxPress.Api.AppControllers
|
|
|
//获取后缀名
|
|
|
var ext = fileInfo.Extension;
|
|
|
new FileExtensionContentTypeProvider().Mappings.TryGetValue(ext, out var contenttype);
|
|
|
- return File(bytsize, "application/octet-stream", fileInfo.Name);
|
|
|
+ return File(bytsize, contenttype??"application/octet-stream", fileInfo.Name);
|
|
|
}
|
|
|
catch (FileNotFoundException e)
|
|
|
{
|