| | |
| | | /*********************************************************************** |
| | | * 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 System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Threading.Tasks; |
| | | using CoreCms.Net.Auth.HttpContextUser; |
| | | using CoreCms.Net.Configuration; |
| | | using CoreCms.Net.DTO.ComponentsDTO; |
| | | using CoreCms.Net.IRepository; |
| | | using CoreCms.Net.IRepository.UnitOfWork; |
| | | using CoreCms.Net.IServices; |
| | | using CoreCms.Net.IServices.baifenbingfa; |
| | | using CoreCms.Net.Loging; |
| | | using CoreCms.Net.Model.Entities; |
| | | using CoreCms.Net.Model.Entities.Expression; |
| | |
| | | private readonly ICoreCmsPinTuanRuleServices _pinTuanRuleServices; |
| | | private readonly ICoreCmsServicesServices _servicesServices; |
| | | private readonly ICoreCmsGoodsCategoryExtendServices _goodsCategoryExtendServices; |
| | | |
| | | |
| | | private readonly IHttpContextUser _contextUser; |
| | | private readonly IBfbfComAPIService _bfbfComAPIService; |
| | | private readonly IUnitOfWork _unitOfWork; |
| | | |
| | | public CoreCmsPagesServices(IUnitOfWork unitOfWork |
| | | , ICoreCmsPagesRepository dal |
| | | , ICoreCmsPagesItemsRepository pagesItemsRepository, ICoreCmsPromotionServices promotionServices, ICoreCmsNoticeServices noticeServices, ICoreCmsGoodsCategoryServices goodsCategoryServices, ICoreCmsSettingServices settingServices, ICoreCmsGoodsServices goodsServices, ICoreCmsArticleServices articleServices, ICoreCmsPromotionConditionServices promotionConditionServices, ICoreCmsPinTuanRuleServices pinTuanRuleServices, ICoreCmsServicesServices servicesServices, ICoreCmsArticleTypeServices articleTypeServices, ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices) |
| | | , ICoreCmsPagesItemsRepository pagesItemsRepository, |
| | | ICoreCmsPromotionServices promotionServices, |
| | | ICoreCmsNoticeServices noticeServices, |
| | | ICoreCmsGoodsCategoryServices goodsCategoryServices, |
| | | ICoreCmsSettingServices settingServices, |
| | | ICoreCmsGoodsServices goodsServices, |
| | | ICoreCmsArticleServices articleServices, |
| | | ICoreCmsPromotionConditionServices promotionConditionServices, |
| | | ICoreCmsPinTuanRuleServices pinTuanRuleServices, |
| | | ICoreCmsServicesServices servicesServices, |
| | | ICoreCmsArticleTypeServices articleTypeServices, |
| | | ICoreCmsGoodsCategoryExtendServices goodsCategoryExtendServices, |
| | | IHttpContextUser httpContextUser, |
| | | IBfbfComAPIService bfbfComAPIService) |
| | | { |
| | | this._dal = dal; |
| | | _pagesItemsRepository = pagesItemsRepository; |
| | |
| | | _goodsCategoryExtendServices = goodsCategoryExtendServices; |
| | | base.BaseDal = dal; |
| | | _unitOfWork = unitOfWork; |
| | | _contextUser= httpContextUser; |
| | | _bfbfComAPIService = bfbfComAPIService; |
| | | } |
| | | |
| | | |
| | |
| | | /// <returns></returns> |
| | | public async Task<WebApiCallBack> GetPageConfig(string code) |
| | | { |
| | | |
| | | var userID= _contextUser.ID; |
| | | |
| | | var jm = new WebApiCallBack(); |
| | | |
| | | var wherePage = PredicateBuilder.True<CoreCmsPages>(); |
| | |
| | | break; |
| | | case "goodTabBar": |
| | | { |
| | | bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID); |
| | | var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters); |
| | | if (parameters != null && parameters.ContainsKey("list")) |
| | | { |
| | |
| | | limit = limit > 0 ? limit : 10; |
| | | |
| | | var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, p => p.createTime, OrderByType.Desc, true, true, 60); |
| | | |
| | | if(goods!=null) |
| | | { |
| | | //百分兵法经销商修改价格 |
| | | if(isDic) |
| | | { |
| | | foreach (var gd in goods) |
| | | { |
| | | gd.price = gd.distributionPrice; |
| | | } |
| | | } |
| | | } |
| | | if (goods != null && goods.Any()) |
| | | { |
| | | var result = JArray.FromObject(goods); |
| | |
| | | } |
| | | case "goods": |
| | | { |
| | | |
| | | var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters); |
| | | |
| | | |
| | | |
| | | var where = PredicateBuilder.True<GoodListDTO>(); |
| | | if (parameters != null && parameters.ContainsKey("type") && parameters["type"].ToString() == "auto") |
| | | { |
| | |
| | | var classifyId = parameters["classifyId"].ObjectToInt(0); |
| | | var gc = await _goodsCategoryServices.GetCaChe(); |
| | | var childCats = gc.Where(p => p.parentId == classifyId).ToList(); |
| | | //获取当前配置的商品分类 |
| | | var tgc = gc.Where(x => x.id == classifyId).FirstOrDefault(); |
| | | |
| | | //给返回参数增加key |
| | | if(!string.IsNullOrEmpty(tgc?.key)) |
| | | |
| | | //增加商品分类的key |
| | | parameters.Add("key",tgc?.key??"" ); |
| | | |
| | | var catIds = childCats != null && childCats.Any() |
| | | ? childCats.Select(p => p.id).ToList() |
| | | : new List<int>(); |
| | |
| | | } |
| | | limit = limit > 0 ? limit : 10; |
| | | |
| | | var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, " sort desc,id desc ", true, true, 60); |
| | | var goods = await _goodsServices.QueryListByComponentsAsync(where, limit, " sort asc,id asc ", true, true, 60); |
| | | if (goods != null) |
| | | { |
| | | bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID); |
| | | //百分兵法经销商修改价格 |
| | | if (isDic) |
| | | { |
| | | foreach (var gd in goods) |
| | | { |
| | | gd.price = gd.distributionPrice; |
| | | } |
| | | } |
| | | } |
| | | if (goods != null && goods.Any()) |
| | | { |
| | | var result = JArray.FromObject(goods); |
| | |
| | | count = goodids.Count; |
| | | } |
| | | var goods = await _goodsServices.QueryListByComponentsAsync(where, count, orderBy, true, true, 60); |
| | | if (goods != null) |
| | | { |
| | | bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID); |
| | | //百分兵法经销商修改价格 |
| | | if (isDic) |
| | | { |
| | | foreach (var gd in goods) |
| | | { |
| | | gd.price = gd.distributionPrice; |
| | | } |
| | | } |
| | | } |
| | | if (goods != null && goods.Any()) |
| | | { |
| | | var result = JArray.FromObject(goods); |
| | |
| | | break; |
| | | case "groupPurchase": |
| | | { |
| | | //团购 取消 |
| | | bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID); |
| | | if (isDic) |
| | | continue; |
| | | var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters); |
| | | if (parameters != null && parameters.ContainsKey("list")) |
| | | { |
| | |
| | | break; |
| | | } |
| | | case "seckill": |
| | | { |
| | | {//秒杀 |
| | | var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters); |
| | | if (parameters != null && parameters.ContainsKey("list")) |
| | | { |
| | |
| | | break; |
| | | case "pinTuan": |
| | | { |
| | | //拼团 |
| | | bool isDic = await _bfbfComAPIService.IsDictionary(_contextUser.ID); |
| | | if (isDic) |
| | | continue; |
| | | var parameters = (JObject)JsonConvert.DeserializeObject(item.parameters); |
| | | if (parameters != null && parameters.ContainsKey("list")) |
| | | { |