mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:53:25 +08:00
【调整】重写拼团前端列表,拼团详情,拼团首页组件,拼团海报等数据获取规则,减少不必要的数据查询,增加redis缓存,提升访问速度,调整拼团海报为新海报模式。
【优化】优化分享识别跳转页面【jump】代码。
This commit is contained in:
@@ -226,25 +226,19 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
if (entity.peopleNumber < 2 || entity.peopleNumber > 10)
|
||||
if (entity.peopleNumber is < 2 or > 10)
|
||||
{
|
||||
jm.msg = "拼团人数只允许2至10人";
|
||||
return jm;
|
||||
}
|
||||
|
||||
entity.createTime = DateTime.Now;
|
||||
var id = await _coreCmsPinTuanRuleServices.InsertAsync(entity);
|
||||
var id = await _coreCmsPinTuanRuleServices.InsertAsync(entity, true);
|
||||
var bl = id > 0;
|
||||
if (bl && entity.goods.Any())
|
||||
{
|
||||
var list = new List<CoreCmsPinTuanGoods>();
|
||||
foreach (var good in entity.goods)
|
||||
list.Add(new CoreCmsPinTuanGoods
|
||||
{
|
||||
goodsId = good,
|
||||
ruleId = id
|
||||
});
|
||||
await _coreCmsPinTuanGoodsServices.InsertAsync(list);
|
||||
var list = entity.goods.Select(good => new CoreCmsPinTuanGoods { goodsId = good, ruleId = id }).ToList();
|
||||
await _coreCmsPinTuanGoodsServices.InsertAsync(list, true);
|
||||
}
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
@@ -333,18 +327,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
oldModel.updateTime = DateTime.Now;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await _coreCmsPinTuanRuleServices.UpdateAsync(oldModel);
|
||||
var bl = await _coreCmsPinTuanRuleServices.UpdateAsync(oldModel, true);
|
||||
if (bl && entity.goods.Any())
|
||||
{
|
||||
await _coreCmsPinTuanGoodsServices.DeleteAsync(p => p.ruleId == oldModel.id);
|
||||
var list = new List<CoreCmsPinTuanGoods>();
|
||||
foreach (var good in entity.goods)
|
||||
list.Add(new CoreCmsPinTuanGoods
|
||||
{
|
||||
goodsId = good,
|
||||
ruleId = oldModel.id
|
||||
});
|
||||
await _coreCmsPinTuanGoodsServices.InsertAsync(list);
|
||||
await _coreCmsPinTuanGoodsServices.DeleteAsync(p => p.ruleId == oldModel.id, true);
|
||||
var list = entity.goods.Select(good => new CoreCmsPinTuanGoods { goodsId = good, ruleId = oldModel.id }).ToList();
|
||||
await _coreCmsPinTuanGoodsServices.InsertAsync(list, true);
|
||||
}
|
||||
|
||||
jm.code = bl ? 0 : 1;
|
||||
@@ -377,11 +365,10 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
return jm;
|
||||
}
|
||||
|
||||
var bl = await _coreCmsPinTuanRuleServices.DeleteByIdAsync(entity.id);
|
||||
var bl = await _coreCmsPinTuanRuleServices.DeleteByIdAsync(entity.id, true);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
return jm;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -409,7 +396,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
|
||||
|
||||
oldModel.isStatusOpen = entity.data;
|
||||
|
||||
var bl = await _coreCmsPinTuanRuleServices.UpdateAsync(oldModel);
|
||||
var bl = await _coreCmsPinTuanRuleServices.UpdateAsync(oldModel, true);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
cols: [
|
||||
[
|
||||
{ type: 'checkbox' },
|
||||
{ field: 'id', title: '拼团序列', width: 70, sort: false },
|
||||
{ field: 'goodsId', title: '商品序列', width: 70, sort: false },
|
||||
{
|
||||
field: 'name', title: '活动名称', sort: false, templet: function (data) {
|
||||
@@ -130,19 +131,19 @@
|
||||
console.log(obj);
|
||||
if (obj.checked) {
|
||||
if (obj.type == 'one') {
|
||||
ids[obj.data.goodsId] = obj.data;
|
||||
ids[obj.data.id] = obj.data;
|
||||
} else {
|
||||
for (var i = 0; i < table_data.length; i++) {
|
||||
ids[table_data[i].goodsId] = table_data[i];
|
||||
ids[table_data[i].id] = table_data[i];
|
||||
}
|
||||
}
|
||||
//the_val[obj.data.id] = obj.data;
|
||||
} else {
|
||||
if (obj.type == 'one') {
|
||||
delete ids[obj.data.goodsId];
|
||||
delete ids[obj.data.id];
|
||||
} else {
|
||||
for (var i = 0; i < table_data.length; i++) {
|
||||
delete ids[table_data[i].goodsId];
|
||||
delete ids[table_data[i].id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user