diff --git a/CoreCms.Net.Model/Entities/User/CoreCmsUserPartial.cs b/CoreCms.Net.Model/Entities/User/CoreCmsUserPartial.cs index 7cfac7b7..c31d3169 100644 --- a/CoreCms.Net.Model/Entities/User/CoreCmsUserPartial.cs +++ b/CoreCms.Net.Model/Entities/User/CoreCmsUserPartial.cs @@ -34,5 +34,14 @@ namespace CoreCms.Net.Model.Entities /// [SugarColumn(IsIgnore = true)] public string parentNickName { get; set; } + + + /// + /// 累计积分 + /// + [SugarColumn(IsIgnore = true)] + public int accumulativePoint { get; set; } + + } } \ No newline at end of file diff --git a/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs b/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs index 0fc8bb9f..03eba3cd 100644 --- a/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs +++ b/CoreCms.Net.Repository/User/CoreCmsUserRepository.cs @@ -20,7 +20,6 @@ using CoreCms.Net.Model.Entities.Expression; using CoreCms.Net.Model.FromBody; using CoreCms.Net.Model.ViewModels.Basics; using CoreCms.Net.Model.ViewModels.UI; -using CoreCms.Net.Model.ViewModels.DTO; using CoreCms.Net.Utility.Extensions; using CoreCms.Net.Utility.Helper; using SqlSugar; @@ -52,6 +51,7 @@ namespace CoreCms.Net.Repository //本月第一天时间 DateTime dtFirst = dt.AddDays(1 - (dt.Day)); dtFirst = new DateTime(dtFirst.Year, dtFirst.Month, dtFirst.Day, 0, 0, 0); + //获得某年某月的天数 int year = dt.Date.Year; int month = dt.Date.Month; @@ -133,7 +133,8 @@ namespace CoreCms.Net.Repository isDelete = p.isDelete, type = (int)sWeChatInfo.type, parentNickName = sParentUser.nickName, - childNum = SqlFunc.Subqueryable().Where(o => o.parentId == p.id).Count() + childNum = SqlFunc.Subqueryable().Where(o => o.parentId == p.id).Count(), + accumulativePoint = SqlFunc.Subqueryable().Where(o => o.userId == p.id && o.num > 0).Sum(c => c.num), }) .MergeTable().With(SqlWith.Null) .OrderBy(orderByExpression, orderByType) @@ -179,7 +180,7 @@ namespace CoreCms.Net.Repository { var dt = DateTime.Now; var where = PredicateBuilder.True(); - var currDay = DateTime.Now.ToString("yyyy-MM-dd"); + string currDay; if (i == 0) { where = where.And(p => p.createTime < DateTime.Now); diff --git a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs index 04e4dc52..2f8497bc 100644 --- a/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs +++ b/CoreCms.Net.Web.Admin/Controllers/User/CoreCmsUserController.cs @@ -1256,15 +1256,15 @@ namespace CoreCms.Net.Web.Admin.Controllers #endregion - #region 获取列表============================================================ + #region 获取积分列表============================================================ // POST: Api/CoreCmsUser/GetUserPointLogPageList /// - /// 获取列表 + /// 获取积分列表 /// /// [HttpPost] - [Description("获取列表")] + [Description("获取积分列表")] public async Task GetUserPointLogPageList() { var jm = new AdminUiCallBack(); @@ -1349,6 +1349,14 @@ namespace CoreCms.Net.Web.Admin.Controllers } } + //积分余额 int + var searchType = Request.Form["searchType"].FirstOrDefault(); + if (!string.IsNullOrEmpty(searchType) && searchType == "accumulativePoint") + { + where = where.And(p => p.num > 0); + } + + //获取数据 var list = await _coreCmsUserPointLogServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize); diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/detailsPointLog.html b/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/detailsPointLog.html index 2bbfaf3d..169a4991 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/detailsPointLog.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/detailsPointLog.html @@ -86,7 +86,7 @@ method: 'POST', defaultToolbar: ['filter', 'print', 'exports'], //height: 'full-127',//无面包屑127,搜索框189,1行62 - where: { userId: d.params.id }, + where: { userId: d.params.id, searchType: d.params.searchType }, page: true, limit: 30, limits: [10, 15, 20, 25, 30, 50, 100, 200], diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/index.html index bcf06c1d..960bbe23 100644 --- a/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/index.html +++ b/CoreCms.Net.Web.Admin/wwwroot/views/user/userInfo/index.html @@ -219,11 +219,17 @@ } }, { - field: 'point', title: '积分', sort: false, width: 70, templet: function (data) { + field: 'point', title: '可用积分', sort: false, width: 70, templet: function (data) { var html = '' + data.point + ''; return html; } }, + { + field: 'accumulativePoint', title: '累计积分', sort: false, width: 70, templet: function (data) { + var html = '' + data.accumulativePoint + ''; + return html; + } + }, { field: 'grade', title: '用户等级', sort: false, width: 105, templet: function (data) { if (data.grade) { @@ -560,6 +566,7 @@ //积分记录 $(document).on('click', '.point', function () { var id = $(this).attr('data-id'); + var searchType = $(this).attr('data-type'); coreHelper.Post("Api/CoreCmsUser/GetDetailsPointLog", { id: id }, function (e) { if (e.code === 0) { admin.popup({ @@ -568,7 +575,7 @@ area: ['90%', '90%'], id: 'LAY-popup-CoreCmsUser-details', success: function (layero, index) { - view(this.id).render('user/userInfo/detailsPointLog', { data: e.data, id: id }).done(function () { + view(this.id).render('user/userInfo/detailsPointLog', { data: e.data, id: id, searchType: searchType }).done(function () { form.render(); }); } @@ -581,6 +588,9 @@ } }); }); + + + //余额明细 $(document).on('click', '.balance', function () { var id = $(this).attr('data-id');