From 440510aa8cd5638c9f5f5f063ceb2a7a01975d6c Mon Sep 17 00:00:00 2001 From: chfei Date: Mon, 16 Nov 2026 12:17:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E9=93=BA=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Store.Management.Api/Shops/ShopApi.cs | 25 +++ .../Shops/ShopQueryRequest.cs | 11 + Source/Store.Management.Api/StoreApiClient.cs | 2 + .../Controls/DataGridEx/DataGridEx.xaml | 90 +++----- .../Mappers/ShopMapper.cs | 11 + .../Resources/FrameworkTheme.xaml | 52 +++++ .../Services/ShopService.cs | 22 ++ .../ViewModels/ShopItemViewModel.cs | 14 ++ .../Store.Management.Models/ShopCookieInfo.cs | 7 + Source/Store.Management.Models/ShopInfo.cs | 14 ++ Source/Store.Management/App.xaml.cs | 1 + .../ViewModels/MainViewModel.LeftNav.cs | 5 +- .../ViewModels/ShopManagementViewModel.cs | 117 ++++++++++ .../Views/DataGridTestView.xaml | 12 +- .../Views/ShopManagementView.xaml | 207 ++++++++++++++++++ .../Views/ShopManagementView.xaml.cs | 8 + .../Views/UserManagementPage.xaml | 15 +- .../Program.cs | 16 +- .../ShopManagementChecks.cs | 182 +++++++++++++++ 19 files changed, 734 insertions(+), 77 deletions(-) create mode 100644 Source/Store.Management.Api/Shops/ShopApi.cs create mode 100644 Source/Store.Management.Api/Shops/ShopQueryRequest.cs create mode 100644 Source/Store.Management.Framework/Mappers/ShopMapper.cs create mode 100644 Source/Store.Management.Framework/Services/ShopService.cs create mode 100644 Source/Store.Management.Framework/ViewModels/ShopItemViewModel.cs create mode 100644 Source/Store.Management.Models/ShopCookieInfo.cs create mode 100644 Source/Store.Management.Models/ShopInfo.cs create mode 100644 Source/Store.Management/ViewModels/ShopManagementViewModel.cs create mode 100644 Source/Store.Management/Views/ShopManagementView.xaml create mode 100644 Source/Store.Management/Views/ShopManagementView.xaml.cs create mode 100644 Tests/Store.Management.App.SmokeTests/ShopManagementChecks.cs diff --git a/Source/Store.Management.Api/Shops/ShopApi.cs b/Source/Store.Management.Api/Shops/ShopApi.cs new file mode 100644 index 0000000..3b8dd42 --- /dev/null +++ b/Source/Store.Management.Api/Shops/ShopApi.cs @@ -0,0 +1,25 @@ +using RestSharp; +using Store.Management.Api.Models; +using Store.Management.Api.Transport; +using Store.Management.Models; + +namespace Store.Management.Api.Shops; + +public sealed class ShopApi(ApiTransport transport) +{ + /// 按店铺 ID 获取 Cookie,仅在用户请求时读取。 + public Task> GetCookiesAsync(string shopId, CancellationToken cancellationToken = default) + { + ArgumentException.ThrowIfNullOrWhiteSpace(shopId); + return transport.GetRequiredAsync>("shop/GetShopCookies", Method.Post, + new { ShopIds = new[] { shopId } }, cancellationToken: cancellationToken); + } + + /// 管理员分页查询商铺,筛选条件由服务端处理。 + public Task> SearchAsync(ShopQueryRequest request, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(request); + return transport.GetRequiredAsync>("shop/GetAllShops", Method.Post, + request, cancellationToken: cancellationToken); + } +} diff --git a/Source/Store.Management.Api/Shops/ShopQueryRequest.cs b/Source/Store.Management.Api/Shops/ShopQueryRequest.cs new file mode 100644 index 0000000..f728804 --- /dev/null +++ b/Source/Store.Management.Api/Shops/ShopQueryRequest.cs @@ -0,0 +1,11 @@ +using Store.Management.Api.Models; + +namespace Store.Management.Api.Shops; + +public sealed class ShopQueryRequest : PageRequest +{ + public string? SearchUserName { get; init; } + public string? SearchId { get; init; } + public string? SearchName { get; init; } + public string? SearchNotes { get; init; } +} diff --git a/Source/Store.Management.Api/StoreApiClient.cs b/Source/Store.Management.Api/StoreApiClient.cs index 0b493b0..58f8dde 100644 --- a/Source/Store.Management.Api/StoreApiClient.cs +++ b/Source/Store.Management.Api/StoreApiClient.cs @@ -11,6 +11,7 @@ public sealed class StoreApiClient : IDisposable public ApiTransport Transport { get; } public AuthApi Auth { get; } public UserApi Users { get; } + public Shops.ShopApi Shops { get; } /// 可选的外部 HTTP 客户端,由调用方管理其生命周期。 public StoreApiClient(ApiClientOptions options, HttpClient? httpClient = null) @@ -22,6 +23,7 @@ public sealed class StoreApiClient : IDisposable Transport = new ApiTransport(options, Session, httpClient); Auth = new AuthApi(Transport, Session); Users = new UserApi(Transport); + Shops = new Shops.ShopApi(Transport); } public void Dispose() diff --git a/Source/Store.Management.Framework/Controls/DataGridEx/DataGridEx.xaml b/Source/Store.Management.Framework/Controls/DataGridEx/DataGridEx.xaml index 7830e8a..74f07e7 100644 --- a/Source/Store.Management.Framework/Controls/DataGridEx/DataGridEx.xaml +++ b/Source/Store.Management.Framework/Controls/DataGridEx/DataGridEx.xaml @@ -176,7 +176,7 @@ - + @@ -203,7 +203,7 @@ - + @@ -334,7 +334,7 @@ - + @@ -370,65 +370,42 @@ + BorderBrush="LightGray" + BorderThickness="1"> - - - - + + + + + - + @@ -1006,7 +983,10 @@ - + + + + + + + + + + + + + Fonts/iconfont.ttf#iconfont + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Store.Management/Views/ShopManagementView.xaml.cs b/Source/Store.Management/Views/ShopManagementView.xaml.cs new file mode 100644 index 0000000..b563d06 --- /dev/null +++ b/Source/Store.Management/Views/ShopManagementView.xaml.cs @@ -0,0 +1,8 @@ +using System.Windows.Controls; + +namespace Store.Management.Views; + +public partial class ShopManagementView : UserControl +{ + public ShopManagementView() => InitializeComponent(); +} diff --git a/Source/Store.Management/Views/UserManagementPage.xaml b/Source/Store.Management/Views/UserManagementPage.xaml index e3a4956..874c2e2 100644 --- a/Source/Store.Management/Views/UserManagementPage.xaml +++ b/Source/Store.Management/Views/UserManagementPage.xaml @@ -47,20 +47,12 @@ - - + + @@ -70,7 +62,6 @@ + Style="{StaticResource TableSearchPrimaryButtonStyle}" />