mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:03:27 +08:00
【新增】新增微信扫码支付功能,对接PC端。
【新增】增加DTO类库,将逐步完善dto层。 【修复】修复【分类】切换后,切换回来未清零原始数据,导致更新数据重复的问题。 【调整】移除模板库功能,防止出现审核因为模板库页面存在而导致的审核失败。暂将模板库的代码存放到会员QQ群内,方便下载使用。 【调整】代码生成器【Repository.tpl】移除Cache手动增删改,【SqlSugarSetup】增加sqlsugar自动检测增删改后清理二级缓存。 【调整】后端新增秒杀独立组件,用于区分团购及秒杀的差异,首页新增秒杀组件。 【优化】重写首页所有组件样式及接口数据获取效率。 【优化】优化拼团,秒杀,团购,接龙数据获取逻辑,提升列表及详情页面数据获取效率。 【优化】调整拼团,秒杀,团购,服务商品推广海报为新式海报效果。增加服务商品推广海报。 【优化】清理h5相关代码判断,移除h5支付组件,提高响应速度。 【优化】移除小程序前端冗余代码。加快代码执行效率。
This commit is contained in:
@@ -63,9 +63,7 @@ namespace CoreCms.Net.Services
|
||||
using var container = _serviceProvider.CreateScope();
|
||||
|
||||
var goodsServices = container.ServiceProvider.GetService<ICoreCmsGoodsServices>();
|
||||
var pinTuanRuleServices = container.ServiceProvider.GetService<ICoreCmsPinTuanRuleServices>();
|
||||
var pinTuanRecordServices = container.ServiceProvider.GetService<ICoreCmsPinTuanRecordServices>();
|
||||
var pinTuanGoodsServices = container.ServiceProvider.GetService<ICoreCmsPinTuanGoodsServices>();
|
||||
var orderServices = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
|
||||
|
||||
var goodsInfo = await goodsServices.GetGoodsDetail(goodsId, userId, false, "goods", 0, needGoodSku);
|
||||
@@ -83,14 +81,14 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
goodsInfo.pinTuanRule.pinTuanStartStatus = (int)GlobalEnumVars.PinTuanRuleStatus.notBegun;
|
||||
|
||||
TimeSpan ts = goodsInfo.pinTuanRule.startTime.Subtract(dt);
|
||||
var ts = goodsInfo.pinTuanRule.startTime.Subtract(dt);
|
||||
goodsInfo.pinTuanRule.lastTime = (int)ts.TotalSeconds;
|
||||
}
|
||||
else if (goodsInfo.pinTuanRule.startTime <= dt && goodsInfo.pinTuanRule.endTime > dt)
|
||||
{
|
||||
goodsInfo.pinTuanRule.pinTuanStartStatus = (int)GlobalEnumVars.PinTuanRuleStatus.begin;
|
||||
|
||||
TimeSpan ts = goodsInfo.pinTuanRule.endTime.Subtract(dt);
|
||||
var ts = goodsInfo.pinTuanRule.endTime.Subtract(dt);
|
||||
goodsInfo.pinTuanRule.lastTime = (int)ts.TotalSeconds;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.DTO;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.IServices;
|
||||
@@ -23,6 +24,7 @@ using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using Essensoft.Paylink.Alipay.Domain;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SqlSugar;
|
||||
@@ -65,15 +67,18 @@ namespace CoreCms.Net.Services
|
||||
/// 接口上获取拼团所有商品
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<WebApiCallBack> GetPinTuanList(int userId = 0)
|
||||
public async Task<WebApiCallBack> GetPinTuanList(int userId = 0, int pageIndex = 1, int pageSize = 20)
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
using var container = _serviceProvider.CreateScope();
|
||||
var pinTuanGoodsServices = container.ServiceProvider.GetService<ICoreCmsPinTuanGoodsServices>();
|
||||
var pinTuanRuleServices = container.ServiceProvider.GetService<ICoreCmsPinTuanRuleServices>();
|
||||
var goodsServices = container.ServiceProvider.GetService<ICoreCmsGoodsServices>();
|
||||
|
||||
var pinTuanRules = await pinTuanRuleServices.QueryListByClauseAsync(p => p.isStatusOpen == true, p => p.sort, OrderByType.Asc, true, true, 24 * 60);
|
||||
//从缓存中获取有效的数据
|
||||
var dt = DateTime.Now;
|
||||
var pinTuanRules = await pinTuanRuleServices.QueryListByClauseAsync(p => p.isStatusOpen == true && p.startTime < dt && p.endTime > dt, p => p.sort, OrderByType.Asc, true, true, 24 * 60);
|
||||
if (pinTuanRules == null && !pinTuanRules.Any())
|
||||
{
|
||||
jm.status = true;
|
||||
@@ -81,30 +86,35 @@ namespace CoreCms.Net.Services
|
||||
return jm;
|
||||
}
|
||||
//获取开启的规则集序列
|
||||
var pinTuanRuleIds = pinTuanRules.Select(p => p.id).ToList();
|
||||
//获取下级商品数据
|
||||
var pinTuanGoods = await pinTuanGoodsServices.QueryListByClauseAsync(p => pinTuanRuleIds.Contains(p.ruleId), p => p.ruleId, OrderByType.Asc, true, true);
|
||||
//从缓存中获取有效的数据
|
||||
var dt = DateTime.Now;
|
||||
var list = pinTuanRules.Where(p => p.startTime < dt && p.endTime > dt).OrderBy(p => p.sort).ToList();
|
||||
var pinTuanRuleIds = pinTuanRules.Select(p => p.id).ToArray();
|
||||
|
||||
if (list.Any())
|
||||
|
||||
var dtoData = await _dal.GetPinTuanInfos(pinTuanRuleIds, p => p.sortId, OrderByType.Asc, pageIndex, pageSize);
|
||||
foreach (var item in dtoData)
|
||||
{
|
||||
var goods = new List<CoreCmsGoods>();
|
||||
foreach (var item in list)
|
||||
//判断拼团状态
|
||||
var dtNow = DateTime.Now;
|
||||
if (item.startTime > dt)
|
||||
{
|
||||
var pinTuanGood = pinTuanGoods.Find(p => p.ruleId == item.id);
|
||||
if (pinTuanGood != null)
|
||||
{
|
||||
var g = await pinTuanGoodsServices.GetGoodsInfo(item, pinTuanGood.goodsId, userId, false,
|
||||
false, false);
|
||||
if (g == null) continue;
|
||||
goods.Add(g);
|
||||
}
|
||||
item.startStatus = (int)GlobalEnumVars.PinTuanRuleStatus.notBegun;
|
||||
var ts = item.startTime.Subtract(dt);
|
||||
item.timestamp = (int)ts.TotalSeconds;
|
||||
}
|
||||
jm.data = goods;
|
||||
else if (item.startTime <= dt && item.endTime > dt)
|
||||
{
|
||||
item.startStatus = (int)GlobalEnumVars.PinTuanRuleStatus.begin;
|
||||
var ts = item.endTime.Subtract(dt);
|
||||
item.timestamp = (int)ts.TotalSeconds;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.startStatus = (int)GlobalEnumVars.PinTuanRuleStatus.haveExpired;
|
||||
}
|
||||
|
||||
item.pinTuanPrice -= item.discountAmount;
|
||||
}
|
||||
|
||||
jm.data = dtoData;
|
||||
jm.status = true;
|
||||
return jm;
|
||||
}
|
||||
@@ -136,5 +146,25 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
return await _dal.GetPinTuanInfo(ruleId);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据规则ID数组获取拼团相关信息
|
||||
/// </summary>
|
||||
/// <param name="ruleIds">规则序列</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="orderByType"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<IPageList<PinTuanListDTO>> GetPinTuanInfos(int[] ruleIds,
|
||||
Expression<Func<PinTuanListDTO, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20)
|
||||
{
|
||||
|
||||
return await _dal.GetPinTuanInfos(ruleIds, orderByExpression, orderByType, pageIndex, pageSize);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user