| | |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.Model.ViewModels.DTO; |
| | | using CoreCms.Net.Model.ViewModels.UI; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | |
| | | namespace CoreCms.Net.Web.WebApi.Controllers |
| | | { |
| | |
| | | { |
| | | private readonly IHttpContextUser _user; |
| | | private readonly ICoreCmsCartServices _cartServices; |
| | | private readonly IBfbfComAPIService _bfbfComAPIService; |
| | | |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | public CartController(IHttpContextUser user, ICoreCmsCartServices cartServices) |
| | | public CartController(IHttpContextUser user, ICoreCmsCartServices cartServices,IBfbfComAPIService bfbfComAPIService) |
| | | { |
| | | _user = user; |
| | | _cartServices = cartServices; |
| | | _bfbfComAPIService = bfbfComAPIService; |
| | | } |
| | | |
| | | //公共接口==================================================================================================== |
| | |
| | | [Authorize] |
| | | public async Task<WebApiCallBack> AddCart([FromBody] FMCartAdd entity) |
| | | { |
| | | |
| | | if ((await _bfbfComAPIService.IsDictionary(_user.ID)) && (entity.cartType != 1||entity.cartType!=4))//1是普通单,4 是秒杀 |
| | | { |
| | | //经销商进制发起团购 |
| | | return new WebApiCallBack |
| | | { |
| | | status = false, |
| | | msg = " 对不起 经销商不可以发起团购或者拼团" |
| | | |
| | | }; |
| | | } |
| | | |
| | | |
| | | var jm = await _cartServices.Add(_user.ID, entity.ProductId, entity.Nums, entity.type, entity.cartType, entity.objectId,entity.isCustomizable); |
| | | return jm; |
| | | } |