云商品增加分组
This commit is contained in:
1 parent
861732ab7f
commit
8a85c3365b
11 files changed
+622
-109
No files matched your search
@@ -9,6 +9,7 @@ using System.Linq;
|
||||
using Work.Store.Api;
|
||||
using System.Threading.Tasks;
|
||||
using Work.Api.Wx;
|
||||
using AllBase.Model;
|
||||
|
||||
namespace Work.Services
|
||||
{
|
||||
@@ -17,6 +18,23 @@ namespace Work.Services
|
||||
/// </summary>
|
||||
public class CloudGoodsService
|
||||
{
|
||||
public static List<UserFavoriteGroup> UserGroups { get; private set; }
|
||||
static CloudGoodsService()
|
||||
{
|
||||
GetGroups(BaseClass.UserName).ContinueWith(t =>
|
||||
{
|
||||
if (t.IsFaulted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (t.IsCanceled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UserGroups = t.Result;
|
||||
});
|
||||
}
|
||||
public static async Task<PageData<CloudGoods>> GetGoods(GoodsSearchRequest request)
|
||||
{
|
||||
return await StoreApiClient.Instance.CloudGoods.GetGoods(request);
|
||||
@@ -178,7 +196,10 @@ namespace Work.Services
|
||||
}
|
||||
logs.Add(new RecordViolationLogRequest
|
||||
{
|
||||
ShopId = shopId, GoodsId = item.GoodsId, ReasonId = reasonId, Action = ViolationLogAction.Report
|
||||
ShopId = shopId,
|
||||
GoodsId = item.GoodsId,
|
||||
ReasonId = reasonId,
|
||||
Action = ViolationLogAction.Report
|
||||
});
|
||||
}
|
||||
await TryRecordLogs(logs);
|
||||
@@ -351,7 +372,10 @@ namespace Work.Services
|
||||
}
|
||||
logs.AddRange(status.ReasonIds.Select(id => new RecordViolationLogRequest
|
||||
{
|
||||
ShopId = shopId, GoodsId = status.GoodsId, ReasonId = id, Action = action
|
||||
ShopId = shopId,
|
||||
GoodsId = status.GoodsId,
|
||||
ReasonId = id,
|
||||
Action = action
|
||||
}));
|
||||
}
|
||||
await TryRecordLogs(logs).ConfigureAwait(false);
|
||||
@@ -409,6 +433,49 @@ namespace Work.Services
|
||||
}
|
||||
|
||||
#region user
|
||||
/// <summary>
|
||||
/// 创建分组
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="groupName"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> CreateGroup(string userName, string groupName)
|
||||
{
|
||||
bool ret = await StoreApiClient.Instance.CloudGoods.CreateGroup(userName, groupName);
|
||||
if (ret)
|
||||
{
|
||||
UserGroups = await GetGroups(userName);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public static async Task<bool> DelGroupAsync(string userName, string groupName)
|
||||
{
|
||||
bool ret = await StoreApiClient.Instance.CloudGoods.DelGroupAsync(userName, groupName);
|
||||
if (ret)
|
||||
{
|
||||
UserGroups = await GetGroups(userName);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
public static async Task<bool> SetFavoriteGroupAsync(string userName, int groupId, IEnumerable<long> goodsIds)
|
||||
{
|
||||
bool ret = await StoreApiClient.Instance.CloudGoods.SetFavoriteGroupAsync(userName, groupId, goodsIds);
|
||||
if (ret)
|
||||
{
|
||||
UserGroups = await GetGroups(userName);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取分组
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<List<UserFavoriteGroup>> GetGroups(string userName)
|
||||
{
|
||||
return await StoreApiClient.Instance.CloudGoods.GetGroups(userName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索收藏
|
||||
/// </summary>
|
||||
@@ -423,7 +490,7 @@ namespace Work.Services
|
||||
{
|
||||
item.DetectionResult = item.IsSafe == null ? "未检测" : item.IsSafe.Value ? "安全" : "违规";
|
||||
}
|
||||
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
@@ -434,9 +501,9 @@ namespace Work.Services
|
||||
/// <returns></returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
|
||||
public static async Task<int> Favorite(List<long> goodsIds)
|
||||
public static async Task<int> Favorite(List<long> goodsIds, int groupId)
|
||||
{
|
||||
return await StoreApiClient.Instance.CloudGoods.Favorite(GetUserName(), goodsIds);
|
||||
return await StoreApiClient.Instance.CloudGoods.Favorite(GetUserName(), goodsIds, groupId);
|
||||
}
|
||||
/// <summary>
|
||||
/// 取消收藏
|
||||
@@ -537,7 +604,10 @@ namespace Work.Services
|
||||
/// 标题(模糊搜索)
|
||||
/// </summary>
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 分组ID
|
||||
/// </summary>
|
||||
public int? GroupId { get; set; }
|
||||
/// <summary>
|
||||
/// 最低价格(元)
|
||||
/// </summary>
|
||||
@@ -663,6 +733,9 @@ namespace Work.Services
|
||||
/// </summary>
|
||||
public string Title { get; set; } = string.Empty;
|
||||
|
||||
public int GroupId { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
@@ -742,4 +815,10 @@ namespace Work.Services
|
||||
set => SetValue(value);
|
||||
}
|
||||
}
|
||||
|
||||
public class UserFavoriteGroup
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string GroupName { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user