云商品增加分组
This commit is contained in:
1 parent
861732ab7f
commit
8a85c3365b
11 files changed
+622
-109
No files matched your search
@@ -131,8 +131,10 @@ public sealed class ApiTransport
|
||||
private HttpItem CreateRequest(string route, MethodType method, object body,
|
||||
IDictionary<string, string> query, int timeoutMilliseconds)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(route) ||
|
||||
!Regex.IsMatch(route, @"\A[A-Za-z0-9_-]+(/[A-Za-z0-9_-]+)*\z"))
|
||||
string pathOnly = route?.Split('?', '#')[0];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pathOnly) ||
|
||||
!Regex.IsMatch(pathOnly, @"\A[A-Za-z0-9_-]+(/[A-Za-z0-9_-]+)*\z"))
|
||||
throw new ArgumentException("接口必须使用相对路由,例如 Auth/Login。", nameof(route));
|
||||
if (body != null) Validator.ValidateObject(body, new ValidationContext(body), true);
|
||||
if (timeoutMilliseconds <= 0) throw new ArgumentOutOfRangeException(nameof(timeoutMilliseconds));
|
||||
|
||||
@@ -49,14 +49,40 @@ public sealed class CloudGoodsApi
|
||||
public Task<PageData<CloudGoods>> SearchFavorites(UserFavoritesGoodsSearchRequest request)
|
||||
=> _transport.GetRequiredAsync<PageData<CloudGoods>>("CloudGoods/SearchFavorites", MethodType.Post, request);
|
||||
|
||||
public Task<int> Favorite(string userName, List<long> goodsIds)
|
||||
public Task<int> Favorite(string userName, List<long> goodsIds,int groupId)
|
||||
=> _transport.SendAsync<int>("CloudGoods/AddFavorite", MethodType.Post,
|
||||
new { UserName = userName, GoodsIds = goodsIds });
|
||||
new { UserName = userName, GoodsIds = goodsIds, GroupId= groupId });
|
||||
|
||||
public Task<int> RemoveFavorites(string userName, List<long> goodsIds)
|
||||
=> _transport.SendAsync<int>("CloudGoods/RemoveFavorites", MethodType.Post,
|
||||
new { UserName = userName, GoodsIds = goodsIds });
|
||||
|
||||
/// <summary>
|
||||
/// 创建分组
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="groupName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> CreateGroup(string userName, string groupName)
|
||||
{
|
||||
return await _transport.SendAsync<bool>("CloudGoods/CreateGroup", MethodType.Post,
|
||||
new { UserName = userName, GroupName = groupName });
|
||||
}
|
||||
public async Task<bool> DelGroupAsync(string userName, string groupName)
|
||||
{
|
||||
return await _transport.SendAsync<bool>("CloudGoods/DelGroup", MethodType.Post,
|
||||
new { UserName = userName, GroupName = groupName });
|
||||
}
|
||||
public async Task<bool> SetFavoriteGroupAsync(string userName, int groupId, IEnumerable<long> goodsIds)
|
||||
{
|
||||
return await _transport.SendAsync<bool>("CloudGoods/SetFavoriteGroup", MethodType.Post,
|
||||
new { UserName = userName, GroupId = groupId, GoodsIds = goodsIds });
|
||||
}
|
||||
public async Task<List<UserFavoriteGroup>> GetGroups(string userName)
|
||||
{
|
||||
return await _transport.SendAsync<List<UserFavoriteGroup>>($"CloudGoods/GetGroups?UserName={userName}", MethodType.Post);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>识别上传图片中的文字和品牌 Logo。</summary>
|
||||
public async Task<List<string>> RecognizeAsync(string urlMd5, byte[] jpeg)
|
||||
|
||||
Reference in new issue
Block a user