diff --git a/CoreCms.Net.Configuration/AppSettingsConstVars.cs b/CoreCms.Net.Configuration/AppSettingsConstVars.cs
index edd04797..5652c5ba 100644
--- a/CoreCms.Net.Configuration/AppSettingsConstVars.cs
+++ b/CoreCms.Net.Configuration/AppSettingsConstVars.cs
@@ -10,7 +10,7 @@ namespace CoreCms.Net.Configuration
///
/// 配置文件格式化
///
- public class AppSettingsConstVars
+ public static class AppSettingsConstVars
{
#region 全局地址================================================================================
@@ -24,6 +24,7 @@ namespace CoreCms.Net.Configuration
public static readonly string AppConfigAppInterFaceUrl = AppSettingsHelper.GetContent("AppConfig", "AppInterFaceUrl");
#endregion
+
#region 数据库================================================================================
///
/// 获取数据库连接字符串
@@ -35,6 +36,7 @@ namespace CoreCms.Net.Configuration
public static readonly string DbDbType = AppSettingsHelper.GetContent("ConnectionStrings", "DbType");
#endregion
+
#region redis================================================================================
///
@@ -53,6 +55,7 @@ namespace CoreCms.Net.Configuration
#endregion
+
#region AOP================================================================================
///
/// 事务切面开关
@@ -68,12 +71,14 @@ namespace CoreCms.Net.Configuration
public static readonly string JwtConfigAudience = AppSettingsHelper.GetContent("JwtConfig", "Audience");
#endregion
+
#region Cors跨域设置================================================================================
public static readonly string CorsPolicyName = AppSettingsHelper.GetContent("Cors", "PolicyName");
public static readonly bool CorsEnableAllIPs = AppSettingsHelper.GetContent("Cors", "EnableAllIPs").ObjToBool();
public static readonly string CorsIPs = AppSettingsHelper.GetContent("Cors", "IPs");
#endregion
+
#region Middleware中间件================================================================================
///
/// Ip限流
@@ -114,6 +119,7 @@ namespace CoreCms.Net.Configuration
public static readonly string PayCallBackAlipayRefundUrl = AppSettingsHelper.GetContent("PayCallBack", "AlipayRefundUrl");
#endregion
+
#region 易联云打印机================================================================================
///
diff --git a/CoreCms.Net.Configuration/GlobalConstVars.cs b/CoreCms.Net.Configuration/GlobalConstVars.cs
index 9bc57d9d..f44e4b46 100644
--- a/CoreCms.Net.Configuration/GlobalConstVars.cs
+++ b/CoreCms.Net.Configuration/GlobalConstVars.cs
@@ -284,6 +284,9 @@
public const string CacheWeChatTransactionComponentGood = "CacheWeChatTransactionComponentGood";
public const string CacheWeChatTransactionComponentDeliveryCompany = "CacheWeChatTransactionComponentDeliveryCompany";
public const string CacheCoreCmsOrderDistributionModel = "CacheCoreCmsOrderDistributionModel";
+ public const string CacheCoreCmsContinuousCheckInRuleDetails = "CacheCoreCmsContinuousCheckInRuleDetails";
+ public const string CacheCoreCmsContinuousCheckInRules = "CacheCoreCmsContinuousCheckInRules";
+ public const string CacheCoreCmsCumulativeCheckInRules = "CacheCoreCmsCumulativeCheckInRules";
}
diff --git a/CoreCms.Net.Configuration/GlobalEnumVars.cs b/CoreCms.Net.Configuration/GlobalEnumVars.cs
index 06c89942..63aa5a37 100644
--- a/CoreCms.Net.Configuration/GlobalEnumVars.cs
+++ b/CoreCms.Net.Configuration/GlobalEnumVars.cs
@@ -216,6 +216,11 @@ namespace CoreCms.Net.Configuration
///
[Description("代理商提成")]
Agent = 9,
+ ///
+ /// 日历签到
+ ///
+ [Description("日历签到")]
+ CheckIn = 10,
}
///
/// 用户积分变动来源类型
@@ -2880,5 +2885,28 @@ namespace CoreCms.Net.Configuration
}
#endregion
+ #region 日历签到
+
+ ///
+ /// 每天签到赠送-签到赠送类型
+ ///
+
+ public enum CheckInCommonType
+ {
+ 积分 = 1,
+ 余额 = 2
+ }
+ ///
+ /// 清除连续签到次数
+ ///
+ public enum ContinuousCheckInPeriodType
+ {
+ 不限 = 0,
+ 每周末 = 1,
+ 每月末 = 2
+ }
+
+ #endregion
+
}
}
diff --git a/CoreCms.Net.Configuration/SystemSettingConstVars.cs b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
index 36d408e3..fc03d673 100644
--- a/CoreCms.Net.Configuration/SystemSettingConstVars.cs
+++ b/CoreCms.Net.Configuration/SystemSettingConstVars.cs
@@ -779,5 +779,40 @@ namespace CoreCms.Net.Configuration
public static readonly string IntraCityServiceBy20KM = "intraCityServiceBy20KM";
+
+
+ ///
+ /// 是否开启签到
+ ///
+ public static readonly string CheckInIsOpen = "checkInIsOpen";
+
+ ///
+ /// 是否签到提醒
+ ///
+ public static readonly string CheckInIsAlert = "checkInIsAlert";
+
+ ///
+ /// 签到提醒时间
+ ///
+ public static readonly string CheckInAlertTime = "checkInAlertTime";
+
+ ///
+ /// 普通签到赠送
+ ///
+ public static readonly string CheckInCommonNum = "checkInCommonNum";
+
+ ///
+ /// 普通签到赠送类型
+ ///
+ public static readonly string CheckInCommonType = "checkInCommonType";
+
+
+ ///
+ /// 连续签到周期
+ ///
+ public static readonly string ContinuousCheckInPeriodType = "continuousCheckInPeriodType";
+
+
+
}
}
\ No newline at end of file
diff --git a/CoreCms.Net.Configuration/SystemSettingDictionary.cs b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
index 707d6d11..f8c77e6a 100644
--- a/CoreCms.Net.Configuration/SystemSettingDictionary.cs
+++ b/CoreCms.Net.Configuration/SystemSettingDictionary.cs
@@ -226,6 +226,13 @@ namespace CoreCms.Net.Configuration
di.Add(SystemSettingConstVars.IntraCityServiceBy15KM, new DictionaryKeyValues() { sKey = "15公里内", sValue = "0" });
di.Add(SystemSettingConstVars.IntraCityServiceBy20KM, new DictionaryKeyValues() { sKey = "20公里内", sValue = "0" });
+ //签到
+ di.Add(SystemSettingConstVars.CheckInIsOpen, new DictionaryKeyValues() { sKey = "是否开启签到", sValue = "1" });
+ di.Add(SystemSettingConstVars.CheckInIsAlert, new DictionaryKeyValues() { sKey = "是否签到提醒", sValue = "1" });
+ di.Add(SystemSettingConstVars.CheckInAlertTime, new DictionaryKeyValues() { sKey = "签到提醒时间", sValue = "08:00:00" });
+ di.Add(SystemSettingConstVars.CheckInCommonNum, new DictionaryKeyValues() { sKey = "签到赠送", sValue = "0" });
+ di.Add(SystemSettingConstVars.CheckInCommonType, new DictionaryKeyValues() { sKey = "签到赠送类型", sValue = GlobalEnumVars.CheckInCommonType.积分.ToString() });
+ di.Add(SystemSettingConstVars.ContinuousCheckInPeriodType, new DictionaryKeyValues() { sKey = "连续签到周期", sValue = GlobalEnumVars.ContinuousCheckInPeriodType.不限.ToString() });
return di;
}
diff --git a/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRuleDetailsRepository.cs b/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRuleDetailsRepository.cs
new file mode 100644
index 00000000..11756681
--- /dev/null
+++ b/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRuleDetailsRepository.cs
@@ -0,0 +1,30 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:52
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.IRepository
+{
+ ///
+ /// 连续签到规则明细 工厂接口
+ ///
+ public interface ICoreCmsContinuousCheckInRuleDetailsRepository : IBaseRepository
+ {
+
+ }
+}
diff --git a/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRulesRepository.cs b/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRulesRepository.cs
new file mode 100644
index 00000000..264d4919
--- /dev/null
+++ b/CoreCms.Net.IRepository/CheckIn/ICoreCmsContinuousCheckInRulesRepository.cs
@@ -0,0 +1,53 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.IRepository
+{
+ ///
+ /// 连续签到规则 工厂接口
+ ///
+ public interface ICoreCmsContinuousCheckInRulesRepository : IBaseRepository
+ {
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(List entity);
+
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ ///
+ /// 更新cache
+ ///
+ Task> UpdateCaChe();
+
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.IRepository/CheckIn/ICoreCmsCumulativeCheckInRulesRepository.cs b/CoreCms.Net.IRepository/CheckIn/ICoreCmsCumulativeCheckInRulesRepository.cs
new file mode 100644
index 00000000..2dd85a43
--- /dev/null
+++ b/CoreCms.Net.IRepository/CheckIn/ICoreCmsCumulativeCheckInRulesRepository.cs
@@ -0,0 +1,110 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:04:05
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.IRepository
+{
+ ///
+ /// 累计签到规则 工厂接口
+ ///
+ public interface ICoreCmsCumulativeCheckInRulesRepository : IBaseRepository
+ {
+ #region 重写增删改查操作===========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(CoreCmsCumulativeCheckInRules entity);
+
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(List entity);
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task UpdateAsync(CoreCmsCumulativeCheckInRules entity);
+
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task UpdateAsync(List entity);
+
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ new Task DeleteByIdAsync(object id);
+
+
+ ///
+ /// 重写删除指定ID集合的数据(批量删除)
+ ///
+ ///
+ ///
+ new Task DeleteByIdsAsync(int[] ids);
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ ///
+ /// 更新cache
+ ///
+ Task> UpdateCaChe();
+
+ #endregion
+
+
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ new Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+
+ }
+}
diff --git a/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInDetailsRepository.cs b/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInDetailsRepository.cs
new file mode 100644
index 00000000..4d4e5bdd
--- /dev/null
+++ b/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInDetailsRepository.cs
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/8 23:33:07
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.IRepository
+{
+ ///
+ /// 用户签到明细表 工厂接口
+ ///
+ public interface ICoreCmsUserCheckInDetailsRepository : IBaseRepository
+ {
+ }
+}
diff --git a/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInRepository.cs b/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInRepository.cs
new file mode 100644
index 00000000..851d621f
--- /dev/null
+++ b/CoreCms.Net.IRepository/CheckIn/ICoreCmsUserCheckInRepository.cs
@@ -0,0 +1,44 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/13 22:21:26
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.IRepository
+{
+ ///
+ /// 用户日历签到统计 工厂接口
+ ///
+ public interface ICoreCmsUserCheckInRepository : IBaseRepository
+ {
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ new Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+
+ }
+}
diff --git a/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRuleDetailsServices.cs b/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRuleDetailsServices.cs
new file mode 100644
index 00000000..a6fdb6b9
--- /dev/null
+++ b/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRuleDetailsServices.cs
@@ -0,0 +1,28 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:52
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.IServices
+{
+ ///
+ /// 连续签到规则明细 服务工厂接口
+ ///
+ public interface ICoreCmsContinuousCheckInRuleDetailsServices : IBaseServices
+ {
+ }
+}
diff --git a/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRulesServices.cs b/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRulesServices.cs
new file mode 100644
index 00000000..6c21375b
--- /dev/null
+++ b/CoreCms.Net.IServices/CheckIn/ICoreCmsContinuousCheckInRulesServices.cs
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.IServices
+{
+ ///
+ /// 连续签到规则 服务工厂接口
+ ///
+ public interface ICoreCmsContinuousCheckInRulesServices : IBaseServices
+ {
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(List entity);
+
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ ///
+ /// 更新cache
+ ///
+ Task> UpdateCaChe();
+
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.IServices/CheckIn/ICoreCmsCumulativeCheckInRulesServices.cs b/CoreCms.Net.IServices/CheckIn/ICoreCmsCumulativeCheckInRulesServices.cs
new file mode 100644
index 00000000..46239730
--- /dev/null
+++ b/CoreCms.Net.IServices/CheckIn/ICoreCmsCumulativeCheckInRulesServices.cs
@@ -0,0 +1,107 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:04:05
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.IServices
+{
+ ///
+ /// 累计签到规则 服务工厂接口
+ ///
+ public interface ICoreCmsCumulativeCheckInRulesServices : IBaseServices
+ {
+ #region 重写增删改查操作===========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(CoreCmsCumulativeCheckInRules entity);
+
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task InsertAsync(List entity);
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task UpdateAsync(CoreCmsCumulativeCheckInRules entity);
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ new Task UpdateAsync(List entity);
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ new Task DeleteByIdAsync(object id);
+
+ ///
+ /// 重写删除指定ID集合的数据(批量删除)
+ ///
+ ///
+ ///
+ new Task DeleteByIdsAsync(int[] ids);
+
+ #endregion
+
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ Task> GetCaChe();
+
+ ///
+ /// 更新cache
+ ///
+ Task> UpdateCaChe();
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ new Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+ #endregion
+ }
+}
diff --git a/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInDetailsServices.cs b/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInDetailsServices.cs
new file mode 100644
index 00000000..4bd66eb4
--- /dev/null
+++ b/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInDetailsServices.cs
@@ -0,0 +1,36 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/8 23:33:07
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.IServices
+{
+ ///
+ /// 用户签到明细表 服务工厂接口
+ ///
+ public interface ICoreCmsUserCheckInDetailsServices : IBaseServices
+ {
+
+ ///
+ /// 用户签到
+ ///
+ ///
+ ///
+ Task DoCheckIn(CoreCmsUserCheckInDetails entity);
+
+ }
+}
diff --git a/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInServices.cs b/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInServices.cs
new file mode 100644
index 00000000..b6ed084f
--- /dev/null
+++ b/CoreCms.Net.IServices/CheckIn/ICoreCmsUserCheckInServices.cs
@@ -0,0 +1,51 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/13 22:21:26
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.IServices
+{
+ ///
+ /// 用户日历签到统计 服务工厂接口
+ ///
+ public interface ICoreCmsUserCheckInServices : IBaseServices
+ {
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ new Task> QueryPageAsync(
+ Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false);
+ #endregion
+
+ ///
+ /// 定时清理用户连续签到信息
+ ///
+ ///
+ Task ClearUserContinuousCheckIn();
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRuleDetails.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRuleDetails.cs
new file mode 100644
index 00000000..4561d7fe
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRuleDetails.cs
@@ -0,0 +1,92 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:52
+ * Description: 暂无
+ ***********************************************************************/
+
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 连续签到规则明细
+ ///
+ public partial class CoreCmsContinuousCheckInRuleDetails
+ {
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsContinuousCheckInRuleDetails()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 id { get; set; }
+
+
+ ///
+ /// 用户级别
+ ///
+ [Display(Name = "用户级别")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 userGradeId { get; set; }
+
+
+ ///
+ /// 连续签到规则序列
+ ///
+ [Display(Name = "连续签到规则序列")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 ruleId { get; set; }
+
+
+ ///
+ /// 数量
+ ///
+ [Display(Name = "数量")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 num { get; set; }
+
+
+ ///
+ /// 积分1余额2
+ ///
+ [Display(Name = "积分1余额2")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 type { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRules.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRules.cs
new file mode 100644
index 00000000..5413cd38
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRules.cs
@@ -0,0 +1,56 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 连续签到规则
+ ///
+ public partial class CoreCmsContinuousCheckInRules
+ {
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsContinuousCheckInRules()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 id { get; set; }
+
+
+ ///
+ /// 天数
+ ///
+ [Display(Name = "天数")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 days { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRulesPartial.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRulesPartial.cs
new file mode 100644
index 00000000..79832ace
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsContinuousCheckInRulesPartial.cs
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using System.Collections.Generic;
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 连续签到规则
+ ///
+ public partial class CoreCmsContinuousCheckInRules
+ {
+
+ ///
+ /// 明细
+ ///
+ [Display(Name = "明细")]
+ [SugarColumn(IsIgnore = true)]
+ public List details { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsCumulativeCheckInRules.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsCumulativeCheckInRules.cs
new file mode 100644
index 00000000..26cb5aac
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsCumulativeCheckInRules.cs
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:04:05
+ * Description: 暂无
+ ***********************************************************************/
+
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 累计签到规则
+ ///
+ public partial class CoreCmsCumulativeCheckInRules
+ {
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsCumulativeCheckInRules()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 id { get; set; }
+
+
+ ///
+ /// 累计天数
+ ///
+ [Display(Name = "累计天数")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 days { get; set; }
+
+
+ ///
+ /// 数量
+ ///
+ [Display(Name = "数量")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 num { get; set; }
+
+
+ ///
+ /// 积分1余额2
+ ///
+ [Display(Name = "积分1余额2")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 type { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckIn.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckIn.cs
new file mode 100644
index 00000000..36c85e85
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckIn.cs
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/13 22:21:26
+ * Description: 暂无
+ ***********************************************************************/
+
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 用户日历签到统计
+ ///
+ public partial class CoreCmsUserCheckIn
+ {
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsUserCheckIn()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 id { get; set; }
+
+
+ ///
+ /// 用户序列
+ ///
+ [Display(Name = "用户序列")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 userId { get; set; }
+
+
+ ///
+ /// 连续签到次数
+ ///
+ [Display(Name = "连续签到次数")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 continuousCheckInCount { get; set; }
+
+
+ ///
+ /// 累计签到次数
+ ///
+ [Display(Name = "累计签到次数")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 cumulativeCheckInCount { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckInDetails.cs b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckInDetails.cs
new file mode 100644
index 00000000..b68511f8
--- /dev/null
+++ b/CoreCms.Net.Model/Entities/CheckIn/CoreCmsUserCheckInDetails.cs
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/9 0:59:03
+ * Description: 暂无
+ ***********************************************************************/
+
+using SqlSugar;
+using System.ComponentModel;
+using System.ComponentModel.DataAnnotations;
+
+namespace CoreCms.Net.Model.Entities
+{
+ ///
+ /// 用户签到明细表
+ ///
+ public partial class CoreCmsUserCheckInDetails
+ {
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsUserCheckInDetails()
+ {
+ }
+
+ ///
+ /// 序列
+ ///
+ [Display(Name = "序列")]
+
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 id { get; set; }
+
+
+ ///
+ /// 用户序列
+ ///
+ [Display(Name = "用户序列")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.Int32 userId { get; set; }
+
+
+ ///
+ /// 打卡日期
+ ///
+ [Display(Name = "打卡日期")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.DateTime checkInData { get; set; }
+
+
+ ///
+ /// 打卡时间
+ ///
+ [Display(Name = "打卡时间")]
+
+ [Required(ErrorMessage = "请输入{0}")]
+
+
+
+ public System.DateTime createTime { get; set; }
+
+
+ }
+}
diff --git a/CoreCms.Net.Model/FromBody/FMCheckIn.cs b/CoreCms.Net.Model/FromBody/FMCheckIn.cs
new file mode 100644
index 00000000..5b6d519a
--- /dev/null
+++ b/CoreCms.Net.Model/FromBody/FMCheckIn.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using CoreCms.Net.Model.Entities;
+
+namespace CoreCms.Net.Model.FromBody
+{
+ ///
+ /// 保存累计签到规则
+ ///
+ public class FMDoSaveCumulativeCheckInRules
+ {
+ public List entity { set; get; }
+
+ }
+
+ ///
+ /// 保存连续签到规则
+ ///
+ public class FMDoSaveContinuousCheckInRules
+ {
+ public List entity { set; get; }
+
+ }
+
+ ///
+ /// 前端用户签到提交
+ ///
+ public class FMDoUserCheckIn
+ {
+
+ public DateTime date { set; get; }
+
+ }
+
+
+ ///
+ /// 前端获取用户签到数据
+ ///
+ public class FMGetUserCheckInByMonth
+ {
+ public int year { set; get; }
+ public int month { set; get; }
+ }
+
+}
diff --git a/CoreCms.Net.Repository/BaseRepository.cs b/CoreCms.Net.Repository/BaseRepository.cs
index 1b6bedc2..6d877abc 100644
--- a/CoreCms.Net.Repository/BaseRepository.cs
+++ b/CoreCms.Net.Repository/BaseRepository.cs
@@ -1023,7 +1023,7 @@ namespace CoreCms.Net.Repository
var totalCount = 0;
var page = blUseNoLock
? DbBaseClient.Queryable().OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
- .WhereIF(predicate != null, predicate).Where(SqlWith.NoLock)
+ .WhereIF(predicate != null, predicate).With(SqlWith.NoLock)
.ToPageList(pageIndex, pageSize, ref totalCount)
: DbClient.Queryable().OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
.WhereIF(predicate != null, predicate).ToPageList(pageIndex, pageSize, ref totalCount);
@@ -1047,7 +1047,7 @@ namespace CoreCms.Net.Repository
RefAsync totalCount = 0;
var page = blUseNoLock
? await DbBaseClient.Queryable().OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
- .WhereIF(predicate != null, predicate).Where(SqlWith.NoLock)
+ .WhereIF(predicate != null, predicate).With(SqlWith.NoLock)
.ToPageListAsync(pageIndex, pageSize, totalCount)
: await DbBaseClient.Queryable().OrderByIF(!string.IsNullOrEmpty(orderBy), orderBy)
.WhereIF(predicate != null, predicate).ToPageListAsync(pageIndex, pageSize, totalCount);
@@ -1072,7 +1072,7 @@ namespace CoreCms.Net.Repository
var totalCount = 0;
var page = blUseNoLock
? DbBaseClient.Queryable().OrderByIF(orderByExpression != null, orderByExpression, orderByType)
- .WhereIF(predicate != null, predicate).Where(SqlWith.NoLock)
+ .WhereIF(predicate != null, predicate).With(SqlWith.NoLock)
.ToPageList(pageIndex, pageSize, ref totalCount)
: DbBaseClient.Queryable().OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).ToPageList(pageIndex, pageSize, ref totalCount);
@@ -1097,7 +1097,7 @@ namespace CoreCms.Net.Repository
RefAsync totalCount = 0;
var page = blUseNoLock
? await DbBaseClient.Queryable().WhereIF(predicate != null, predicate).OrderByIF(orderByExpression != null, orderByExpression, orderByType)
- .Where(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount)
+ .With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount)
: await DbBaseClient.Queryable().WhereIF(predicate != null, predicate).OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.ToPageListAsync(pageIndex, pageSize, totalCount);
var list = new PageList(page, pageIndex, pageSize, totalCount);
diff --git a/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRuleDetailsRepository.cs b/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRuleDetailsRepository.cs
new file mode 100644
index 00000000..3a5c9d34
--- /dev/null
+++ b/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRuleDetailsRepository.cs
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:52
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 连续签到规则明细 接口实现
+ ///
+ public class CoreCmsContinuousCheckInRuleDetailsRepository : BaseRepository, ICoreCmsContinuousCheckInRuleDetailsRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsContinuousCheckInRuleDetailsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ }
+}
diff --git a/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRulesRepository.cs b/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRulesRepository.cs
new file mode 100644
index 00000000..5a1f24b5
--- /dev/null
+++ b/CoreCms.Net.Repository/CheckIn/CoreCmsContinuousCheckInRulesRepository.cs
@@ -0,0 +1,189 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 连续签到规则 接口实现
+ ///
+ public class CoreCmsContinuousCheckInRulesRepository : BaseRepository, ICoreCmsContinuousCheckInRulesRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsContinuousCheckInRulesRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public new async Task InsertAsync(List entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ //判断是否存在0天数或者0赠送
+ var isHaveEnptyDaysOrNum = entity.Count(p => p.days <= 0);
+ if (isHaveEnptyDaysOrNum > 0)
+ {
+ jm.msg = "【连续签到天数】不能为零";
+ return jm;
+ }
+
+ //判断是否存在相同的天数设置。
+ var isHave = entity.GroupBy(i => i.days).Any(g => g.Count() > 1);
+ if (isHave)
+ {
+ jm.msg = "存在相同的【连续签到天数】。请排查";
+ return jm;
+ }
+
+ try
+ {
+ _unitOfWork.BeginTran();
+
+ //先清理掉数据,因为是配置数据,可直接删除添加新的
+ await DbClient.Deleteable().Where(p => p.id > 0).ExecuteCommandAsync();
+ await DbClient.Deleteable().Where(p => p.id > 0).ExecuteCommandAsync();
+
+ //遍历数据存值
+ foreach (var item in entity)
+ {
+ var continuous = new CoreCmsContinuousCheckInRules
+ {
+ days = item.days
+ };
+
+ var id = await DbClient.Insertable(continuous).ExecuteReturnIdentityAsync();
+ if (id <= 0) continue;
+ foreach (var detail in item.details)
+ {
+ detail.ruleId = id;
+ }
+ await DbClient.Insertable(item.details).ExecuteReturnIdentityAsync();
+ }
+
+ _unitOfWork.CommitTran();
+
+ jm.code = 0;
+ jm.msg = "更新成功";
+
+ await UpdateCaChe();
+ }
+ catch (Exception e)
+ {
+ _unitOfWork.RollbackTran();
+ jm.code = 1;
+ jm.msg = "更新失败";
+ jm.data = e;
+ }
+ return jm;
+ }
+
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ var cache = ManualDataCache.Instance.Get>(GlobalConstVars.CacheCoreCmsContinuousCheckInRules);
+ if (cache != null)
+ {
+ return cache;
+ }
+ return await UpdateCaChe();
+ }
+
+ ///
+ /// 更新cache
+ ///
+ public async Task> UpdateCaChe()
+ {
+ var list = await DbClient.Queryable()
+ .Select(p => new CoreCmsContinuousCheckInRules
+ {
+ id = p.id,
+ days = p.days,
+ })
+ .Mapper(p => p.details, p => p.details.First().ruleId)
+ .With(SqlWith.NoLock).ToListAsync();
+ ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsContinuousCheckInRules, list);
+ return list;
+ }
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public new async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ RefAsync totalCount = 0;
+ List page;
+ if (blUseNoLock)
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsContinuousCheckInRules
+ {
+ id = p.id,
+ days = p.days,
+
+ }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ else
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsContinuousCheckInRules
+ {
+ id = p.id,
+ days = p.days,
+
+ }).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ var list = new PageList(page, pageIndex, pageSize, totalCount);
+ return list;
+ }
+
+ #endregion
+
+
+ }
+}
diff --git a/CoreCms.Net.Repository/CheckIn/CoreCmsCumulativeCheckInRulesRepository.cs b/CoreCms.Net.Repository/CheckIn/CoreCmsCumulativeCheckInRulesRepository.cs
new file mode 100644
index 00000000..38e0e5b2
--- /dev/null
+++ b/CoreCms.Net.Repository/CheckIn/CoreCmsCumulativeCheckInRulesRepository.cs
@@ -0,0 +1,250 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:04:05
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 累计签到规则 接口实现
+ ///
+ public class CoreCmsCumulativeCheckInRulesRepository : BaseRepository, ICoreCmsCumulativeCheckInRulesRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsCumulativeCheckInRulesRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 实现重写增删改查操作==========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public new async Task InsertAsync(CoreCmsCumulativeCheckInRules entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
+ if (bl)
+ {
+ await UpdateCaChe();
+ }
+
+ return jm;
+ }
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ public new async Task InsertAsync(List entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Insertable(entity).ExecuteCommandAsync();
+ jm.code = 0;
+ jm.msg = GlobalConstVars.EditSuccess;
+ await UpdateCaChe();
+ return jm;
+ }
+
+
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ public new async Task UpdateAsync(CoreCmsCumulativeCheckInRules entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var oldModel = await DbClient.Queryable().In(entity.id).SingleAsync();
+ if (oldModel == null)
+ {
+ jm.msg = "不存在此信息";
+ return jm;
+ }
+ //事物处理过程开始
+ oldModel.id = entity.id;
+ oldModel.days = entity.days;
+ oldModel.num = entity.num;
+ oldModel.type = entity.type;
+
+ //事物处理过程结束
+ var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
+ if (bl)
+ {
+ await UpdateCaChe();
+ }
+
+ return jm;
+ }
+
+ ///
+ /// 重写异步更新方法
+ ///
+ ///
+ ///
+ public new async Task UpdateAsync(List entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
+ if (bl)
+ {
+ await UpdateCaChe();
+ }
+
+ return jm;
+ }
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ public new async Task DeleteByIdAsync(object id)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Deleteable(id).ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
+ if (bl)
+ {
+ await UpdateCaChe();
+ }
+
+ return jm;
+ }
+
+ ///
+ /// 重写删除指定ID集合的数据(批量删除)
+ ///
+ ///
+ ///
+ public new async Task DeleteByIdsAsync(int[] ids)
+ {
+ var jm = new AdminUiCallBack();
+
+ var bl = await DbClient.Deleteable().In(ids).ExecuteCommandHasChangeAsync();
+ jm.code = bl ? 0 : 1;
+ jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
+ if (bl)
+ {
+ await UpdateCaChe();
+ }
+
+ return jm;
+ }
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ var cache = ManualDataCache.Instance.Get>(GlobalConstVars.CacheCoreCmsCumulativeCheckInRules);
+ if (cache != null)
+ {
+ return cache;
+ }
+ return await UpdateCaChe();
+ }
+
+ ///
+ /// 更新cache
+ ///
+ public async Task> UpdateCaChe()
+ {
+ var list = await DbClient.Queryable().With(SqlWith.NoLock).ToListAsync();
+ ManualDataCache.Instance.Set(GlobalConstVars.CacheCoreCmsCumulativeCheckInRules, list);
+ return list;
+ }
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public new async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ RefAsync totalCount = 0;
+ List page;
+ if (blUseNoLock)
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsCumulativeCheckInRules
+ {
+ id = p.id,
+ days = p.days,
+ num = p.num,
+ type = p.type,
+
+ }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ else
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsCumulativeCheckInRules
+ {
+ id = p.id,
+ days = p.days,
+ num = p.num,
+ type = p.type,
+
+ }).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ var list = new PageList(page, pageIndex, pageSize, totalCount);
+ return list;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInDetailsRepository.cs b/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInDetailsRepository.cs
new file mode 100644
index 00000000..8dca1376
--- /dev/null
+++ b/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInDetailsRepository.cs
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/8 23:33:07
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 用户签到明细表 接口实现
+ ///
+ public class CoreCmsUserCheckInDetailsRepository : BaseRepository, ICoreCmsUserCheckInDetailsRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsUserCheckInDetailsRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ }
+}
diff --git a/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInRepository.cs b/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInRepository.cs
new file mode 100644
index 00000000..fbf88ddf
--- /dev/null
+++ b/CoreCms.Net.Repository/CheckIn/CoreCmsUserCheckInRepository.cs
@@ -0,0 +1,87 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/13 22:21:26
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Caching.Manual;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+namespace CoreCms.Net.Repository
+{
+ ///
+ /// 用户日历签到统计 接口实现
+ ///
+ public class CoreCmsUserCheckInRepository : BaseRepository, ICoreCmsUserCheckInRepository
+ {
+ private readonly IUnitOfWork _unitOfWork;
+ public CoreCmsUserCheckInRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
+ {
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public new async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ RefAsync totalCount = 0;
+ List page;
+ if (blUseNoLock)
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserCheckIn
+ {
+ id = p.id,
+ userId = p.userId,
+ continuousCheckInCount = p.continuousCheckInCount,
+ cumulativeCheckInCount = p.cumulativeCheckInCount,
+
+ }).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ else
+ {
+ page = await DbClient.Queryable()
+ .OrderByIF(orderByExpression != null, orderByExpression, orderByType)
+ .WhereIF(predicate != null, predicate).Select(p => new CoreCmsUserCheckIn
+ {
+ id = p.id,
+ userId = p.userId,
+ continuousCheckInCount = p.continuousCheckInCount,
+ cumulativeCheckInCount = p.cumulativeCheckInCount,
+
+ }).ToPageListAsync(pageIndex, pageSize, totalCount);
+ }
+ var list = new PageList(page, pageIndex, pageSize, totalCount);
+ return list;
+ }
+
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRuleDetailsServices.cs b/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRuleDetailsServices.cs
new file mode 100644
index 00000000..7ae548d0
--- /dev/null
+++ b/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRuleDetailsServices.cs
@@ -0,0 +1,43 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:52
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 连续签到规则明细 接口实现
+ ///
+ public class CoreCmsContinuousCheckInRuleDetailsServices : BaseServices, ICoreCmsContinuousCheckInRuleDetailsServices
+ {
+ private readonly ICoreCmsContinuousCheckInRuleDetailsRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public CoreCmsContinuousCheckInRuleDetailsServices(IUnitOfWork unitOfWork, ICoreCmsContinuousCheckInRuleDetailsRepository dal)
+ {
+ this._dal = dal;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+ }
+}
diff --git a/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRulesServices.cs b/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRulesServices.cs
new file mode 100644
index 00000000..0ad9072b
--- /dev/null
+++ b/CoreCms.Net.Services/CheckIn/CoreCmsContinuousCheckInRulesServices.cs
@@ -0,0 +1,74 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:03:58
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 连续签到规则 接口实现
+ ///
+ public class CoreCmsContinuousCheckInRulesServices : BaseServices, ICoreCmsContinuousCheckInRulesServices
+ {
+ private readonly ICoreCmsContinuousCheckInRulesRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public CoreCmsContinuousCheckInRulesServices(IUnitOfWork unitOfWork, ICoreCmsContinuousCheckInRulesRepository dal)
+ {
+ this._dal = dal;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public new async Task InsertAsync(List entity)
+ {
+ return await _dal.InsertAsync(entity);
+ }
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ return await _dal.GetCaChe();
+ }
+
+ ///
+ /// 更新cache
+ ///
+ public async Task> UpdateCaChe()
+ {
+ return await _dal.UpdateCaChe();
+ }
+
+ #endregion
+ }
+}
diff --git a/CoreCms.Net.Services/CheckIn/CoreCmsCumulativeCheckInRulesServices.cs b/CoreCms.Net.Services/CheckIn/CoreCmsCumulativeCheckInRulesServices.cs
new file mode 100644
index 00000000..adadb9f8
--- /dev/null
+++ b/CoreCms.Net.Services/CheckIn/CoreCmsCumulativeCheckInRulesServices.cs
@@ -0,0 +1,147 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/3 1:04:05
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 累计签到规则 接口实现
+ ///
+ public class CoreCmsCumulativeCheckInRulesServices : BaseServices, ICoreCmsCumulativeCheckInRulesServices
+ {
+ private readonly ICoreCmsCumulativeCheckInRulesRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+
+ public CoreCmsCumulativeCheckInRulesServices(IUnitOfWork unitOfWork, ICoreCmsCumulativeCheckInRulesRepository dal)
+ {
+ this._dal = dal;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 实现重写增删改查操作==========================================================
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public new async Task InsertAsync(CoreCmsCumulativeCheckInRules entity)
+ {
+ return await _dal.InsertAsync(entity);
+ }
+
+ ///
+ /// 重写异步插入方法
+ ///
+ /// 实体数据
+ ///
+ public new async Task InsertAsync(List entity)
+ {
+ return await _dal.InsertAsync(entity);
+ }
+
+ ///
+ /// 重写异步更新方法方法
+ ///
+ ///
+ ///
+ public new async Task UpdateAsync(CoreCmsCumulativeCheckInRules entity)
+ {
+ return await _dal.UpdateAsync(entity);
+ }
+
+ ///
+ /// 重写异步更新方法方法
+ ///
+ ///
+ ///
+ public new async Task UpdateAsync(List entity)
+ {
+ return await _dal.UpdateAsync(entity);
+ }
+
+ ///
+ /// 重写删除指定ID的数据
+ ///
+ ///
+ ///
+ public new async Task DeleteByIdAsync(object id)
+ {
+ return await _dal.DeleteByIdAsync(id);
+ }
+
+ ///
+ /// 重写删除指定ID集合的数据(批量删除)
+ ///
+ ///
+ ///
+ public new async Task DeleteByIdsAsync(int[] ids)
+ {
+ return await _dal.DeleteByIdsAsync(ids);
+ }
+
+ #endregion
+
+ #region 获取缓存的所有数据==========================================================
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task> GetCaChe()
+ {
+ return await _dal.GetCaChe();
+ }
+
+ ///
+ /// 更新cache
+ ///
+ public async Task> UpdateCaChe()
+ {
+ return await _dal.UpdateCaChe();
+ }
+
+ #endregion
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public new async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
+ }
+ #endregion
+
+ }
+}
diff --git a/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInDetailsServices.cs b/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInDetailsServices.cs
new file mode 100644
index 00000000..9f5d2d94
--- /dev/null
+++ b/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInDetailsServices.cs
@@ -0,0 +1,206 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/8 23:33:07
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using CoreCms.Net.Utility.Extensions;
+using CoreCms.Net.Utility.Helper;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 用户签到明细表 接口实现
+ ///
+ public class CoreCmsUserCheckInDetailsServices : BaseServices, ICoreCmsUserCheckInDetailsServices
+ {
+ private readonly ICoreCmsUserCheckInDetailsRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+
+ private readonly ICoreCmsSettingServices _settingServices;
+ private readonly ICoreCmsUserPointLogServices _userPointLogServices;
+ private readonly ICoreCmsUserBalanceServices _userBalanceServices;
+ private readonly ICoreCmsCumulativeCheckInRulesServices _cumulativeCheckInRulesServices;
+ private readonly ICoreCmsContinuousCheckInRulesServices _continuousCheckInRulesServices;
+ private readonly ICoreCmsUserServices _userServices;
+ private readonly ICoreCmsUserCheckInServices _userCheckInServices;
+
+
+ public CoreCmsUserCheckInDetailsServices(IUnitOfWork unitOfWork, ICoreCmsUserCheckInDetailsRepository dal, ICoreCmsSettingServices settingServices, ICoreCmsUserPointLogServices userPointLogServices, ICoreCmsUserBalanceServices userBalanceServices, ICoreCmsCumulativeCheckInRulesServices cumulativeCheckInRulesServices, ICoreCmsContinuousCheckInRulesServices continuousCheckInRulesServices, ICoreCmsUserServices userServices, ICoreCmsUserCheckInServices userCheckInServices)
+ {
+ this._dal = dal;
+ _settingServices = settingServices;
+ _userPointLogServices = userPointLogServices;
+ _userBalanceServices = userBalanceServices;
+ _cumulativeCheckInRulesServices = cumulativeCheckInRulesServices;
+ _continuousCheckInRulesServices = continuousCheckInRulesServices;
+ _userServices = userServices;
+ _userCheckInServices = userCheckInServices;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+
+ ///
+ /// 获取缓存的所有数据
+ ///
+ ///
+ public async Task DoCheckIn(CoreCmsUserCheckInDetails entity)
+ {
+ var jm = new AdminUiCallBack();
+ try
+ {
+
+ var id = await _dal.InsertAsync(entity);
+
+ var userCheckIn = await _userCheckInServices.QueryByClauseAsync(p => p.userId == entity.userId);
+ if (userCheckIn != null)
+ {
+ userCheckIn.continuousCheckInCount += 1;
+ userCheckIn.cumulativeCheckInCount += 1;
+
+ await _userCheckInServices.UpdateAsync(userCheckIn);
+ }
+ else
+ {
+ userCheckIn = new CoreCmsUserCheckIn();
+ userCheckIn.userId = entity.userId;
+ userCheckIn.continuousCheckInCount = 1;
+ userCheckIn.cumulativeCheckInCount = 1;
+ await _userCheckInServices.InsertAsync(userCheckIn);
+ }
+
+ //初始化获得的积分
+ var point = 0;
+ //初始化获得的余额
+ var money = 0;
+
+
+ var allConfigs = await _settingServices.GetConfigDictionaries();
+ var showStoresSwitch = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CheckInIsOpen).ObjectToInt(2); //是否开启签到
+ if (showStoresSwitch == 1)
+ {
+
+ //普通签到赠送处理
+ //签到赠送的数量
+ var checkInCommonNum = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CheckInCommonNum).ObjectToInt(0);
+ if (checkInCommonNum > 0)
+ {
+ //签到赠送的类别
+ var checkInCommonType = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CheckInCommonType).ObjectToInt(0);
+ switch (checkInCommonType)
+ {
+ case (int)GlobalEnumVars.CheckInCommonType.积分:
+ point += checkInCommonNum;
+ //储值积分
+ await _userPointLogServices.SetPoint(entity.userId, checkInCommonNum, (int)GlobalEnumVars.UserPointSourceTypes.PointTypeSign, "日历签到,获得" + checkInCommonNum + "积分");
+ break;
+ case (int)GlobalEnumVars.CheckInCommonType.余额:
+ money += checkInCommonNum;
+ //储值余额
+ await _userBalanceServices.Change(entity.userId, (int)GlobalEnumVars.UserBalanceSourceTypes.CheckIn, checkInCommonNum, id.ToString());
+ break;
+ }
+ }
+
+ //判断累计签到次数是否满足
+ var cumulativeCheckInRules = await _cumulativeCheckInRulesServices.GetCaChe();
+ //获取用户总签到次数(使用userCheckIn的签到次数统计也可以,但是查询实时数据最可靠。根据个人来)
+ //var cumulativeCheckInCount = await _dal.GetCountAsync(p => p.userId == entity.userId);
+ var cumulativeCheckInCount = userCheckIn.cumulativeCheckInCount;
+ //遍历规则
+ async void Action(CoreCmsCumulativeCheckInRules p)
+ {
+ if (cumulativeCheckInCount == p.days)
+ {
+ switch (p.type)
+ {
+ case (int)GlobalEnumVars.CheckInCommonType.积分:
+ point += p.num;
+ //储值积分
+ await _userPointLogServices.SetPoint(entity.userId, p.num, (int)GlobalEnumVars.UserPointSourceTypes.PointTypeSign, "日历签到,获得" + p.num + "积分");
+ break;
+ case (int)GlobalEnumVars.CheckInCommonType.余额:
+ money += p.num;
+ //储值余额
+ await _userBalanceServices.Change(entity.userId, (int)GlobalEnumVars.UserBalanceSourceTypes.CheckIn, p.num, id.ToString());
+ break;
+ }
+ }
+ //原则上应该还要加个日志。确定是否这个时间已经领取过了。
+ }
+ cumulativeCheckInRules.ForEach(Action);
+
+
+ //判断连续签到次数是否满足
+ var continuousCheckInRules = await _continuousCheckInRulesServices.GetCaChe();
+ //获取用户数据
+ var user = await _userServices.QueryByIdAsync(entity.userId);
+ //获取用户当前已经连续签到的次数
+ var userContinuousCheckInNum = userCheckIn.continuousCheckInCount;
+
+ //遍历处理结果
+ async void Action1(CoreCmsContinuousCheckInRules p)
+ {
+ if (p.days == userContinuousCheckInNum)
+ {
+ var rule = p.details.Find(o => o.userGradeId == user.grade);
+ if (rule != null)
+ {
+ switch (rule.type)
+ {
+ case (int)GlobalEnumVars.CheckInCommonType.积分:
+ point += rule.num;
+ //储值积分
+ await _userPointLogServices.SetPoint(entity.userId, rule.num, (int)GlobalEnumVars.UserPointSourceTypes.PointTypeSign, "日历签到,获得" + rule.num + "积分");
+ break;
+ case (int)GlobalEnumVars.CheckInCommonType.余额:
+ money += rule.num;
+ //储值余额
+ await _userBalanceServices.Change(entity.userId, (int)GlobalEnumVars.UserBalanceSourceTypes.CheckIn, rule.num, id.ToString());
+ break;
+ }
+ }
+ }
+ }
+ continuousCheckInRules.ForEach(Action1);
+
+ jm.code = 0;
+ jm.msg = "签到成功共获得" + point + "积分" + money + "余额";
+ jm.data = userCheckIn;
+ jm.otherData = cumulativeCheckInRules;
+ }
+ else
+ {
+ jm.code = 1;
+ jm.msg = "日历签到暂未开启";
+ }
+ }
+ catch (Exception e)
+ {
+ jm.code = 1;
+ jm.msg = "更新失败";
+ jm.data = e;
+ }
+ return jm;
+ }
+
+ }
+}
diff --git a/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInServices.cs b/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInServices.cs
new file mode 100644
index 00000000..dcf06063
--- /dev/null
+++ b/CoreCms.Net.Services/CheckIn/CoreCmsUserCheckInServices.cs
@@ -0,0 +1,145 @@
+/***********************************************************************
+ * Project: CoreCms
+ * ProjectName: 核心内容管理系统
+ * Web: https://www.corecms.net
+ * Author: 大灰灰
+ * Email: jianweie@163.com
+ * CreateTime: 2022/3/13 22:21:26
+ * Description: 暂无
+ ***********************************************************************/
+
+using System;
+using System.Collections.Generic;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IRepository.UnitOfWork;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.ViewModels.Basics;
+using CoreCms.Net.Model.ViewModels.UI;
+using CoreCms.Net.Utility.Extensions;
+using CoreCms.Net.Utility.Helper;
+using Newtonsoft.Json;
+using SqlSugar;
+
+
+namespace CoreCms.Net.Services
+{
+ ///
+ /// 用户日历签到统计 接口实现
+ ///
+ public class CoreCmsUserCheckInServices : BaseServices, ICoreCmsUserCheckInServices
+ {
+ private readonly ICoreCmsUserCheckInRepository _dal;
+ private readonly IUnitOfWork _unitOfWork;
+ private readonly ICoreCmsSettingServices _settingServices;
+ private readonly ISysTaskLogServices _sysTaskLogServices;
+
+
+ public CoreCmsUserCheckInServices(IUnitOfWork unitOfWork, ICoreCmsUserCheckInRepository dal, ICoreCmsSettingServices settingServices, ISysTaskLogServices sysTaskLogServices)
+ {
+ this._dal = dal;
+ _settingServices = settingServices;
+ _sysTaskLogServices = sysTaskLogServices;
+ base.BaseDal = dal;
+ _unitOfWork = unitOfWork;
+ }
+
+ #region 重写根据条件查询分页数据
+ ///
+ /// 重写根据条件查询分页数据
+ ///
+ /// 判断集合
+ /// 排序方式
+ /// 当前页面索引
+ /// 分布大小
+ ///
+ /// 是否使用WITH(NOLOCK)
+ ///
+ public new async Task> QueryPageAsync(Expression> predicate,
+ Expression> orderByExpression, OrderByType orderByType, int pageIndex = 1,
+ int pageSize = 20, bool blUseNoLock = false)
+ {
+ return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
+ }
+ #endregion
+
+
+ ///
+ /// 清理用户连续签到
+ ///
+ ///
+ public async Task ClearUserContinuousCheckIn()
+ {
+ var jm = new AdminUiCallBack();
+
+ var allConfigs = await _settingServices.GetConfigDictionaries();
+
+ var showStoresSwitch = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.CheckInIsOpen).ObjectToInt(2); //是否开启签到
+ if (showStoresSwitch == 1)
+ {
+ var continuousCheckInPeriodType = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ContinuousCheckInPeriodType).ObjectToInt(0); //连续签到周期
+
+ DateTime dt = DateTime.Now; //当前时间
+ if (continuousCheckInPeriodType == (int)GlobalEnumVars.ContinuousCheckInPeriodType.不限)
+ {
+ //插入日志
+ var model = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = true,
+ name = "不限制模式不执行",
+ parameters = JsonConvert.SerializeObject(jm)
+ };
+ await _sysTaskLogServices.InsertAsync(model);
+ }
+ else if (continuousCheckInPeriodType == (int)GlobalEnumVars.ContinuousCheckInPeriodType.每周末)
+ {
+ if (dt.DayOfWeek == DayOfWeek.Sunday)
+ {
+ await _dal.UpdateAsync(p => new CoreCmsUserCheckIn() { continuousCheckInCount = 0 }, p => p.id > 0);
+ }
+ else
+ {
+ //插入日志
+ var model = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = true,
+ name = "非周末不执行",
+ parameters = JsonConvert.SerializeObject(jm)
+ };
+ await _sysTaskLogServices.InsertAsync(model);
+ }
+ }
+ else if (continuousCheckInPeriodType == (int)GlobalEnumVars.ContinuousCheckInPeriodType.每月末)
+ {
+ DateTime startMonth = dt.AddDays(1 - dt.Day); //本月月初
+ DateTime endMonth = startMonth.AddMonths(1).AddDays(-1); //本月月末
+ //同年同业同日生。
+ if (dt.Year == endMonth.Year && dt.Month == endMonth.Month && dt.Day == endMonth.Day)
+ {
+ await _dal.UpdateAsync(p => new CoreCmsUserCheckIn() { continuousCheckInCount = 0 }, p => p.id > 0);
+ }
+ else
+ {
+ //插入日志
+ var model = new SysTaskLog
+ {
+ createTime = DateTime.Now,
+ isSuccess = true,
+ name = "非周末不执行",
+ parameters = JsonConvert.SerializeObject(jm)
+ };
+ await _sysTaskLogServices.InsertAsync(model);
+ }
+ }
+ }
+ return jm;
+ }
+
+
+ }
+}
diff --git a/CoreCms.Net.Task/ClearUserContinuousCheckInJob.cs b/CoreCms.Net.Task/ClearUserContinuousCheckInJob.cs
new file mode 100644
index 00000000..f6192f65
--- /dev/null
+++ b/CoreCms.Net.Task/ClearUserContinuousCheckInJob.cs
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Project: CoreCms.Net *
+ * Web: https://CoreCms.Net *
+ * ProjectName: 核心内容管理系统 *
+ * Author: 大灰灰 *
+ * Email: JianWeie@163.com *
+ * CreateTime: 2020-08-25 1:25:29
+ * Description: 暂无
+ ***********************************************************************/
+
+
+using System;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Loging;
+using CoreCms.Net.Model.Entities;
+using Newtonsoft.Json;
+using NLog;
+
+namespace CoreCms.Net.Task
+{
+ ///
+ /// 定时清理用户连续签到信息
+ ///
+ public class ClearUserContinuousCheckInJob
+ {
+ private readonly ICoreCmsUserCheckInServices _checkInServices;
+
+ public ClearUserContinuousCheckInJob(ICoreCmsUserCheckInServices checkInServices)
+ {
+ _checkInServices = checkInServices;
+ }
+
+ public async System.Threading.Tasks.Task Execute()
+ {
+ await _checkInServices.ClearUserContinuousCheckIn();
+ }
+ }
+}
\ No newline at end of file
diff --git a/CoreCms.Net.Task/HangfireDispose.cs b/CoreCms.Net.Task/HangfireDispose.cs
index 042d6bb9..ca23f78f 100644
--- a/CoreCms.Net.Task/HangfireDispose.cs
+++ b/CoreCms.Net.Task/HangfireDispose.cs
@@ -65,6 +65,9 @@ namespace CoreCms.Net.Task
//定时刷新获取微信AccessToken
RecurringJob.AddOrUpdate(s => s.Execute(), "0 0/4 * * * ? ", TimeZoneInfo.Local); // 每2分钟刷新获取微信AccessToken
+ //定时清理用户连续签到信息
+ RecurringJob.AddOrUpdate(s => s.Execute(), "0 0 0 */1 * ? ", TimeZoneInfo.Local); // 每天0点执行。
+
}
#endregion
diff --git a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
index 7cd27f88..8df0d24a 100644
--- a/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
+++ b/CoreCms.Net.Uni-App/CoreShop/common/request/http.api.js
@@ -134,10 +134,20 @@ const install = (Vue, vm) => {
let pay = (params, config = {}) => http.post('/Api/User/Pay', params, { custom: { methodName: 'user.pay', needToken: true } });
// 订单评价接口
let orderEvaluate = (params, config = {}) => http.post('/Api/User/OrderEvaluate', params, { custom: { methodName: 'user.orderevaluate', needToken: true } });
- // 判断是否签到
- let isSign = (params, config = {}) => http.post('/Api/User/IsSign', params, { custom: { methodName: 'user.issign', needToken: true } });
+
+ // 判断是否签到(作废)
+ //let isSign = (params, config = {}) => http.post('/Api/User/IsSign', params, { custom: { methodName: 'user.issign', needToken: true } });
+ // 签到接口(作废)
+ //let sign = (params, config = {}) => http.post('/Api/User/Sign', params, { custom: { methodName: 'user.sign', needToken: true } });
+
// 签到接口
- let sign = (params, config = {}) => http.post('/Api/User/Sign', params, { custom: { methodName: 'user.sign', needToken: true } });
+ let userCheckIn = (params, config = {}) => http.post('/Api/CheckIn/DoUserCheckIn', params, { custom: { methodName: 'user.doUserCheckIn', needToken: true } });
+ //获取用户按月签到数据
+ let getUserCheckByMonth = (params, config = {}) => http.post('/Api/CheckIn/GetUserCheckByMonth', params, { custom: { methodName: 'user.getUserCheckByMonth', needToken: true } });
+ //获取用户总签到次数
+ let getUserCheckCount = (params, config = {}) => http.post('/Api/CheckIn/GetUserCheckCount', params, { custom: { methodName: 'user.getUserCheckCount', needToken: true } });
+
+
// 积分记录
let pointLog = (params, config = {}) => http.post('/Api/User/UserPointLog', params, { custom: { methodName: 'user.userpointlog', needToken: true } });
// 物流信息接口
@@ -456,8 +466,12 @@ const install = (Vue, vm) => {
paymentInfo,
pay,
orderEvaluate,
- isSign,
- sign,
+ //isSign,
+ //sign,
+ userCheckIn,
+ getUserCheckByMonth,
+ getUserCheckCount,
+
pointLog,
logistics,
couponList,
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages.json b/CoreCms.Net.Uni-App/CoreShop/pages.json
index 5b71b038..d73ecd1c 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages.json
+++ b/CoreCms.Net.Uni-App/CoreShop/pages.json
@@ -215,6 +215,7 @@
"navigationBarTitleText": "打赏"
}
},
+
{
"path": "pages/template",
"style": {
@@ -290,6 +291,13 @@
"navigationBarTextStyle": "black",
"navigationBarTitleText": "接龙详情"
}
+ },
+ {
+ "path": "checkIn/checkIn/checkIn",
+ "style": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "日历签到"
+ }
}
]
},
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.scss b/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.scss
new file mode 100644
index 00000000..c44255f0
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.scss
@@ -0,0 +1,32 @@
+.bar { display: flex; flex-direction: row; justify-content: space-between; align-items: center; margin: 30rpx 20rpx; padding: 10rpx;
+ .barbtn { height: 30px; line-height: 30px; font-size: 12px; }
+}
+.week { display: flex; flex-direction: row; justify-content: space-between; padding: 20rpx; padding-left: 40rpx; padding-right: 40rpx; margin: 20rpx; border-radius: 10px; background-color: #fff; }
+.myDateTable { margin: 2.5vw; padding: 2vw; border-radius: 10px; background: linear-gradient(#74AADA, #94db98);
+ .dateCell { width: 11vw; margin: 1vw; display: inline-block; text-align: center; font-size: 16px;
+ .cell { display: flex; border-radius: 50%; height: 11vw; justify-content: center; align-items: center; }
+ }
+}
+
+
+.greenColor { color: #01b90b; font-weight: bold; }
+.bgWhite { background-color: #fff; }
+.bgGray { background-color: rgba(255, 255, 255, 0.42); }
+.bgBlue { font-size: 14px; background-color: #4b95e6; }
+.redColor { color: #ff0000; }
+
+.TipArea { word-break: break-all; word-wrap: break-word; font-size: 14px; padding: 10px; }
+.impTip { display: inline-block; color: #ff0000; }
+
+
+
+.count { margin: 20rpx; padding: 30rpx; display: flex; text-align: center; border-radius: 10px; flex-direction: column; justify-content: center; align-items: center;
+ .daynumber { display: flex; flex-direction: row; justify-content: center;
+ .day { margin-top: 50rpx; }
+ .number { color: #fff; font-size: 60rpx; background-color: #94db98; width: 100rpx; height: 100rpx; border-radius: 50%; display: flex; flex-direction: column; justify-content: center; margin: 20rpx; }
+ }
+ .monthSum { color: red; font-size: 40rpx; }
+}
+
+
+.count text { margin: 10rpx; }
\ No newline at end of file
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.vue b/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.vue
new file mode 100644
index 00000000..eab600b7
--- /dev/null
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/activity/checkIn/checkIn/checkIn.vue
@@ -0,0 +1,307 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{cur_year || "--"}} 年 {{cur_month || "--"}} 月
+
+
+
+
+
+
+
+
+ {{item}}
+
+
+ {{item}}
+
+
+
+
+
+
+
+
+
+ {{item.date}}
+
+
+
+
+ {{item.date}}
+
+
+
+ 签到
+
+
+
+ {{item.date}}
+
+
+
+
+
+
+
+
+ 截至目前,已坚持打卡
+
+ {{sumCount}}
+ 天
+
+
+ 本月累积打卡{{dataSource.length}}天
+ 请再接再厉,继续努力!
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
index 71a07677..45737461 100644
--- a/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
+++ b/CoreCms.Net.Uni-App/CoreShop/pages/index/member/member.vue
@@ -356,6 +356,12 @@
router: '/pages/activity/solitaire/list/list',
showItem: true
},
+ calendar: {
+ name: '日历签到',
+ icon: 'calendar',
+ router: '/pages/activity/checkIn/checkIn/checkIn',
+ showItem: true
+ },
},
other: {
invite: {
diff --git a/CoreCms.Net.Utility/Helper/UserHelper.cs b/CoreCms.Net.Utility/Helper/UserHelper.cs
index 5221eca2..aae5eb27 100644
--- a/CoreCms.Net.Utility/Helper/UserHelper.cs
+++ b/CoreCms.Net.Utility/Helper/UserHelper.cs
@@ -62,6 +62,9 @@ namespace CoreCms.Net.Utility.Helper
case (int)GlobalEnumVars.UserBalanceSourceTypes.Service:
str += "购买服务消费了" + money + "元";
break;
+ case (int)GlobalEnumVars.UserBalanceSourceTypes.CheckIn:
+ str += "日历签到奖励" + money + "元";
+ break;
}
//::todo 这里还可以做一些其他的校验
return str;
diff --git a/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsCheckInController.cs b/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsCheckInController.cs
new file mode 100644
index 00000000..ca349a38
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/Controllers/Shop/CoreCmsCheckInController.cs
@@ -0,0 +1,166 @@
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+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.UI;
+using CoreCms.Net.Utility.Helper;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using SqlSugar;
+
+namespace CoreCms.Net.Web.Admin.Controllers.Shop
+{
+ ///
+ /// 日历签到设置
+ ///
+ [Description("日历签到设置")]
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ [RequiredErrorForAdmin]
+ [Authorize(Permissions.Name)]
+ public class CoreCmsCheckInController : ControllerBase
+ {
+
+ private readonly ICoreCmsSettingServices _coreCmsSettingServices;
+ private readonly ICoreCmsUserGradeServices _coreCmsUserGradeServices;
+ private readonly ICoreCmsContinuousCheckInRuleDetailsServices _coreCmsContinuousCheckInRuleDetailsServices;
+ private readonly ICoreCmsContinuousCheckInRulesServices _coreCmsContinuousCheckInRulesServices;
+ private readonly ICoreCmsCumulativeCheckInRulesServices _coreCmsCumulativeCheckInRulesServices;
+
+
+ ///
+ /// 构造函数
+ ///
+ public CoreCmsCheckInController(ICoreCmsSettingServices coreCmsSettingServices, ICoreCmsUserGradeServices coreCmsUserGradeServices, ICoreCmsContinuousCheckInRuleDetailsServices coreCmsContinuousCheckInRuleDetailsServices, ICoreCmsContinuousCheckInRulesServices coreCmsContinuousCheckInRulesServices, ICoreCmsCumulativeCheckInRulesServices coreCmsCumulativeCheckInRulesServices)
+ {
+ _coreCmsSettingServices = coreCmsSettingServices;
+ _coreCmsUserGradeServices = coreCmsUserGradeServices;
+ _coreCmsContinuousCheckInRuleDetailsServices = coreCmsContinuousCheckInRuleDetailsServices;
+ _coreCmsContinuousCheckInRulesServices = coreCmsContinuousCheckInRulesServices;
+ _coreCmsCumulativeCheckInRulesServices = coreCmsCumulativeCheckInRulesServices;
+ }
+
+
+ #region 首页数据============================================================
+ // POST: Api/CoreCmsSetting/GetIndex
+ ///
+ /// 首页数据
+ ///
+ ///
+ [HttpPost]
+ [Description("首页数据")]
+ public async Task GetIndex()
+ {
+ //返回数据
+ var jm = new AdminUiCallBack { code = 0 };
+ var configs = await _coreCmsSettingServices.GetConfigDictionaries();
+ var filesStorageOptionsType = EnumHelper.EnumToList();
+ var userGrade = await _coreCmsUserGradeServices.QueryAsync();
+
+ //连续签到规则
+ var continuousCheckInRules = await _coreCmsContinuousCheckInRulesServices.GetCaChe();
+
+ //累计签到规则
+ var cumulativeCheckInRules = await _coreCmsCumulativeCheckInRulesServices.GetCaChe();
+
+ jm.data = new
+ {
+ configs,
+ filesStorageOptionsType,
+ userGrade,
+ continuousCheckInRules,
+ cumulativeCheckInRules
+ };
+
+ return jm;
+ }
+ #endregion
+
+ #region 保存提交============================================================
+ // POST: Api/CoreCmsSetting/DoSave
+ ///
+ /// 保存提交
+ ///
+ ///
+ ///
+ [HttpPost]
+ [Description("保存提交")]
+ public async Task DoSave([FromBody] FMCoreCmsSettingDoSaveModel model)
+ {
+ var jm = await _coreCmsSettingServices.UpdateAsync(model);
+ return jm;
+ }
+ #endregion
+
+
+ #region 保存累计签到规则============================================================
+ // POST: Api/CoreCmsSetting/DoSave
+ ///
+ /// 保存累计签到规则
+ ///
+ ///
+ [HttpPost]
+ [Description("保存累计签到规则")]
+ public async Task DoSaveCumulativeCheckInRules([FromBody] FMDoSaveCumulativeCheckInRules entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ if (!entity.entity.Any())
+ {
+ jm.msg = "请提交数据";
+ return jm;
+ }
+
+ //判断是否存在0天数或者0赠送
+ var isHaveEnptyDaysOrNum = entity.entity.Count(p => p.days <= 0 || p.num <= 0);
+ if (isHaveEnptyDaysOrNum > 0)
+ {
+ jm.msg = "累计签到天数或赠送数量不能为零";
+ return jm;
+ }
+
+ //判断是否存在相同的天数设置。
+ var isHave = entity.entity.GroupBy(i => i.days).Any(g => g.Count() > 1);
+ if (isHave)
+ {
+ jm.msg = "存在相同的累计签到天数。请排查";
+ return jm;
+ }
+
+ //先清理掉数据,因为是配置数据,可直接删除添加新的
+ var doEnpty = await _coreCmsCumulativeCheckInRulesServices.DeleteAsync(p => p.id > 0);
+
+ //插入新的数据
+
+ var insertCount = await _coreCmsCumulativeCheckInRulesServices.InsertAsync(entity.entity);
+ jm.code = 0;
+ jm.msg = "保存成功";
+ return jm;
+ }
+ #endregion
+
+ #region 保存连续签到规则============================================================
+ // POST: Api/CoreCmsSetting/DoSave
+ ///
+ /// 保存连续签到规则
+ ///
+ ///
+ [HttpPost]
+ [Description("保存连续签到规则")]
+ public async Task DoSaveContinuousCheckInRules([FromBody] FMDoSaveContinuousCheckInRules entity)
+ {
+ var jm = new AdminUiCallBack();
+
+ if (entity.entity.Any()) return await _coreCmsContinuousCheckInRulesServices.InsertAsync(entity.entity);
+ jm.msg = "请提交数据";
+ return jm;
+
+ }
+ #endregion
+ }
+}
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/shop/checkin/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/shop/checkin/index.html
new file mode 100644
index 00000000..56f41eea
--- /dev/null
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/shop/checkin/index.html
@@ -0,0 +1,517 @@
+标题
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/CoreCms.Net.Web.WebApi/Controllers/CheckInController.cs b/CoreCms.Net.Web.WebApi/Controllers/CheckInController.cs
new file mode 100644
index 00000000..a65fd650
--- /dev/null
+++ b/CoreCms.Net.Web.WebApi/Controllers/CheckInController.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using CoreCms.Net.Auth.HttpContextUser;
+using CoreCms.Net.IRepository;
+using CoreCms.Net.IServices;
+using CoreCms.Net.Model.Entities;
+using CoreCms.Net.Model.FromBody;
+using CoreCms.Net.Model.ViewModels.UI;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Nito.AsyncEx;
+
+namespace CoreCms.Net.Web.WebApi.Controllers
+{
+ ///
+ /// 签到控制器
+ ///
+ [Route("api/[controller]/[action]")]
+ [ApiController]
+ public class CheckInController : ControllerBase
+ {
+ private readonly ICoreCmsUserCheckInDetailsServices _userCheckInDetailsServices;
+ private readonly IHttpContextUser _user;
+
+ //简单的异步锁
+ private readonly AsyncLock _mutex = new AsyncLock();
+
+ ///
+ /// 构造函数
+ ///
+ public CheckInController(IHttpContextUser user, ICoreCmsUserCheckInDetailsServices userCheckInDetailsServices)
+ {
+ _user = user;
+ _userCheckInDetailsServices = userCheckInDetailsServices;
+ }
+
+
+ ///
+ /// 用户签到
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task DoUserCheckIn([FromBody] FMDoUserCheckIn entity)
+ {
+ using (await _mutex.LockAsync())
+ {
+ var jm = new WebApiCallBack();
+ var isHave = await _userCheckInDetailsServices.ExistsAsync(p => p.userId == _user.ID && p.checkInData == entity.date);
+ if (isHave)
+ {
+ jm.msg = "今日您已签到";
+ return jm;
+ }
+ var detail = new CoreCmsUserCheckInDetails
+ {
+ userId = _user.ID,
+ checkInData = entity.date,
+ createTime = DateTime.Now
+ };
+ var callBack = await _userCheckInDetailsServices.DoCheckIn(detail);
+ jm.status = callBack.code == 0;
+ jm.msg = callBack.msg;
+ jm.data = callBack.data;
+ return jm;
+ }
+ }
+
+ ///
+ /// 获取用户总签到次数
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task GetUserCheckCount()
+ {
+ var jm = new WebApiCallBack
+ {
+ status = true,
+ data = await _userCheckInDetailsServices.GetCountAsync(p => p.userId == _user.ID),
+ msg = "获取成功"
+ };
+ return jm;
+ }
+
+ ///
+ /// 获取用户按月签到数据
+ ///
+ ///
+ [HttpPost]
+ [Authorize]
+ public async Task GetUserCheckByMonth([FromBody] FMGetUserCheckInByMonth entity)
+ {
+ var jm = new WebApiCallBack();
+
+ var dt = new DateTime(entity.year, entity.month, 1);
+
+ var min = dt.AddDays(-1);
+ var max = dt.AddMonths(1);
+
+ var list = await _userCheckInDetailsServices.QueryListByClauseAsync(p => p.userId == _user.ID && p.checkInData > min && p.checkInData < max);
+
+ var stringArr = new List();
+ foreach (var item in list)
+ {
+ var stringStr = item.checkInData.ToString("yyyy-MM-dd");
+ stringArr.Add(stringStr);
+ }
+
+ jm.status = true;
+ jm.data = stringArr;
+ jm.msg = "获取成功";
+
+ return jm;
+ }
+ }
+}
diff --git a/数据库/SqlServer/20220314/20220314脚本1-创建表.sql b/数据库/SqlServer/20220314/20220314脚本1-创建表.sql
new file mode 100644
index 00000000..cbfb3c3d
Binary files /dev/null and b/数据库/SqlServer/20220314/20220314脚本1-创建表.sql differ
diff --git a/数据库/SqlServer/20220314/20220314脚本2-增加后台菜单.sql b/数据库/SqlServer/20220314/20220314脚本2-增加后台菜单.sql
new file mode 100644
index 00000000..20b5b64f
Binary files /dev/null and b/数据库/SqlServer/20220314/20220314脚本2-增加后台菜单.sql differ
diff --git a/数据库/SqlServer/20220314/CoreShopProfessional20220314完整数据库.rar b/数据库/SqlServer/20220314/CoreShopProfessional20220314完整数据库.rar
new file mode 100644
index 00000000..7bb1a13c
Binary files /dev/null and b/数据库/SqlServer/20220314/CoreShopProfessional20220314完整数据库.rar differ
diff --git a/数据库/SqlServer/数据库更新日志.txt b/数据库/SqlServer/数据库更新日志.txt
index eff9ce83..0c3d6344 100644
--- a/数据库/SqlServer/数据库更新日志.txt
+++ b/数据库/SqlServer/数据库更新日志.txt
@@ -1,3 +1,6 @@
+2022-03-14
+【新增】表【CoreCmsContinuousCheckInRuleDetails】【CoreCmsContinuousCheckInRules】【CoreCmsCumulativeCheckInRules】【CoreCmsUserCheckIn】【CoreCmsUserCheckInDetails】实现日历签到功能。
+
2022-02-25
【新增】表【CoreCmsProducts】增加【赠送积分points】字段