mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 22:43:25 +08:00
【优化】服务商品修复购买总数量限制,个人购买数量限制。
This commit is contained in:
@@ -251,6 +251,23 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
return jm;
|
||||
}
|
||||
|
||||
//判断当前数量是否超过限制数量
|
||||
var orderCount = await _userServicesOrderServices.GetCountAsync(p => p.status == (int)GlobalEnumVars.ServicesOrderStatus.正常 && p.servicesId == entity.id);
|
||||
|
||||
if (orderCount >= data.amount)
|
||||
{
|
||||
jm.msg = "当前项目已售罄。";
|
||||
return jm;
|
||||
}
|
||||
|
||||
//获取自己的购买数量
|
||||
var userOrderCount = await _userServicesOrderServices.GetCountAsync(p => p.status == (int)GlobalEnumVars.ServicesOrderStatus.正常 && p.servicesId == entity.id && p.userId == _user.ID);
|
||||
if (data.maxBuyNumber >= 0 && userOrderCount > data.maxBuyNumber)
|
||||
{
|
||||
jm.msg = "已超出购买数量限制。";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var order = new CoreCmsUserServicesOrder();
|
||||
order.serviceOrderId = CommonHelper.GetSerialNumberType((int)GlobalEnumVars.SerialNumberType.服务订单编号);
|
||||
order.userId = _user.ID;
|
||||
|
||||
Reference in New Issue
Block a user