diff --git a/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs b/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs index dc34309..928c0bc 100644 --- a/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs +++ b/src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs @@ -109,6 +109,8 @@ namespace Coldairarrow.Business.HuiYan return Success(list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() })); } + + public PageResult GetItems(PageInput input,string keyWord) { @@ -271,6 +273,41 @@ namespace Coldairarrow.Business.HuiYan } + bool CheckIsMaxTaskCount() + { + Expression> select = (a, b, c) => new TeamitemDto + { + GoodsId = b.GoodsId, + HasFilter = b.HasFilter, + Platform = b.Platform, + GoodsUrl = b.GoodsUrl, + PriceTaskId = c.Id, + PriceTaskState = (int)c.State, + Extensions = Newtonsoft.Json.JsonConvert.DeserializeObject>(a.ExtensionJson) + }; + + select = select.BuildExtendSelectExpre(); + + var q_titem = Db.GetIQueryable(); + var q = from a in q_titem.AsExpandable() + join b in Db.GetIQueryable() on a.ItemId equals b.Id into ab + from ba in ab.DefaultIfEmpty() + join c in Db.GetIQueryable() on a.Id equals c.TeamItemId into ac + from bb in ac.DefaultIfEmpty() + select @select.Invoke(a, ba, bb); + + //查询对应状态 + var where = LinqHelper.True().And(c => c.PriceTaskUserId == _operator.UserId); + + where = where.And(c => c.PriceTaskState != null); + + var list = q.Where(where).Select(c => c.PriceTaskState).ToList(); + + int? hasTaskCount = list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() }).Where(c => c.Id == 0).FirstOrDefault()?.Count; + + return hasTaskCount > 10; + } + public AjaxResult AcceptTask(string teamItemId) { var teamItem = Db.GetIQueryable().FirstOrDefault(c => c.Id == teamItemId); @@ -280,10 +317,7 @@ namespace Coldairarrow.Business.HuiYan return Error("任务不存在!"); } - - - var nowCount = Db.GetIQueryable().Count(c => c.State== PriceTaskState.待比价 && c.UserId == _operator.UserId); - if (nowCount >= 10) + if (CheckIsMaxTaskCount()) { return Error("任务接取已达上限!"); } diff --git a/客户端/齐越慧眼/齐越慧眼/ApiHelper.cs b/客户端/齐越慧眼/齐越慧眼/ApiHelper.cs index ca9821c..cf6218f 100644 --- a/客户端/齐越慧眼/齐越慧眼/ApiHelper.cs +++ b/客户端/齐越慧眼/齐越慧眼/ApiHelper.cs @@ -13,8 +13,8 @@ namespace 齐越慧眼 public class ApiHelper { #if DEBUG - public static string ApiBase { get; set; } = "http://localhost:5000"; - //public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com"; + //public static string ApiBase { get; set; } = "http://localhost:5000"; + public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com"; #else public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com"; #endif @@ -30,9 +30,9 @@ namespace 齐越慧眼 { #if DEBUG - return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTE5NTA3MzgwMTkzMjAyMTc2IiwidGVhbUlkIjoiMTQzOTg5ODUxNDIyMDkxMjY0MCIsImV4cCI6MTY4ODExNzc4Nn0.xnkLLkvmMtNwS1u4SAEj-i6rwNZ1_prx_LmkGQEP47o"; + //return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTE5NTA3MzgwMTkzMjAyMTc2IiwidGVhbUlkIjoiMTQzOTg5ODUxNDIyMDkxMjY0MCIsImV4cCI6MTY4ODExNzc4Nn0.xnkLLkvmMtNwS1u4SAEj-i6rwNZ1_prx_LmkGQEP47o"; - //return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTAwNjY3OTAyNDU2NTAwMjI0IiwidGVhbUlkIjoiMTQ2MzAyOTM1NTEwNDk2NDYwOCIsImV4cCI6MTY4MzM0NDg3Nn0.6AsD6DK9Or05w8HPhjb9tQY8RJAT4zo4ouH9sasl_Rk"; + return "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxNTIwOTc1OTY0NzczODE0MjcyIiwidGVhbUlkIjoiMTQ2MzAyOTM1NTEwNDk2NDYwOCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE2OTU1NDAzMTN9.baOvngaBp67FXWlVVlMLbNXXA2KSHzA0gGZYWrZ59uk"; #endif if (string.IsNullOrEmpty(jwtToken))