增加商铺列表
This commit is contained in:
1 parent
d5232c581c
commit
440510aa8c
19 files changed
+734
-77
No files matched your search
@@ -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)
|
||||
{
|
||||
/// <summary>按店铺 ID 获取 Cookie,仅在用户请求时读取。</summary>
|
||||
public Task<IReadOnlyList<ShopCookieInfo>> GetCookiesAsync(string shopId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentException.ThrowIfNullOrWhiteSpace(shopId);
|
||||
return transport.GetRequiredAsync<IReadOnlyList<ShopCookieInfo>>("shop/GetShopCookies", Method.Post,
|
||||
new { ShopIds = new[] { shopId } }, cancellationToken: cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>管理员分页查询商铺,筛选条件由服务端处理。</summary>
|
||||
public Task<PageResult<ShopInfo>> SearchAsync(ShopQueryRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(request);
|
||||
return transport.GetRequiredAsync<PageResult<ShopInfo>>("shop/GetAllShops", Method.Post,
|
||||
request, cancellationToken: cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
@@ -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; }
|
||||
|
||||
/// <param name="httpClient">可选的外部 HTTP 客户端,由调用方管理其生命周期。</param>
|
||||
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()
|
||||
|
||||
Reference in new issue
Block a user