Browse Source

去除无效任务

master
feng 3 years ago
parent
commit
f95d0c41d2
  1. 42
      src/Coldairarrow.Business/HuiYan/pricetasklogBusiness.cs
  2. 8
      客户端/齐越慧眼/齐越慧眼/ApiHelper.cs

42
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() })); return Success(list.GroupBy(c => c).Select(c => new { Id = c.Key, Count = c.Count() }));
} }
public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input,string keyWord) public PageResult<TeamitemDto> GetItems(PageInput<ConditionDTO> input,string keyWord)
{ {
@ -271,6 +273,41 @@ namespace Coldairarrow.Business.HuiYan
} }
bool CheckIsMaxTaskCount()
{
Expression<Func<teamitems, items, pricetasklog, TeamitemDto>> 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<List<TeamItemExtension>>(a.ExtensionJson)
};
select = select.BuildExtendSelectExpre();
var q_titem = Db.GetIQueryable<teamitems>();
var q = from a in q_titem.AsExpandable()
join b in Db.GetIQueryable<items>() on a.ItemId equals b.Id into ab
from ba in ab.DefaultIfEmpty()
join c in Db.GetIQueryable<pricetasklog>() on a.Id equals c.TeamItemId into ac
from bb in ac.DefaultIfEmpty()
select @select.Invoke(a, ba, bb);
//查询对应状态
var where = LinqHelper.True<TeamitemDto>().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) public AjaxResult AcceptTask(string teamItemId)
{ {
var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId); var teamItem = Db.GetIQueryable<teamitems>().FirstOrDefault(c => c.Id == teamItemId);
@ -280,10 +317,7 @@ namespace Coldairarrow.Business.HuiYan
return Error("任务不存在!"); return Error("任务不存在!");
} }
if (CheckIsMaxTaskCount())
var nowCount = Db.GetIQueryable<pricetasklog>().Count(c => c.State== PriceTaskState. && c.UserId == _operator.UserId);
if (nowCount >= 10)
{ {
return Error("任务接取已达上限!"); return Error("任务接取已达上限!");
} }

8
客户端/齐越慧眼/齐越慧眼/ApiHelper.cs

@ -13,8 +13,8 @@ namespace 齐越慧眼
public class ApiHelper public class ApiHelper
{ {
#if DEBUG #if DEBUG
public static string ApiBase { get; set; } = "http://localhost:5000"; //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://hyapi.qiyue666.com";
#else #else
public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com"; public static string ApiBase { get; set; } = "http://hyapi.qiyue666.com";
#endif #endif
@ -30,9 +30,9 @@ namespace 齐越慧眼
{ {
#if DEBUG #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 #endif
if (string.IsNullOrEmpty(jwtToken)) if (string.IsNullOrEmpty(jwtToken))

Loading…
Cancel
Save