From 86ee692a042fbfdcf828bf05a45545ca1ae415b4 Mon Sep 17 00:00:00 2001 From: chfei Date: Mon, 2 Nov 2026 09:30:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=9F=E6=96=B0=20=E6=9C=AA=E5=91=BD?= =?UTF-8?q?=E4=B8=AD=E4=BA=91=E6=95=B0=E6=8D=AE=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/GoodsController.cs | 25 ++++++++++++++++--- Store.API/dotnet-tools.json | 13 ++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 Store.API/dotnet-tools.json diff --git a/Modules/CloudProduct/Controllers/GoodsController.cs b/Modules/CloudProduct/Controllers/GoodsController.cs index 38bf367..3af2471 100644 --- a/Modules/CloudProduct/Controllers/GoodsController.cs +++ b/Modules/CloudProduct/Controllers/GoodsController.cs @@ -362,9 +362,16 @@ namespace Store.Modules.CloudProduct.Controllers [EndpointSummary("查询商品详情")] public async Task GetGoodsDetail([FromQuery] long goodsId) { - var raw = await GetRawDataOrThrowAsync(goodsId); - var node = JsonNode.Parse(raw); - return node ?? throw new AppException("商品详情解析失败", ResultCode.BusinessError); + try + { + var raw = await GetRawDataOrThrowAsync(goodsId); + var node = JsonNode.Parse(raw); + return node ?? throw new AppException("商品详情解析失败", ResultCode.BusinessError); + } + catch(Exception ex) + { + throw new AppException(ex.Message); + } } /// @@ -374,7 +381,14 @@ namespace Store.Modules.CloudProduct.Controllers [EndpointSummary("读取商品原始数据")] public async Task GetGoodsRawData([FromQuery] long goodsId) { - return await GetRawDataOrThrowAsync(goodsId); + try + { + return await GetRawDataOrThrowAsync(goodsId); + } + catch (Exception ex) + { + throw new AppException(ex.Message); + } } /// @@ -433,7 +447,10 @@ namespace Store.Modules.CloudProduct.Controllers var raw = await _rawDataStorage.ReadAsync(goodsId); if (raw == null) + { + System.IO.File.WriteAllText("./NoGoods.txt", goodsId.ToString()); throw new AppException($"商品原始数据不存在: {goodsId}", ResultCode.NotFound); + } return raw; } diff --git a/Store.API/dotnet-tools.json b/Store.API/dotnet-tools.json new file mode 100644 index 0000000..5e9fe39 --- /dev/null +++ b/Store.API/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "10.0.14", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file