mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:43:26 +08:00
【修复】修复当新增或者删除会员等级后,【签到设置】连续签到规则数据错误,累计签到设置保存无效的问题。
This commit is contained in:
@@ -1,16 +1,19 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers.Shop
|
||||
@@ -63,10 +66,38 @@ namespace CoreCms.Net.Web.Admin.Controllers.Shop
|
||||
var userGrade = await _coreCmsUserGradeServices.QueryAsync();
|
||||
|
||||
//连续签到规则
|
||||
var continuousCheckInRules = await _coreCmsContinuousCheckInRulesServices.GetCaChe();
|
||||
var continuousCheckInRules = await _coreCmsContinuousCheckInRulesServices.GetDataWidthChild();
|
||||
//制作新数据,防止出现
|
||||
|
||||
|
||||
JArray newDetails = new JArray();
|
||||
|
||||
if (continuousCheckInRules.Any())
|
||||
{
|
||||
foreach (var item in continuousCheckInRules)
|
||||
{
|
||||
JArray di = new JArray();
|
||||
var newUserGrand = userGrade;
|
||||
foreach (var itemGrade in newUserGrand)
|
||||
{
|
||||
JObject diItem = new JObject();
|
||||
diItem.Add("grand", JObject.FromObject(itemGrade));
|
||||
var details = item.details.Find(p => p.userGradeId == itemGrade.id);
|
||||
if (details != null)
|
||||
{
|
||||
diItem.Add("details", JObject.FromObject(details));
|
||||
}
|
||||
di.Add(diItem);
|
||||
}
|
||||
newDetails.Add(di);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//累计签到规则
|
||||
var cumulativeCheckInRules = await _coreCmsCumulativeCheckInRulesServices.GetCaChe();
|
||||
var cumulativeCheckInRules = await _coreCmsCumulativeCheckInRulesServices.QueryAsync(true, true);
|
||||
|
||||
jm.data = new
|
||||
{
|
||||
@@ -74,6 +105,7 @@ namespace CoreCms.Net.Web.Admin.Controllers.Shop
|
||||
filesStorageOptionsType,
|
||||
userGrade,
|
||||
continuousCheckInRules,
|
||||
newDetails,
|
||||
cumulativeCheckInRules
|
||||
};
|
||||
|
||||
@@ -133,11 +165,12 @@ namespace CoreCms.Net.Web.Admin.Controllers.Shop
|
||||
}
|
||||
|
||||
//先清理掉数据,因为是配置数据,可直接删除添加新的
|
||||
var doEnpty = await _coreCmsCumulativeCheckInRulesServices.DeleteAsync(p => p.id > 0);
|
||||
var doEnpty = await _coreCmsCumulativeCheckInRulesServices.DeleteAsync(p => p.id > 0, true);
|
||||
|
||||
//插入新的数据
|
||||
var insertCount = await _coreCmsCumulativeCheckInRulesServices.InsertAsync(entity.entity, true);
|
||||
|
||||
|
||||
var insertCount = await _coreCmsCumulativeCheckInRulesServices.InsertAsync(entity.entity);
|
||||
jm.code = 0;
|
||||
jm.msg = "保存成功";
|
||||
return jm;
|
||||
|
||||
Reference in New Issue
Block a user