Skip to content

Commit 919d00d

Browse files
committed
refactor: 瀑布流 api 支持部署与开发环境
1 parent 8ff5045 commit 919d00d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/BootstrapBlazor.Server/Controllers/WaterfallController.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ public async Task<IActionResult> Index([FromServices] IWebHostEnvironment env, [
2222
{
2323
var interval = Random.Shared.Next(1, 2000);
2424
await Task.Delay(interval);
25-
var fileName = Path.Combine(env.WebRootPath, "images/waterfall", $"{id}.jpeg");
25+
#if DEBUG
26+
var fileName = Path.Combine(env.WebRootPath, "../../");
27+
#else
28+
var fileName = Path.Combine(AppContext.BaseDirectory, "_content");
29+
#endif
30+
fileName = Path.Combine(fileName, "BootstrapBlazor.Shared/wwwroot/images/waterfall", $"{id}.jpeg");
2631
return new PhysicalFileResult(fileName, "images/jpeg");
2732
}
2833
}

0 commit comments

Comments
 (0)