| | |
| | | /*********************************************************************** |
| | | * Project: CoreCms |
| | | * ProjectName: 核心内容管理系统 |
| | | * Web: https://www.corecms.net |
| | | * Author: 大灰灰 |
| | | * Email: jianweie@163.com |
| | | * CreateTime: 2021/1/31 21:45:10 |
| | | * Project: baifenBinfa |
| | | * ProjectName: 百分兵法管理系统 |
| | | * Web: http://chuanyin.com |
| | | * Author: |
| | | * Email: |
| | | * CreateTime: 202403/02 |
| | | * Description: 暂无 |
| | | ***********************************************************************/ |
| | | |
| | |
| | | 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) |
| | | { |
| | | var jm = await _cartServices.Add(_user.ID, entity.ProductId, entity.Nums, entity.type, entity.cartType, entity.objectId); |
| | | |
| | | 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; |
| | | } |
| | | |
| | |
| | | public async Task<WebApiCallBack> GetList([FromBody] FMCartGetList entity) |
| | | { |
| | | var ids = CommonHelper.StringToIntArray(entity.ids); |
| | | |
| | | //获取数据 |
| | | var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, entity.receiptType, entity.userShipId, entity.objectId); |
| | | var jm = await _cartServices.GetCartInfos(_user.ID, ids, entity.type, entity.areaId, entity.point, entity.couponCode, entity.receiptType, entity.userShipId, entity.objectId, entity.goodsId); |
| | | |
| | | return jm; |
| | | } |