【新增】后台用户列表,积分调整为可用积分,增加累计积分列及可点击列表展示。

This commit is contained in:
大灰灰
2022-08-09 00:56:47 +08:00
parent a581e19421
commit e34dff3f64
5 changed files with 37 additions and 9 deletions

View File

@@ -34,5 +34,14 @@ namespace CoreCms.Net.Model.Entities
/// </summary>
[SugarColumn(IsIgnore = true)]
public string parentNickName { get; set; }
/// <summary>
/// 累计积分
/// </summary>
[SugarColumn(IsIgnore = true)]
public int accumulativePoint { get; set; }
}
}

View File

@@ -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<CoreCmsUser>().Where(o => o.parentId == p.id).Count()
childNum = SqlFunc.Subqueryable<CoreCmsUser>().Where(o => o.parentId == p.id).Count(),
accumulativePoint = SqlFunc.Subqueryable<CoreCmsUserPointLog>().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<CoreCmsOrder>();
var currDay = DateTime.Now.ToString("yyyy-MM-dd");
string currDay;
if (i == 0)
{
where = where.And(p => p.createTime < DateTime.Now);

View File

@@ -1256,15 +1256,15 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region ============================================================
#region ============================================================
// POST: Api/CoreCmsUser/GetUserPointLogPageList
/// <summary>
/// 获取列表
/// 获取积分列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("获取列表")]
[Description("获取积分列表")]
public async Task<AdminUiCallBack> 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);

View File

@@ -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],

View File

@@ -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 = '<a class="link-hot option-show point" data-id="' + data.id + '">' + data.point + '</a>';
return html;
}
},
{
field: 'accumulativePoint', title: '累计积分', sort: false, width: 70, templet: function (data) {
var html = '<a class="link-hot option-show point" data-id="' + data.id + '" data-type="accumulativePoint">' + data.accumulativePoint + '</a>';
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');