### 0.6.0 专业版(大版本升级,破坏性升级,请酌情处理):

【新增】弃用现在sku前端,启用全新sku组件,更加灵活,体验更好。
【新增】新增通过商品序列获取sku全新列表功能。
【新增】仓储层底层增加二级缓存功能,后面将逐步完善底层缓存中心模块。
【新增】0元购,积分兑换模式下,也去计算用户是否科技升级。
【新增】数据及业务仓储增加二级缓存功能。curd可自主控制是否缓存和清除。
【新增】订单导出excel数据增加商品名称+货品sku组合展示的方式。
【新增】自定义交易组件增加【获取商家信息】【更新商家信息】两个接口处理。
【新增】增加公告列表及公告详情页面,首页组件公告点击跳转列表展示。
【新增】个人中心增加【公告中心】入口。
【新增】后台余额变动增加说明录入。

【调整】将前端能进行分包的文件夹都进行分包,减少主包占用,方便进行二开。
【调整】因ckeditor5存在图片不可设置宽度,上传不支持mp4,排版不畅等情况,降级使用ckeditor4版本。
【修复】修复0.5.5版本售后积分返还机制积分模式判断异常的问题。
【修复】修复使用积分全额抵扣,或其他优惠政策导致的0元购,未进行短信提醒及小票打印机未打印的问题。
【修复】修复更换ckeditor4编辑器后接龙添加编辑调用失败的问题。
【修复】修复积分全额抵扣,金额0元购的情况下,进行售后执行完毕,订单未完结的情况。
【优化】去除分销申请面板按钮无用并失效报错的customStyle属性。
【优化】优化部分方法中使用手写字符串的遗留问题,统一采用enum方式。
【优化】优化前端及接口部分命名错误的问题。错将skill误写成seckill。
【优化】去除uniapp端多个客服代码。
【优化】商品详情底部完善购物车数量显示的问题。
【优化】优化团购列表,拼团列表,秒杀页面页面样式布局差异问题。
【优化】调整支付结果界面样式效果,仿微信支付结果界面。更加清晰明朗。
【优化】优化售后提交页面json计算,开放当用户下单后但未发货情况下,可以申请直接售后的操作需求。
【优化】后台商家手机号码支持设置多个,使用小写逗号分隔,方便多个商家管理员接收下单提醒。
【优化】后台售后单审核,调整售后商品为必选项。
This commit is contained in:
大灰灰
2022-09-14 00:53:04 +08:00
parent 6ce893cb38
commit 7b68f352d7
3118 changed files with 161226 additions and 10176 deletions

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Services;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
@@ -115,6 +115,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
where = where.And(p => p.buyUserId == buyUserId);
}
//下单用户id int
var distributorName = Request.Form["distributorName"].FirstOrDefault();
if (!string.IsNullOrEmpty(distributorName))
{
where = where.And(p => p.distributorName == distributorName);
}
//订单编号 nvarchar
var orderId = Request.Form["orderId"].FirstOrDefault();
if (!string.IsNullOrEmpty(orderId))

View File

@@ -0,0 +1,55 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* Description: 暂无
***********************************************************************/
using System;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.Options;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.WeChat.Service.HttpClients;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using SKIT.FlurlHttpClient.Wechat.Api;
namespace CoreCms.Net.Web.Admin.Controllers
{
/// <summary>
/// 演示类
/// </summary>
//[DisableCors]
public class DemoController : ControllerBase
{
/// <summary>
/// 构造函数
/// </summary>
public DemoController()
{
}
/// <summary>
/// 默认首页
/// </summary>
/// <returns></returns>
public WebApiCallBack Index()
{
var jm = new WebApiCallBack();
return jm;
}
}
}

View File

@@ -73,7 +73,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public async Task<AdminUiCallBack> GetJwtToken([FromBody] FMLogin model)
public async Task<object> GetJwtToken([FromBody] FMLogin model)
{
var jm = new AdminUiCallBack();
@@ -137,9 +137,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//插入登录日志
var log = new SysLoginRecord();
log.username = model.userName;
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ?
_httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.os = RuntimeInformation.OSDescription;
if (_httpContextAccessor.HttpContext != null)
log.browser = _httpContextAccessor.HttpContext.Request.Headers[HeaderNames.UserAgent];
@@ -154,9 +152,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//插入登录日志
var log = new SysLoginRecord();
log.username = model.userName;
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ?
_httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.os = RuntimeInformation.OSDescription;
if (_httpContextAccessor.HttpContext != null)
log.browser = _httpContextAccessor.HttpContext.Request.Headers[HeaderNames.UserAgent];
@@ -177,7 +173,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Route("RefreshToken")]
public async Task<AdminUiCallBack> RefreshToken(string token = "")
public async Task<object> RefreshToken(string token = "")
{
var jm = new AdminUiCallBack();
if (string.IsNullOrEmpty(token))
@@ -216,9 +212,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (_httpContextAccessor.HttpContext != null)
{
if (_httpContextAccessor.HttpContext.Connection.RemoteIpAddress != null)
{
log.ip = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();
}
log.os = RuntimeInformation.OSDescription;
log.browser = _httpContextAccessor.HttpContext.Request.Headers[HeaderNames.UserAgent];
}

View File

@@ -208,8 +208,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
else if (!string.IsNullOrEmpty(isDelete) && isDelete.ToLowerInvariant() == "false")
where = where.And(p => p.isDelete == false);
//获取数据
var list = await _coreCmsDistributionServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent,
pageSize);
var list = await _coreCmsDistributionServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize);
//返回数据
jm.data = list;
jm.code = 0;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -77,49 +77,22 @@ namespace CoreCms.Net.Web.Admin.Controllers
var where = PredicateBuilder.True<CoreCmsBillRefund>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<CoreCmsBillRefund, object>> orderEx;
switch (orderField)
Expression<Func<CoreCmsBillRefund, object>> orderEx = orderField switch
{
case "refundId":
orderEx = p => p.refundId;
break;
case "aftersalesId":
orderEx = p => p.aftersalesId;
break;
case "money":
orderEx = p => p.money;
break;
case "userId":
orderEx = p => p.userId;
break;
case "sourceId":
orderEx = p => p.sourceId;
break;
case "type":
orderEx = p => p.type;
break;
case "paymentCode":
orderEx = p => p.paymentCode;
break;
case "tradeNo":
orderEx = p => p.tradeNo;
break;
case "status":
orderEx = p => p.status;
break;
case "memo":
orderEx = p => p.memo;
break;
case "createTime":
orderEx = p => p.createTime;
break;
case "updateTime":
orderEx = p => p.updateTime;
break;
default:
orderEx = p => p.refundId;
break;
}
"refundId" => p => p.refundId,
"aftersalesId" => p => p.aftersalesId,
"money" => p => p.money,
"userId" => p => p.userId,
"sourceId" => p => p.sourceId,
"type" => p => p.type,
"paymentCode" => p => p.paymentCode,
"tradeNo" => p => p.tradeNo,
"status" => p => p.status,
"memo" => p => p.memo,
"createTime" => p => p.createTime,
"updateTime" => p => p.updateTime,
_ => p => p.refundId
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
@@ -131,6 +104,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
};
//查询筛选
//用户昵称 nvarchar
var userNickName = Request.Form["userNickName"].FirstOrDefault();
if (!string.IsNullOrEmpty(userNickName)) where = where.And(p => p.userNickName.Contains(userNickName));
//退款单ID nvarchar
var refundId = Request.Form["refundId"].FirstOrDefault();
if (!string.IsNullOrEmpty(refundId)) where = where.And(p => p.refundId.Contains(refundId));

View File

@@ -17,7 +17,6 @@ using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
@@ -447,7 +446,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var totalSubmit = await _formSubmitServices.GetCountAsync(p => p.formId == entity.id);
var sumSubmit = await _formSubmitServices.GetSumAsync(p => p.formId == entity.id, p => p.money);
var formData = await _formSubmitServices.GetStatisticsByFormid(entity.id, 7);
var formData = await _formSubmitServices.GetStatisticsByFormId(entity.id, 7);
jm.data = new
{
model,

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
@@ -344,408 +344,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
#region ============================================================
// POST: Api/CoreCmsFormSubmit/SelectExportExcel/10
/// <summary>
/// 选择导出
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("选择导出")]
public async Task<AdminUiCallBack> SelectExportExcel([FromBody] FMArrayIntIds entity)
{
var jm = new AdminUiCallBack();
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var mySheet = book.CreateSheet("Sheet1");
//获取list数据
var listModel = await _coreCmsFormSubmitServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc, true);
//给sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
var cell0 = headerRow.CreateCell(0);
cell0.SetCellValue("序列");
cell0.CellStyle = headerStyle;
mySheet.SetColumnWidth(0, 10 * 256);
var cell1 = headerRow.CreateCell(1);
cell1.SetCellValue("表单id");
cell1.CellStyle = headerStyle;
mySheet.SetColumnWidth(1, 10 * 256);
var cell2 = headerRow.CreateCell(2);
cell2.SetCellValue("表单名称");
cell2.CellStyle = headerStyle;
mySheet.SetColumnWidth(2, 10 * 256);
var cell3 = headerRow.CreateCell(3);
cell3.SetCellValue("会员id");
cell3.CellStyle = headerStyle;
mySheet.SetColumnWidth(3, 10 * 256);
var cell4 = headerRow.CreateCell(4);
cell4.SetCellValue("总金额");
cell4.CellStyle = headerStyle;
mySheet.SetColumnWidth(4, 10 * 256);
var cell5 = headerRow.CreateCell(5);
cell5.SetCellValue("是否支付");
cell5.CellStyle = headerStyle;
mySheet.SetColumnWidth(5, 10 * 256);
var cell6 = headerRow.CreateCell(6);
cell6.SetCellValue("是否处理");
cell6.CellStyle = headerStyle;
mySheet.SetColumnWidth(6, 10 * 256);
var cell7 = headerRow.CreateCell(7);
cell7.SetCellValue("表单反馈");
cell7.CellStyle = headerStyle;
mySheet.SetColumnWidth(7, 10 * 256);
var cell8 = headerRow.CreateCell(8);
cell8.SetCellValue("提交人ip");
cell8.CellStyle = headerStyle;
mySheet.SetColumnWidth(8, 10 * 256);
var cell9 = headerRow.CreateCell(9);
cell9.SetCellValue("创建时间");
cell9.CellStyle = headerStyle;
mySheet.SetColumnWidth(9, 10 * 256);
var cell10 = headerRow.CreateCell(10);
cell10.SetCellValue("更新时间");
cell10.CellStyle = headerStyle;
mySheet.SetColumnWidth(10, 10 * 256);
headerRow.Height = 30 * 20;
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
//将数据逐步写入sheet1各个行
for (var i = 0; i < listModel.Count; i++)
{
var rowTemp = mySheet.CreateRow(i + 1);
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].formId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].formName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].userId.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].money.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].payStatus.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].status.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].feedback.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].ip.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].createTime.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].updateTime.ToString());
rowTemp10.CellStyle = commonCellStyle;
}
// 导出excel
string webRootPath = _webHostEnvironment.WebRootPath;
string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsFormSubmit导出(选择结果).xls";
string filePath = webRootPath + tpath;
DirectoryInfo di = new DirectoryInfo(filePath);
if (!di.Exists)
{
di.Create();
}
FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsFormSubmit/QueryExportExcel/10
/// <summary>
/// 查询导出
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("查询导出")]
public async Task<AdminUiCallBack> QueryExportExcel()
{
var jm = new AdminUiCallBack();
var where = PredicateBuilder.True<CoreCmsFormSubmit>();
//查询筛选
//序列 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0)
{
where = where.And(p => p.id == id);
}
//表单id int
var formId = Request.Form["formId"].FirstOrDefault().ObjectToInt(0);
if (formId > 0)
{
where = where.And(p => p.formId == formId);
}
//表单名称 nvarchar
var formName = Request.Form["formName"].FirstOrDefault();
if (!string.IsNullOrEmpty(formName))
{
where = where.And(p => p.formName.Contains(formName));
}
//会员id int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
if (userId > 0)
{
where = where.And(p => p.userId == userId);
}
//是否支付 bit
var payStatus = Request.Form["payStatus"].FirstOrDefault();
if (!string.IsNullOrEmpty(payStatus) && payStatus.ToLowerInvariant() == "true")
{
where = where.And(p => p.payStatus == true);
}
else if (!string.IsNullOrEmpty(payStatus) && payStatus.ToLowerInvariant() == "false")
{
where = where.And(p => p.payStatus == false);
}
//是否处理 bit
var status = Request.Form["status"].FirstOrDefault();
if (!string.IsNullOrEmpty(status) && status.ToLowerInvariant() == "true")
{
where = where.And(p => p.status == true);
}
else if (!string.IsNullOrEmpty(status) && status.ToLowerInvariant() == "false")
{
where = where.And(p => p.status == false);
}
//表单反馈 nvarchar
var feedback = Request.Form["feedback"].FirstOrDefault();
if (!string.IsNullOrEmpty(feedback))
{
where = where.And(p => p.feedback.Contains(feedback));
}
//提交人ip nvarchar
var ip = Request.Form["ip"].FirstOrDefault();
if (!string.IsNullOrEmpty(ip))
{
where = where.And(p => p.ip.Contains(ip));
}
//创建时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
var dt = createTime.ObjectToDate();
where = where.And(p => p.createTime > dt);
}
//更新时间 datetime
var updateTime = Request.Form["updateTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(updateTime))
{
var dt = updateTime.ObjectToDate();
where = where.And(p => p.updateTime > dt);
}
//获取数据
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var mySheet = book.CreateSheet("Sheet1");
//获取list数据
var listModel = await _coreCmsFormSubmitServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc, true);
//给sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
var cell0 = headerRow.CreateCell(0);
cell0.SetCellValue("序列");
cell0.CellStyle = headerStyle;
mySheet.SetColumnWidth(0, 10 * 256);
var cell1 = headerRow.CreateCell(1);
cell1.SetCellValue("表单id");
cell1.CellStyle = headerStyle;
mySheet.SetColumnWidth(1, 10 * 256);
var cell2 = headerRow.CreateCell(2);
cell2.SetCellValue("表单名称");
cell2.CellStyle = headerStyle;
mySheet.SetColumnWidth(2, 10 * 256);
var cell3 = headerRow.CreateCell(3);
cell3.SetCellValue("会员id");
cell3.CellStyle = headerStyle;
mySheet.SetColumnWidth(3, 10 * 256);
var cell4 = headerRow.CreateCell(4);
cell4.SetCellValue("总金额");
cell4.CellStyle = headerStyle;
mySheet.SetColumnWidth(4, 10 * 256);
var cell5 = headerRow.CreateCell(5);
cell5.SetCellValue("是否支付");
cell5.CellStyle = headerStyle;
mySheet.SetColumnWidth(5, 10 * 256);
var cell6 = headerRow.CreateCell(6);
cell6.SetCellValue("是否处理");
cell6.CellStyle = headerStyle;
mySheet.SetColumnWidth(6, 10 * 256);
var cell7 = headerRow.CreateCell(7);
cell7.SetCellValue("表单反馈");
cell7.CellStyle = headerStyle;
mySheet.SetColumnWidth(7, 10 * 256);
var cell8 = headerRow.CreateCell(8);
cell8.SetCellValue("提交人ip");
cell8.CellStyle = headerStyle;
mySheet.SetColumnWidth(8, 10 * 256);
var cell9 = headerRow.CreateCell(9);
cell9.SetCellValue("创建时间");
cell9.CellStyle = headerStyle;
mySheet.SetColumnWidth(9, 10 * 256);
var cell10 = headerRow.CreateCell(10);
cell10.SetCellValue("更新时间");
cell10.CellStyle = headerStyle;
mySheet.SetColumnWidth(10, 10 * 256);
headerRow.Height = 30 * 20;
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
//将数据逐步写入sheet1各个行
for (var i = 0; i < listModel.Count; i++)
{
var rowTemp = mySheet.CreateRow(i + 1);
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].formId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].formName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].userId.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].money.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].payStatus.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].status.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].feedback.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].ip.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].createTime.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].updateTime.ToString());
rowTemp10.CellStyle = commonCellStyle;
}
// 写入到excel
string webRootPath = _webHostEnvironment.WebRootPath;
string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsFormSubmit导出(查询结果).xls";
string filePath = webRootPath + tpath;
DirectoryInfo di = new DirectoryInfo(filePath);
if (!di.Exists)
{
di.Create();
}
FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsFormSubmit/DoSetpayStatus/10
/// <summary>

View File

@@ -206,13 +206,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var jm = new AdminUiCallBack();
var bl = await _coreCmsBrandServices.InsertAsync(entity) > 0;
var bl = await _coreCmsBrandServices.InsertAsync(entity, true) > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
if (bl)
{
var brands = await _coreCmsBrandServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var brands = await _coreCmsBrandServices.QueryAsync(true, true);
jm.data = new
{
brands
@@ -281,7 +281,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.createTime = DateTime.Now;
//事物处理过程结束
var bl = await _coreCmsBrandServices.UpdateAsync(oldModel);
var bl = await _coreCmsBrandServices.UpdateAsync(oldModel, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
@@ -317,7 +317,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var bl = await _coreCmsBrandServices.DeleteByIdAsync(entity.id);
var bl = await _coreCmsBrandServices.DeleteByIdAsync(entity.id, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
@@ -336,7 +336,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("设置是否显示")]
public async Task<AdminUiCallBack> DoSetisShow([FromBody] FMUpdateBoolDataByIntId entity)
public async Task<AdminUiCallBack> DoSetIsShow([FromBody] FMUpdateBoolDataByIntId entity)
{
var jm = new AdminUiCallBack();
@@ -350,7 +350,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.isShow = entity.data;
oldModel.createTime = DateTime.Now;
var bl = await _coreCmsBrandServices.UpdateAsync(oldModel);
var bl = await _coreCmsBrandServices.UpdateAsync(oldModel, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;

View File

@@ -72,8 +72,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var jm = new AdminUiCallBack();
//获取数据
var list = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.id > 0, p => p.sort,
OrderByType.Desc);
var list = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.id > 0, p => p.sort, OrderByType.Desc, true, true);
//返回数据
jm.data = list;
jm.code = 0;
@@ -110,8 +109,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort,
OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Asc, true, true);
jm.data = new
{
categories = GoodsHelper.GetTree(categories),
@@ -139,8 +137,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.msg = (bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure);
if (bl)
{
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort,
OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Asc, true, true);
jm.data = new
{
categories = GoodsHelper.GetTree(categories, false)
@@ -172,8 +169,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
jm.code = 0;
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort,
OrderByType.Asc); ;
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Asc, true, true);
jm.data = new
{
model,
@@ -220,7 +216,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.createTime = entity.createTime;
//事物处理过程结束
var result = await _coreCmsGoodsCategoryServices.UpdateAsync(oldModel);
var result = await _coreCmsGoodsCategoryServices.UpdateAsync(entity);
var bl = result.code == 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
@@ -279,7 +275,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("设置是否显示")]
public async Task<AdminUiCallBack> DoSetisShow([FromBody] FMUpdateBoolDataByIntId entity)
public async Task<AdminUiCallBack> DoSetIsShow([FromBody] FMUpdateBoolDataByIntId entity)
{
var jm = new AdminUiCallBack();

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -54,7 +54,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
private readonly ICoreCmsLabelServices _labelServices;
private readonly ICoreCmsProductsServices _productsServices;
private readonly ICoreCmsSettingServices _settingServices;
private readonly ICoreCmsGoodsTypeSpecServices _typeSpecServices;
private readonly ICoreCmsGoodsTypeSpecValueServices _typeSpecValueServices;
private readonly ICoreCmsUserGradeServices _userGradeServices;
private readonly ICoreCmsProductsDistributionServices _productsDistributionServices;
@@ -71,13 +70,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
, ICoreCmsGoodsCategoryServices coreCmsGoodsCategoryServices
, ICoreCmsUserGradeServices userGradeServices
, ICoreCmsGoodsParamsServices goodsParamsServices
, ICoreCmsGoodsTypeSpecServices typeSpecServices
, ICoreCmsGoodsTypeSpecValueServices typeSpecValueServices
, ICoreCmsGoodsGradeServices goodsGradeServices
, ICoreCmsProductsServices productsServices
, ICoreCmsGoodsCategoryExtendServices categoryExtendServices
, ICoreCmsLabelServices labelServices
, ICoreCmsProductsDistributionServices productsDistributionServices, ICoreCmsGoodsTypeSpecServices goodsTypeSpecServices)
, ICoreCmsProductsDistributionServices productsDistributionServices
, ICoreCmsGoodsTypeSpecServices goodsTypeSpecServices)
{
_webHostEnvironment = webHostEnvironment;
_coreCmsGoodsServices = coreCmsGoodsServices;
@@ -86,7 +85,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
_coreCmsGoodsCategoryServices = coreCmsGoodsCategoryServices;
_userGradeServices = userGradeServices;
_goodsParamsServices = goodsParamsServices;
_typeSpecServices = typeSpecServices;
_typeSpecValueServices = typeSpecValueServices;
_goodsGradeServices = goodsGradeServices;
_productsServices = productsServices;
@@ -113,112 +111,43 @@ namespace CoreCms.Net.Web.Admin.Controllers
var where = PredicateBuilder.True<CoreCmsGoods>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<CoreCmsGoods, object>> orderEx;
switch (orderField)
Expression<Func<CoreCmsGoods, object>> orderEx = orderField switch
{
case "id":
orderEx = p => p.id;
break;
case "bn":
orderEx = p => p.bn;
break;
case "name":
orderEx = p => p.name;
break;
case "brief":
orderEx = p => p.brief;
break;
case "price":
orderEx = p => p.price;
break;
case "costprice":
orderEx = p => p.costprice;
break;
case "mktprice":
orderEx = p => p.mktprice;
break;
case "images":
orderEx = p => p.images;
break;
case "goodsCategoryId":
orderEx = p => p.goodsCategoryId;
break;
case "goodsTypeId":
orderEx = p => p.goodsTypeId;
break;
case "brandId":
orderEx = p => p.brandId;
break;
case "isNomalVirtual":
orderEx = p => p.isNomalVirtual;
break;
case "isMarketable":
orderEx = p => p.isMarketable;
break;
case "stock":
orderEx = p => p.stock; //这里的
break;
case "freezeStock":
orderEx = p => p.freezeStock; //这里的
break;
case "weight":
orderEx = p => p.weight; //这里的
break;
case "unit":
orderEx = p => p.unit;
break;
case "intro":
orderEx = p => p.intro;
break;
case "spesDesc":
orderEx = p => p.spesDesc;
break;
case "parameters":
orderEx = p => p.parameters;
break;
case "commentsCount":
orderEx = p => p.commentsCount;
break;
case "viewCount":
orderEx = p => p.viewCount;
break;
case "buyCount":
orderEx = p => p.buyCount;
break;
case "uptime":
orderEx = p => p.uptime;
break;
case "downtime":
orderEx = p => p.downtime;
break;
case "sort":
orderEx = p => p.sort;
break;
case "labelIds":
orderEx = p => p.labelIds;
break;
case "newSpec":
orderEx = p => p.newSpec;
break;
case "createTime":
orderEx = p => p.createTime;
break;
case "updateTime":
orderEx = p => p.updateTime;
break;
case "isRecommend":
orderEx = p => p.isRecommend;
break;
case "isHot":
orderEx = p => p.isHot;
break;
case "isDel":
orderEx = p => p.isDel;
break;
default:
orderEx = p => p.id;
break;
}
"id" => p => p.id,
"bn" => p => p.bn,
"name" => p => p.name,
"brief" => p => p.brief,
"price" => p => p.price,
"costprice" => p => p.costprice,
"mktprice" => p => p.mktprice,
"images" => p => p.images,
"goodsCategoryId" => p => p.goodsCategoryId,
"goodsTypeId" => p => p.goodsTypeId,
"brandId" => p => p.brandId,
"isNomalVirtual" => p => p.isNomalVirtual,
"isMarketable" => p => p.isMarketable,
"stock" => p => p.stock,
"freezeStock" => p => p.freezeStock,
"weight" => p => p.weight,
"unit" => p => p.unit,
"intro" => p => p.intro,
"spesDesc" => p => p.spesDesc,
"parameters" => p => p.parameters,
"commentsCount" => p => p.commentsCount,
"viewCount" => p => p.viewCount,
"buyCount" => p => p.buyCount,
"uptime" => p => p.uptime,
"downtime" => p => p.downtime,
"sort" => p => p.sort,
"labelIds" => p => p.labelIds,
"newSpec" => p => p.newSpec,
"createTime" => p => p.createTime,
"updateTime" => p => p.updateTime,
"isRecommend" => p => p.isRecommend,
"isHot" => p => p.isHot,
"isDel" => p => p.isDel,
_ => p => p.id
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
@@ -294,7 +223,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (list != null && list.Any())
{
var labels = await _labelServices.QueryAsync();
var labels = await _labelServices.QueryAsync(true, true);
foreach (var item in list)
if (!string.IsNullOrEmpty(item.labelIds))
@@ -304,7 +233,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
}
//返回数据
jm.data = list;
jm.code = 0;
@@ -331,8 +259,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var totalGoods = await _coreCmsGoodsServices.GetCountAsync(p => p.id > 0 && p.isDel == false);
var totalMarketableUp = await _coreCmsGoodsServices.GetCountAsync(p => p.isMarketable && p.isDel == false);
var totalMarketableDown =
await _coreCmsGoodsServices.GetCountAsync(p => p.isMarketable == false && p.isDel == false);
var totalMarketableDown = await _coreCmsGoodsServices.GetCountAsync(p => p.isMarketable == false && p.isDel == false);
//获取库存
var allConfigs = await _settingServices.GetConfigDictionaries();
@@ -352,10 +279,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort,
OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取品牌
var brands = await _brandServices.QueryAsync();
var brands = await _brandServices.QueryAsync(true, true);
//获取商品分销方式
var productsDistributionType = EnumHelper.EnumToList<GlobalEnumVars.ProductsDistributionType>();
@@ -392,20 +318,16 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack { code = 0 };
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取参数列表
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
//获取SKU列表
var skuList = await _goodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var skuList = await _goodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
//获取品牌
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true);
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true, true);
//获取用户等级
var userGrade = await _userGradeServices.QueryAsync();
//获取商品分销enum
var productsDistributionType = EnumHelper.EnumToList<GlobalEnumVars.ProductsDistributionType>();
@@ -466,29 +388,24 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.code = 0;
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.GetCaChe();
categories = categories.Where(p => p.isShow == true).ToList();
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取用户等级
var userGrade = await _userGradeServices.QueryAsync();
//用户价格体系
var goodsGrades = await _goodsGradeServices.QueryListByClauseAsync(p => p.goodsId == model.id);
//货品信息
var products =
await _productsServices.QueryListByClauseAsync(p => p.goodsId == model.id && p.isDel == false);
var products = await _productsServices.QueryListByClauseAsync(p => p.goodsId == model.id && p.isDel == false);
//扩展信息
var categoryExtend = await _categoryExtendServices.QueryListByClauseAsync(p => p.goodsId == model.id);
//获取商品分销enum
var productsDistributionType = EnumHelper.EnumToList<GlobalEnumVars.ProductsDistributionType>();
//获取参数列表
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
//获取SKU列表
var skuList = await _goodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var skuList = await _goodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
//获取品牌
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true);
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true, true);
if (products != null && products.Any())
@@ -527,7 +444,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (!string.IsNullOrEmpty(model.goodsSkuIds))
{
var specIds = Utility.Helper.CommonHelper.StringToIntArray(model.goodsSkuIds);
var typeSpecs = await _typeSpecServices.QueryListByClauseAsync(p => specIds.Contains(p.id));
var typeSpecs = skuList.Where(p => specIds.Contains(p.id)).ToList();
var typeSpecValues = await _typeSpecValueServices.QueryListByClauseAsync(p => specIds.Contains(p.specId));
typeSpecs.ForEach(p =>
{
@@ -638,8 +555,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.code = 0;
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.GetCaChe();
categories = categories.Where(p => p.isShow == true).ToList();
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取用户等级
var userGrade = await _userGradeServices.QueryAsync();
@@ -655,12 +571,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
//获取参数列表
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var paramsList = await _goodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
//获取SKU列表
var skuList = await _goodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
//获取品牌
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true);
var brands = await _brandServices.QueryListByClauseAsync(p => p.id > 0 && p.isShow == true, p => p.id, OrderByType.Desc, true, true);
if (products != null && products.Any())
@@ -699,7 +615,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (!string.IsNullOrEmpty(model.goodsSkuIds))
{
var specIds = Utility.Helper.CommonHelper.StringToIntArray(model.goodsSkuIds);
var typeSpecs = await _typeSpecServices.QueryListByClauseAsync(p => specIds.Contains(p.id));
var typeSpecs = await _goodsTypeSpecServices.QueryListByClauseAsync(p => specIds.Contains(p.id));
var typeSpecValues = await _typeSpecValueServices.QueryListByClauseAsync(p => specIds.Contains(p.specId));
typeSpecs.ForEach(p =>
{
@@ -910,7 +826,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var typeSpecs = await _typeSpecServices.QueryListByClauseAsync(p => entity.id.Contains(p.id));
var typeSpecs = await _goodsTypeSpecServices.QueryListByClauseAsync(p => entity.id.Contains(p.id));
var typeSpecValues = await _typeSpecValueServices.QueryListByClauseAsync(p => entity.id.Contains(p.specId));
typeSpecs.ForEach(p => { p.specValues = typeSpecValues.Where(o => o.specId == p.id).ToList(); });

View File

@@ -48,6 +48,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <summary>
/// 构造函数
/// </summary>
/// <param name="webHostEnvironment"></param>
/// <param name="coreCmsGoodsParamsServices"></param>
public CoreCmsGoodsParamsController(IWebHostEnvironment webHostEnvironment,
ICoreCmsGoodsParamsServices coreCmsGoodsParamsServices)
{
@@ -231,14 +233,14 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack();
entity.createTime = DateTime.Now;
var bl = await _coreCmsGoodsParamsServices.InsertAsync(entity) > 0;
var bl = await _coreCmsGoodsParamsServices.InsertAsync(entity, true) > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
if (bl)
{
//获取列表
var paramsList = await _coreCmsGoodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var paramsList = await _coreCmsGoodsParamsServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
jm.data = new
{
paramsList
@@ -312,7 +314,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.updateTime = DateTime.Now;
//事物处理过程结束
var bl = await _coreCmsGoodsParamsServices.UpdateAsync(oldModel);
var bl = await _coreCmsGoodsParamsServices.UpdateAsync(oldModel, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
@@ -342,7 +344,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var bl = await _coreCmsGoodsParamsServices.DeleteByIdAsync(entity.id);
var bl = await _coreCmsGoodsParamsServices.DeleteByIdAsync(entity.id, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
@@ -398,9 +400,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsGoodsParamsServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id,
OrderByType.Asc);
var listmodel = await _coreCmsGoodsParamsServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("序列");
@@ -493,8 +493,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsGoodsParamsServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc);
var listmodel = await _coreCmsGoodsParamsServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("序列");

View File

@@ -109,15 +109,14 @@ namespace CoreCms.Net.Web.Admin.Controllers
var sort = Request.Form["sort"].FirstOrDefault().ObjectToInt(0);
if (sort > 0) @where = @where.And(p => p.sort == sort);
//获取数据
var list = await _coreCmsGoodsTypeSpecServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent,
pageSize);
var list = await _coreCmsGoodsTypeSpecServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true, true);
if (list != null && list.Any())
{
var ids = list.Select(p => p.id).ToList();
if (ids.Any())
{
var values = await _valueServices.QueryListByClauseAsync(p => ids.Contains(p.specId));
var values = await _valueServices.QueryListByClauseAsync(p => ids.Contains(p.specId), p => p.id, OrderByType.Asc, true, true);
foreach (var item in list)
item.specValues = values.Where(p => p.specId == item.id).OrderBy(p => p.sort).ToList();
}
@@ -186,7 +185,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (jm.code == 0)
{
//获取SKU列表
var skuList = await _coreCmsGoodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true);
var skuList = await _coreCmsGoodsTypeSpecServices.QueryListByClauseAsync(p => p.id > 0, p => p.id, OrderByType.Desc, true, true);
jm.data = new
{
skuList
@@ -218,9 +217,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var values =
await _valueServices.QueryListByClauseAsync(p => p.specId == model.id, p => p.sort,
OrderByType.Asc);
var values = await _valueServices.QueryListByClauseAsync(p => p.specId == model.id, p => p.sort, OrderByType.Asc);
model.specValues = values;
jm.code = 0;
jm.data = model;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -78,55 +78,24 @@ namespace CoreCms.Net.Web.Admin.Controllers
var where = PredicateBuilder.True<CoreCmsBillDelivery>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<CoreCmsBillDelivery, object>> orderEx;
switch (orderField)
Expression<Func<CoreCmsBillDelivery, object>> orderEx = orderField switch
{
case "deliveryId":
orderEx = p => p.deliveryId;
break;
case "logiCode":
orderEx = p => p.logiCode;
break;
case "logiNo":
orderEx = p => p.logiNo;
break;
case "logiInformation":
orderEx = p => p.logiInformation;
break;
case "logiStatus":
orderEx = p => p.logiStatus;
break;
case "shipAreaId":
orderEx = p => p.shipAreaId;
break;
case "shipAddress":
orderEx = p => p.shipAddress;
break;
case "shipName":
orderEx = p => p.shipName;
break;
case "shipMobile":
orderEx = p => p.shipMobile;
break;
case "status":
orderEx = p => p.status;
break;
case "memo":
orderEx = p => p.memo;
break;
case "confirmTime":
orderEx = p => p.confirmTime;
break;
case "createTime":
orderEx = p => p.createTime;
break;
case "updateTime":
orderEx = p => p.updateTime;
break;
default:
orderEx = p => p.deliveryId;
break;
}
"deliveryId" => p => p.deliveryId,
"logiCode" => p => p.logiCode,
"logiNo" => p => p.logiNo,
"logiInformation" => p => p.logiInformation,
"logiStatus" => p => p.logiStatus,
"shipAreaId" => p => p.shipAreaId,
"shipAddress" => p => p.shipAddress,
"shipName" => p => p.shipName,
"shipMobile" => p => p.shipMobile,
"status" => p => p.status,
"memo" => p => p.memo,
"confirmTime" => p => p.confirmTime,
"createTime" => p => p.createTime,
"updateTime" => p => p.updateTime,
_ => p => p.deliveryId
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
@@ -239,12 +208,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (list.Any())
{
var logist = await _logisticsServices.QueryAsync();
var areaCache =await _areaServices.GetCaChe();
var areaCache = await _areaServices.GetCaChe();
foreach (var item in list)
{
if (item.shipAreaId > 0)
{
var result =await _areaServices.GetAreaFullName(item.shipAreaId, areaCache);
var result = await _areaServices.GetAreaFullName(item.shipAreaId, areaCache);
if (result.status) item.shipAddress = result.data + item.shipAddress;
}
@@ -387,7 +356,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
if (model.shipAreaId > 0)
{
var result =await _areaServices.GetAreaFullName(model.shipAreaId);
var result = await _areaServices.GetAreaFullName(model.shipAreaId);
if (result.status) model.shipAddress = result.data + model.shipAddress;
}
@@ -505,132 +474,132 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var jm = new AdminUiCallBack();
var where = PredicateBuilder.True<CoreCmsBillDelivery>();
//查询筛选
var where = PredicateBuilder.True<CoreCmsBillDelivery>();
//查询筛选
//发货单序列 nvarchar
var deliveryId = Request.Form["deliveryId"].FirstOrDefault();
if (!string.IsNullOrEmpty(deliveryId)) @where = @where.And(p => p.deliveryId.Contains(deliveryId));
//物流公司编码 nvarchar
var logiCode = Request.Form["logiCode"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiCode)) @where = @where.And(p => p.logiCode.Contains(logiCode));
//物流单号 nvarchar
var logiNo = Request.Form["logiNo"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiNo)) @where = @where.And(p => p.logiNo.Contains(logiNo));
//快递物流信息 nvarchar
var logiInformation = Request.Form["logiInformation"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiInformation))
@where = @where.And(p => p.logiInformation.Contains(logiInformation));
//快递是否不更新 bit
var logiStatus = Request.Form["logiStatus"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiStatus) && logiStatus.ToLowerInvariant() == "true")
@where = @where.And(p => p.logiStatus);
else if (!string.IsNullOrEmpty(logiStatus) && logiStatus.ToLowerInvariant() == "false")
@where = @where.And(p => p.logiStatus == false);
//收货地区ID int
var shipAreaId = Request.Form["shipAreaId"].FirstOrDefault().ObjectToInt(0);
if (shipAreaId > 0) @where = @where.And(p => p.shipAreaId == shipAreaId);
//收货详细地址 nvarchar
var shipAddress = Request.Form["shipAddress"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipAddress)) @where = @where.And(p => p.shipAddress.Contains(shipAddress));
//收货人姓名 nvarchar
var shipName = Request.Form["shipName"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipName)) @where = @where.And(p => p.shipName.Contains(shipName));
//收货电话 nvarchar
var shipMobile = Request.Form["shipMobile"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipMobile)) @where = @where.And(p => p.shipMobile.Contains(shipMobile));
//状态 int
var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0);
if (status > 0) @where = @where.And(p => p.status == status);
//备注 nvarchar
var memo = Request.Form["memo"].FirstOrDefault();
if (!string.IsNullOrEmpty(memo)) @where = @where.And(p => p.memo.Contains(memo));
//确认收货时间 datetime
var confirmTime = Request.Form["confirmTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(confirmTime))
{
var dt = confirmTime.ObjectToDate();
where = where.And(p => p.confirmTime > dt);
}
//发货单序列 nvarchar
var deliveryId = Request.Form["deliveryId"].FirstOrDefault();
if (!string.IsNullOrEmpty(deliveryId)) @where = @where.And(p => p.deliveryId.Contains(deliveryId));
//物流公司编码 nvarchar
var logiCode = Request.Form["logiCode"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiCode)) @where = @where.And(p => p.logiCode.Contains(logiCode));
//物流单号 nvarchar
var logiNo = Request.Form["logiNo"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiNo)) @where = @where.And(p => p.logiNo.Contains(logiNo));
//快递物流信息 nvarchar
var logiInformation = Request.Form["logiInformation"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiInformation))
@where = @where.And(p => p.logiInformation.Contains(logiInformation));
//快递是否不更新 bit
var logiStatus = Request.Form["logiStatus"].FirstOrDefault();
if (!string.IsNullOrEmpty(logiStatus) && logiStatus.ToLowerInvariant() == "true")
@where = @where.And(p => p.logiStatus);
else if (!string.IsNullOrEmpty(logiStatus) && logiStatus.ToLowerInvariant() == "false")
@where = @where.And(p => p.logiStatus == false);
//收货地区ID int
var shipAreaId = Request.Form["shipAreaId"].FirstOrDefault().ObjectToInt(0);
if (shipAreaId > 0) @where = @where.And(p => p.shipAreaId == shipAreaId);
//收货详细地址 nvarchar
var shipAddress = Request.Form["shipAddress"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipAddress)) @where = @where.And(p => p.shipAddress.Contains(shipAddress));
//收货人姓名 nvarchar
var shipName = Request.Form["shipName"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipName)) @where = @where.And(p => p.shipName.Contains(shipName));
//收货电话 nvarchar
var shipMobile = Request.Form["shipMobile"].FirstOrDefault();
if (!string.IsNullOrEmpty(shipMobile)) @where = @where.And(p => p.shipMobile.Contains(shipMobile));
//状态 int
var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0);
if (status > 0) @where = @where.And(p => p.status == status);
//备注 nvarchar
var memo = Request.Form["memo"].FirstOrDefault();
if (!string.IsNullOrEmpty(memo)) @where = @where.And(p => p.memo.Contains(memo));
//确认收货时间 datetime
var confirmTime = Request.Form["confirmTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(confirmTime))
{
var dt = confirmTime.ObjectToDate();
where = where.And(p => p.confirmTime > dt);
}
//创建时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
var dt = createTime.ObjectToDate();
where = where.And(p => p.createTime > dt);
}
//创建时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
var dt = createTime.ObjectToDate();
where = where.And(p => p.createTime > dt);
}
//更新时间 datetime
var updateTime = Request.Form["updateTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(updateTime))
{
var dt = updateTime.ObjectToDate();
where = where.And(p => p.updateTime > dt);
}
//更新时间 datetime
var updateTime = Request.Form["updateTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(updateTime))
{
var dt = updateTime.ObjectToDate();
where = where.And(p => p.updateTime > dt);
}
//获取数据
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsBillDeliveryServices.QueryListByClauseAsync(where, p => p.deliveryId,
OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("发货单序列");
row1.CreateCell(1).SetCellValue("物流公司编码");
row1.CreateCell(2).SetCellValue("物流单号");
row1.CreateCell(3).SetCellValue("快递物流信息");
row1.CreateCell(4).SetCellValue("快递是否不更新");
row1.CreateCell(5).SetCellValue("收货地区ID");
row1.CreateCell(6).SetCellValue("收货详细地址");
row1.CreateCell(7).SetCellValue("收货人姓名");
row1.CreateCell(8).SetCellValue("收货电话");
row1.CreateCell(9).SetCellValue("状态");
row1.CreateCell(10).SetCellValue("备注");
row1.CreateCell(11).SetCellValue("确认收货时间");
row1.CreateCell(12).SetCellValue("创建时间");
row1.CreateCell(13).SetCellValue("更新时间");
//获取数据
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsBillDeliveryServices.QueryListByClauseAsync(where, p => p.deliveryId,
OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("发货单序列");
row1.CreateCell(1).SetCellValue("物流公司编码");
row1.CreateCell(2).SetCellValue("物流单号");
row1.CreateCell(3).SetCellValue("快递物流信息");
row1.CreateCell(4).SetCellValue("快递是否不更新");
row1.CreateCell(5).SetCellValue("收货地区ID");
row1.CreateCell(6).SetCellValue("收货详细地址");
row1.CreateCell(7).SetCellValue("收货人姓名");
row1.CreateCell(8).SetCellValue("收货电话");
row1.CreateCell(9).SetCellValue("状态");
row1.CreateCell(10).SetCellValue("备注");
row1.CreateCell(11).SetCellValue("确认收货时间");
row1.CreateCell(12).SetCellValue("创建时间");
row1.CreateCell(13).SetCellValue("更新时间");
//将数据逐步写入sheet1各个行
for (var i = 0; i < listmodel.Count; i++)
{
var rowtemp = sheet1.CreateRow(i + 1);
rowtemp.CreateCell(0).SetCellValue(listmodel[i].deliveryId);
rowtemp.CreateCell(1).SetCellValue(listmodel[i].logiCode);
rowtemp.CreateCell(2).SetCellValue(listmodel[i].logiNo);
rowtemp.CreateCell(3).SetCellValue(listmodel[i].logiInformation);
rowtemp.CreateCell(4).SetCellValue(listmodel[i].logiStatus.ToString());
rowtemp.CreateCell(5).SetCellValue(listmodel[i].shipAreaId.ToString());
rowtemp.CreateCell(6).SetCellValue(listmodel[i].shipAddress);
rowtemp.CreateCell(7).SetCellValue(listmodel[i].shipName);
rowtemp.CreateCell(8).SetCellValue(listmodel[i].shipMobile);
rowtemp.CreateCell(9).SetCellValue(listmodel[i].status.ToString());
rowtemp.CreateCell(10).SetCellValue(listmodel[i].memo);
rowtemp.CreateCell(11).SetCellValue(listmodel[i].confirmTime.ToString());
rowtemp.CreateCell(12).SetCellValue(listmodel[i].createTime.ToString());
rowtemp.CreateCell(13).SetCellValue(listmodel[i].updateTime.ToString());
}
//将数据逐步写入sheet1各个行
for (var i = 0; i < listmodel.Count; i++)
{
var rowtemp = sheet1.CreateRow(i + 1);
rowtemp.CreateCell(0).SetCellValue(listmodel[i].deliveryId);
rowtemp.CreateCell(1).SetCellValue(listmodel[i].logiCode);
rowtemp.CreateCell(2).SetCellValue(listmodel[i].logiNo);
rowtemp.CreateCell(3).SetCellValue(listmodel[i].logiInformation);
rowtemp.CreateCell(4).SetCellValue(listmodel[i].logiStatus.ToString());
rowtemp.CreateCell(5).SetCellValue(listmodel[i].shipAreaId.ToString());
rowtemp.CreateCell(6).SetCellValue(listmodel[i].shipAddress);
rowtemp.CreateCell(7).SetCellValue(listmodel[i].shipName);
rowtemp.CreateCell(8).SetCellValue(listmodel[i].shipMobile);
rowtemp.CreateCell(9).SetCellValue(listmodel[i].status.ToString());
rowtemp.CreateCell(10).SetCellValue(listmodel[i].memo);
rowtemp.CreateCell(11).SetCellValue(listmodel[i].confirmTime.ToString());
rowtemp.CreateCell(12).SetCellValue(listmodel[i].createTime.ToString());
rowtemp.CreateCell(13).SetCellValue(listmodel[i].updateTime.ToString());
}
// 写入到excel
var webRootPath = _webHostEnvironment.WebRootPath;
var tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
var fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsBillDelivery导出(查询结果).xls";
var filePath = webRootPath + tpath;
var di = new DirectoryInfo(filePath);
if (!di.Exists) di.Create();
var fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
// 写入到excel
var webRootPath = _webHostEnvironment.WebRootPath;
var tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
var fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsBillDelivery导出(查询结果).xls";
var filePath = webRootPath + tpath;
var di = new DirectoryInfo(filePath);
if (!di.Exists) di.Create();
var fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
return jm;
return jm;
}
#endregion

View File

@@ -113,7 +113,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
orderEx = p => p.isDel;
break;
default:
orderEx = p => p.id;
orderEx = p => p.createTime;
break;
}
@@ -597,5 +597,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
}
}

View File

@@ -98,46 +98,21 @@ namespace CoreCms.Net.Web.Admin.Controllers
var where = PredicateBuilder.True<CoreCmsPromotion>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<CoreCmsPromotion, object>> orderEx;
switch (orderField)
Expression<Func<CoreCmsPromotion, object>> orderEx = orderField switch
{
case "id":
orderEx = p => p.id;
break;
case "name":
orderEx = p => p.name;
break;
case "type":
orderEx = p => p.type;
break;
case "sort":
orderEx = p => p.sort;
break;
case "parameters":
orderEx = p => p.parameters;
break;
case "startTime":
orderEx = p => p.startTime;
break;
case "endTime":
orderEx = p => p.endTime;
break;
case "isExclusive":
orderEx = p => p.isExclusive;
break;
case "isAutoReceive":
orderEx = p => p.isAutoReceive;
break;
case "isEnable":
orderEx = p => p.isEnable;
break;
case "isDel":
orderEx = p => p.isDel;
break;
default:
orderEx = p => p.id;
break;
}
"id" => p => p.id,
"name" => p => p.name,
"type" => p => p.type,
"sort" => p => p.sort,
"parameters" => p => p.parameters,
"startTime" => p => p.startTime,
"endTime" => p => p.endTime,
"isExclusive" => p => p.isExclusive,
"isAutoReceive" => p => p.isAutoReceive,
"isEnable" => p => p.isEnable,
"isDel" => p => p.isDel,
_ => p => p.id
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
var orderBy = orderDirection switch
@@ -478,7 +453,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("设置是否排他")]
public async Task<AdminUiCallBack> DoSetisExclusive([FromBody] FMUpdateBoolDataByIntId entity)
public async Task<AdminUiCallBack> DoSetIsExclusive([FromBody] FMUpdateBoolDataByIntId entity)
{
var jm = new AdminUiCallBack();
@@ -552,10 +527,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
var conditionCodes = SystemSettingDictionary.GetPromotionConditionType();
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort,
OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取商品品牌
var brands = await _coreCmsBrandServices.QueryListByClauseAsync(p => p.isShow == true);
var brands = await _coreCmsBrandServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Asc, true, true);
//获取用户等级
var grades = await _coreCmsUserGradeServices.QueryAsync();
@@ -676,10 +650,9 @@ namespace CoreCms.Net.Web.Admin.Controllers
var conditionCodes = SystemSettingDictionary.GetPromotionConditionType();
//获取商品分类
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort,
OrderByType.Asc);
var categories = await _coreCmsGoodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取商品品牌
var brands = await _coreCmsBrandServices.QueryListByClauseAsync(p => p.isShow == true);
var brands = await _coreCmsBrandServices.QueryListByClauseAsync(p => p.isShow == true, p => p.sort, OrderByType.Asc, true, true);
//获取用户等级
var grades = await _coreCmsUserGradeServices.QueryAsync();

View File

@@ -13,8 +13,6 @@ using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Echarts;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -24,6 +22,8 @@ using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Model.ViewModels.Echarts;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using SqlSugar;

View File

@@ -69,7 +69,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack();
//获取数据
var list = await _coreCmsAreaServices.GetCaChe();
var list = await _coreCmsAreaServices.QueryListByClauseAsync(p => p.depth < 3);
//返回数据
jm.data = list;
jm.code = 0;

View File

@@ -333,11 +333,10 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.code = 0;
//获取品牌数据
var brandsData = await _brandServices.QueryAsync();
var brandsData = await _brandServices.QueryAsync(true, true);
var brands = brandsData.Select(p => new { p.id, p.name }).ToList();
//获取分类数据
var categories = await _goodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort,
OrderByType.Asc);
var categories = await _goodsCategoryServices.QueryListByClauseAsync(p => p.isShow, p => p.sort, OrderByType.Asc, true, true);
//获取文章分类数据
var articleTypes = await _articleTypeServices.QueryAsync();

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -19,10 +19,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;

View File

@@ -18,6 +18,7 @@ using AutoMapper;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
@@ -71,7 +72,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
code = 0,
data = _mapper
.Map<List<SqlSugar.DbTableInfo>, List<CoreCms.Net.Model.ViewModels.Basics.DbTableInfoTree>>(tables)
.Map<List<SqlSugar.DbTableInfo>, List<DbTableInfoTree>>(tables)
};
return jm;
}
@@ -84,7 +85,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("生成代码")]
public ActionResult CodeGenDown([FromQuery] string tableName, [FromQuery] string fileType)
public IActionResult CodeGenDown([FromQuery] string tableName, [FromQuery] string fileType)
{
var jm = new AdminUiCallBack();
if (string.IsNullOrEmpty(tableName))

View File

@@ -19,10 +19,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
@@ -212,15 +212,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack();
jm = await _sysMenuServices.DeleteByIdAsync(entity.id);
return jm;
}
#endregion
@@ -265,13 +258,10 @@ namespace CoreCms.Net.Web.Admin.Controllers
});
}
var bl = await _sysMenuServices.InsertAsync(list) > 0;
var bl = await _sysMenuServices.InsertAsync(list, true) > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
if (bl)
{
await _sysMenuServices.UpdateCaChe();
}
return jm;
}

View File

@@ -191,6 +191,13 @@ namespace CoreCms.Net.Web.Admin.Controllers
var NetUserIdentity = Request.Form["NetUserIdentity"].FirstOrDefault();
if (!string.IsNullOrEmpty(NetUserIdentity))
@where = @where.And(p => p.NetUserIdentity.Contains(NetUserIdentity));
//身份认证 nvarchar
var logTitle = Request.Form["logTitle"].FirstOrDefault();
if (!string.IsNullOrEmpty(logTitle))
@where = @where.And(p => p.LogTitle.Contains(logTitle));
//异常信息 nvarchar
var Exception = Request.Form["Exception"].FirstOrDefault();
if (!string.IsNullOrEmpty(Exception)) @where = @where.And(p => p.Exception.Contains(Exception));
@@ -519,6 +526,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
#region ============================================================
// POST: Api/SysNLogRecords/DoBatchDelete/10,11,20
@@ -541,5 +549,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
#endregion
}
}

View File

@@ -18,10 +18,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
@@ -43,22 +43,22 @@ namespace CoreCms.Net.Web.Admin.Controllers
public class SysOperRecordController : ControllerBase
{
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly ISysOperRecordServices _sysOperRecordServices;
private readonly ISysOperRecordServices _SysOperRecordServices;
/// <summary>
/// 构造函数
///</summary>
public SysOperRecordController(IWebHostEnvironment webHostEnvironment
,ISysOperRecordServices sysOperRecordServices
, ISysOperRecordServices SysOperRecordServices
)
{
_webHostEnvironment = webHostEnvironment;
_sysOperRecordServices = sysOperRecordServices;
_SysOperRecordServices = SysOperRecordServices;
}
#region ============================================================
// POST: Api/SysOperRecord/GetPageList
/// <summary>
/// <summary>
/// 获取列表
/// </summary>
/// <returns></returns>
@@ -75,7 +75,20 @@ namespace CoreCms.Net.Web.Admin.Controllers
Expression<Func<SysOperRecord, object>> orderEx = orderField switch
{
"id" => p => p.id,"userId" => p => p.userId,"userName" => p => p.userName,"model" => p => p.model,"description" => p => p.description,"url" => p => p.url,"requestMethod" => p => p.requestMethod,"operMethod" => p => p.operMethod,"param" => p => p.param,"result" => p => p.result,"ip" => p => p.ip,"spendTime" => p => p.spendTime,"state" => p => p.state,"createTime" => p => p.createTime,
"id" => p => p.id,
"userId" => p => p.userId,
"userName" => p => p.userName,
"model" => p => p.model,
"description" => p => p.description,
"url" => p => p.url,
"requestMethod" => p => p.requestMethod,
"operMethod" => p => p.operMethod,
"param" => p => p.param,
"result" => p => p.result,
"ip" => p => p.ip,
"spendTime" => p => p.spendTime,
"state" => p => p.state,
"createTime" => p => p.createTime,
_ => p => p.id
};
@@ -88,87 +101,87 @@ namespace CoreCms.Net.Web.Admin.Controllers
_ => OrderByType.Desc
};
//查询筛选
//主键 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
//主键 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0)
{
where = where.And(p => p.id == id);
}
//用户id int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
//用户id int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
if (userId > 0)
{
where = where.And(p => p.userId == userId);
}
//用户名 nvarchar
var userName = Request.Form["userName"].FirstOrDefault();
//用户名 nvarchar
var userName = Request.Form["userName"].FirstOrDefault();
if (!string.IsNullOrEmpty(userName))
{
where = where.And(p => p.userName.Contains(userName));
}
//操作模块 nvarchar
var model = Request.Form["model"].FirstOrDefault();
//操作模块 nvarchar
var model = Request.Form["model"].FirstOrDefault();
if (!string.IsNullOrEmpty(model))
{
where = where.And(p => p.model.Contains(model));
}
//操作方法 nvarchar
var description = Request.Form["description"].FirstOrDefault();
//操作方法 nvarchar
var description = Request.Form["description"].FirstOrDefault();
if (!string.IsNullOrEmpty(description))
{
where = where.And(p => p.description.Contains(description));
}
//请求地址 nvarchar
var url = Request.Form["url"].FirstOrDefault();
//请求地址 nvarchar
var url = Request.Form["url"].FirstOrDefault();
if (!string.IsNullOrEmpty(url))
{
where = where.And(p => p.url.Contains(url));
}
//请求方式 nvarchar
var requestMethod = Request.Form["requestMethod"].FirstOrDefault();
//请求方式 nvarchar
var requestMethod = Request.Form["requestMethod"].FirstOrDefault();
if (!string.IsNullOrEmpty(requestMethod))
{
where = where.And(p => p.requestMethod.Contains(requestMethod));
}
//调用方法 nvarchar
var operMethod = Request.Form["operMethod"].FirstOrDefault();
//调用方法 nvarchar
var operMethod = Request.Form["operMethod"].FirstOrDefault();
if (!string.IsNullOrEmpty(operMethod))
{
where = where.And(p => p.operMethod.Contains(operMethod));
}
//请求参数 nvarchar
var param = Request.Form["param"].FirstOrDefault();
//请求参数 nvarchar
var param = Request.Form["param"].FirstOrDefault();
if (!string.IsNullOrEmpty(param))
{
where = where.And(p => p.param.Contains(param));
}
//返回结果 nvarchar
var result = Request.Form["result"].FirstOrDefault();
//返回结果 nvarchar
var result = Request.Form["result"].FirstOrDefault();
if (!string.IsNullOrEmpty(result))
{
where = where.And(p => p.result.Contains(result));
}
//ip地址 nvarchar
var ip = Request.Form["ip"].FirstOrDefault();
//ip地址 nvarchar
var ip = Request.Form["ip"].FirstOrDefault();
if (!string.IsNullOrEmpty(ip))
{
where = where.And(p => p.ip.Contains(ip));
}
//请求耗时,单位毫秒 nvarchar
var spendTime = Request.Form["spendTime"].FirstOrDefault();
//请求耗时,单位毫秒 nvarchar
var spendTime = Request.Form["spendTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(spendTime))
{
where = where.And(p => p.spendTime.Contains(spendTime));
}
//状态,0成功,1异常 int
var state = Request.Form["state"].FirstOrDefault().ObjectToInt(0);
//状态,0成功,1异常 int
var state = Request.Form["state"].FirstOrDefault().ObjectToInt(0);
if (state > 0)
{
where = where.And(p => p.state == state);
}
//登录时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
//登录时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
if (createTime.Contains("到"))
@@ -186,7 +199,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
}
//获取数据
var list = await _sysOperRecordServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
var list = await _SysOperRecordServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
//返回数据
jm.data = list;
jm.code = 0;
@@ -212,22 +225,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
#region ============================================================
// POST: Api/SysOperRecord/GetCreate
/// <summary>
/// 创建数据
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("创建数据")]
public AdminUiCallBack GetCreate()
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
return jm;
}
#endregion
#region ============================================================
// POST: Api/SysOperRecord/GetDetails/10
/// <summary>
@@ -237,11 +234,11 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("预览数据")]
public async Task<AdminUiCallBack> GetDetails([FromBody]FMIntId entity)
public async Task<AdminUiCallBack> GetDetails([FromBody] FMIntId entity)
{
var jm = new AdminUiCallBack();
var model = await _sysOperRecordServices.QueryByIdAsync(entity.id, false);
var model = await _SysOperRecordServices.QueryByIdAsync(entity.id, false);
if (model == null)
{
jm.msg = "不存在此信息";
@@ -263,7 +260,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("选择导出")]
public async Task<AdminUiCallBack> SelectExportExcel([FromBody]FMArrayIntIds entity)
public async Task<AdminUiCallBack> SelectExportExcel([FromBody] FMArrayIntIds entity)
{
var jm = new AdminUiCallBack();
@@ -272,7 +269,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//添加一个sheet
var mySheet = book.CreateSheet("Sheet1");
//获取list数据
var listModel = await _sysOperRecordServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc, true);
var listModel = await _SysOperRecordServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc, true);
//给sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
@@ -355,61 +352,61 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var rowTemp = mySheet.CreateRow(i + 1);
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].userId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].userId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].userName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].userName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].model.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].model.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].description.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].description.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].url.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].url.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].requestMethod.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].requestMethod.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].operMethod.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].operMethod.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].param.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].param.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].result.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].result.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].ip.ToString());
rowTemp10.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].ip.ToString());
rowTemp10.CellStyle = commonCellStyle;
var rowTemp11 = rowTemp.CreateCell(11);
rowTemp11.SetCellValue(listModel[i].spendTime.ToString());
rowTemp11.CellStyle = commonCellStyle;
var rowTemp11 = rowTemp.CreateCell(11);
rowTemp11.SetCellValue(listModel[i].spendTime.ToString());
rowTemp11.CellStyle = commonCellStyle;
var rowTemp12 = rowTemp.CreateCell(12);
rowTemp12.SetCellValue(listModel[i].state.ToString());
rowTemp12.CellStyle = commonCellStyle;
var rowTemp12 = rowTemp.CreateCell(12);
rowTemp12.SetCellValue(listModel[i].state.ToString());
rowTemp12.CellStyle = commonCellStyle;
var rowTemp13 = rowTemp.CreateCell(13);
rowTemp13.SetCellValue(listModel[i].createTime.ToString());
rowTemp13.CellStyle = commonCellStyle;
var rowTemp13 = rowTemp.CreateCell(13);
rowTemp13.SetCellValue(listModel[i].createTime.ToString());
rowTemp13.CellStyle = commonCellStyle;
}
// 导出excel
@@ -447,88 +444,88 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack();
var where = PredicateBuilder.True<SysOperRecord>();
//查询筛选
//主键 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
//查询筛选
//主键 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0)
{
where = where.And(p => p.id == id);
}
//用户id int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
//用户id int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
if (userId > 0)
{
where = where.And(p => p.userId == userId);
}
//用户名 nvarchar
var userName = Request.Form["userName"].FirstOrDefault();
//用户名 nvarchar
var userName = Request.Form["userName"].FirstOrDefault();
if (!string.IsNullOrEmpty(userName))
{
where = where.And(p => p.userName.Contains(userName));
}
//操作模块 nvarchar
var model = Request.Form["model"].FirstOrDefault();
//操作模块 nvarchar
var model = Request.Form["model"].FirstOrDefault();
if (!string.IsNullOrEmpty(model))
{
where = where.And(p => p.model.Contains(model));
}
//操作方法 nvarchar
var description = Request.Form["description"].FirstOrDefault();
//操作方法 nvarchar
var description = Request.Form["description"].FirstOrDefault();
if (!string.IsNullOrEmpty(description))
{
where = where.And(p => p.description.Contains(description));
}
//请求地址 nvarchar
var url = Request.Form["url"].FirstOrDefault();
//请求地址 nvarchar
var url = Request.Form["url"].FirstOrDefault();
if (!string.IsNullOrEmpty(url))
{
where = where.And(p => p.url.Contains(url));
}
//请求方式 nvarchar
var requestMethod = Request.Form["requestMethod"].FirstOrDefault();
//请求方式 nvarchar
var requestMethod = Request.Form["requestMethod"].FirstOrDefault();
if (!string.IsNullOrEmpty(requestMethod))
{
where = where.And(p => p.requestMethod.Contains(requestMethod));
}
//调用方法 nvarchar
var operMethod = Request.Form["operMethod"].FirstOrDefault();
//调用方法 nvarchar
var operMethod = Request.Form["operMethod"].FirstOrDefault();
if (!string.IsNullOrEmpty(operMethod))
{
where = where.And(p => p.operMethod.Contains(operMethod));
}
//请求参数 nvarchar
var param = Request.Form["param"].FirstOrDefault();
//请求参数 nvarchar
var param = Request.Form["param"].FirstOrDefault();
if (!string.IsNullOrEmpty(param))
{
where = where.And(p => p.param.Contains(param));
}
//返回结果 nvarchar
var result = Request.Form["result"].FirstOrDefault();
//返回结果 nvarchar
var result = Request.Form["result"].FirstOrDefault();
if (!string.IsNullOrEmpty(result))
{
where = where.And(p => p.result.Contains(result));
}
//ip地址 nvarchar
var ip = Request.Form["ip"].FirstOrDefault();
//ip地址 nvarchar
var ip = Request.Form["ip"].FirstOrDefault();
if (!string.IsNullOrEmpty(ip))
{
where = where.And(p => p.ip.Contains(ip));
}
//请求耗时,单位毫秒 nvarchar
var spendTime = Request.Form["spendTime"].FirstOrDefault();
//请求耗时,单位毫秒 nvarchar
var spendTime = Request.Form["spendTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(spendTime))
{
where = where.And(p => p.spendTime.Contains(spendTime));
}
//状态,0成功,1异常 int
var state = Request.Form["state"].FirstOrDefault().ObjectToInt(0);
//状态,0成功,1异常 int
var state = Request.Form["state"].FirstOrDefault().ObjectToInt(0);
if (state > 0)
{
where = where.And(p => p.state == state);
}
//登录时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
//登录时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
var dt = createTime.ObjectToDate();
@@ -540,81 +537,81 @@ namespace CoreCms.Net.Web.Admin.Controllers
//添加一个sheet
var mySheet = book.CreateSheet("Sheet1");
//获取list数据
var listModel = await _sysOperRecordServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc, true);
var listModel = await _SysOperRecordServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc, true);
//给sheet1添加第一行的头部标题
var headerRow = mySheet.CreateRow(0);
var headerRow = mySheet.CreateRow(0);
var headerStyle = ExcelHelper.GetHeaderStyle(book);
var cell0 = headerRow.CreateCell(0);
cell0.SetCellValue("主键");
cell0.CellStyle = headerStyle;
mySheet.SetColumnWidth(0, 10 * 256);
var cell1 = headerRow.CreateCell(1);
cell1.SetCellValue("用户id");
cell1.CellStyle = headerStyle;
mySheet.SetColumnWidth(1, 10 * 256);
var cell2 = headerRow.CreateCell(2);
cell2.SetCellValue("用户名");
cell2.CellStyle = headerStyle;
mySheet.SetColumnWidth(2, 10 * 256);
var cell3 = headerRow.CreateCell(3);
cell3.SetCellValue("操作模块");
cell3.CellStyle = headerStyle;
mySheet.SetColumnWidth(3, 10 * 256);
var cell4 = headerRow.CreateCell(4);
cell4.SetCellValue("操作方法");
cell4.CellStyle = headerStyle;
mySheet.SetColumnWidth(4, 10 * 256);
var cell5 = headerRow.CreateCell(5);
cell5.SetCellValue("请求地址");
cell5.CellStyle = headerStyle;
mySheet.SetColumnWidth(5, 10 * 256);
var cell6 = headerRow.CreateCell(6);
cell6.SetCellValue("请求方式");
cell6.CellStyle = headerStyle;
mySheet.SetColumnWidth(6, 10 * 256);
var cell7 = headerRow.CreateCell(7);
cell7.SetCellValue("调用方法");
cell7.CellStyle = headerStyle;
mySheet.SetColumnWidth(7, 10 * 256);
var cell8 = headerRow.CreateCell(8);
cell8.SetCellValue("请求参数");
cell8.CellStyle = headerStyle;
mySheet.SetColumnWidth(8, 10 * 256);
var cell9 = headerRow.CreateCell(9);
cell9.SetCellValue("返回结果");
cell9.CellStyle = headerStyle;
mySheet.SetColumnWidth(9, 10 * 256);
var cell10 = headerRow.CreateCell(10);
cell10.SetCellValue("ip地址");
cell10.CellStyle = headerStyle;
mySheet.SetColumnWidth(10, 10 * 256);
var cell11 = headerRow.CreateCell(11);
cell11.SetCellValue("请求耗时,单位毫秒");
cell11.CellStyle = headerStyle;
mySheet.SetColumnWidth(11, 10 * 256);
var cell12 = headerRow.CreateCell(12);
cell12.SetCellValue("状态,0成功,1异常");
cell12.CellStyle = headerStyle;
mySheet.SetColumnWidth(12, 10 * 256);
var cell13 = headerRow.CreateCell(13);
cell13.SetCellValue("登录时间");
cell13.CellStyle = headerStyle;
mySheet.SetColumnWidth(13, 10 * 256);
headerRow.Height = 30 * 20;
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
@@ -625,87 +622,87 @@ namespace CoreCms.Net.Web.Admin.Controllers
var rowTemp = mySheet.CreateRow(i + 1);
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp0 = rowTemp.CreateCell(0);
rowTemp0.SetCellValue(listModel[i].id.ToString());
rowTemp0.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].userId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp1 = rowTemp.CreateCell(1);
rowTemp1.SetCellValue(listModel[i].userId.ToString());
rowTemp1.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].userName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp2 = rowTemp.CreateCell(2);
rowTemp2.SetCellValue(listModel[i].userName.ToString());
rowTemp2.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].model.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp3 = rowTemp.CreateCell(3);
rowTemp3.SetCellValue(listModel[i].model.ToString());
rowTemp3.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].description.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp4 = rowTemp.CreateCell(4);
rowTemp4.SetCellValue(listModel[i].description.ToString());
rowTemp4.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].url.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp5 = rowTemp.CreateCell(5);
rowTemp5.SetCellValue(listModel[i].url.ToString());
rowTemp5.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].requestMethod.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp6 = rowTemp.CreateCell(6);
rowTemp6.SetCellValue(listModel[i].requestMethod.ToString());
rowTemp6.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].operMethod.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp7 = rowTemp.CreateCell(7);
rowTemp7.SetCellValue(listModel[i].operMethod.ToString());
rowTemp7.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].param.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp8 = rowTemp.CreateCell(8);
rowTemp8.SetCellValue(listModel[i].param.ToString());
rowTemp8.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].result.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp9 = rowTemp.CreateCell(9);
rowTemp9.SetCellValue(listModel[i].result.ToString());
rowTemp9.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].ip.ToString());
rowTemp10.CellStyle = commonCellStyle;
var rowTemp10 = rowTemp.CreateCell(10);
rowTemp10.SetCellValue(listModel[i].ip.ToString());
rowTemp10.CellStyle = commonCellStyle;
var rowTemp11 = rowTemp.CreateCell(11);
rowTemp11.SetCellValue(listModel[i].spendTime.ToString());
rowTemp11.CellStyle = commonCellStyle;
var rowTemp11 = rowTemp.CreateCell(11);
rowTemp11.SetCellValue(listModel[i].spendTime.ToString());
rowTemp11.CellStyle = commonCellStyle;
var rowTemp12 = rowTemp.CreateCell(12);
rowTemp12.SetCellValue(listModel[i].state.ToString());
rowTemp12.CellStyle = commonCellStyle;
var rowTemp12 = rowTemp.CreateCell(12);
rowTemp12.SetCellValue(listModel[i].state.ToString());
rowTemp12.CellStyle = commonCellStyle;
var rowTemp13 = rowTemp.CreateCell(13);
rowTemp13.SetCellValue(listModel[i].createTime.ToString());
rowTemp13.CellStyle = commonCellStyle;
var rowTemp13 = rowTemp.CreateCell(13);
rowTemp13.SetCellValue(listModel[i].createTime.ToString());
rowTemp13.CellStyle = commonCellStyle;
}
@@ -731,7 +728,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
}
}

View File

@@ -19,10 +19,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;

View File

@@ -21,8 +21,8 @@ using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;

View File

@@ -536,5 +536,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
#endregion
}
}

View File

@@ -39,6 +39,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
[ApiController]
[RequiredErrorForAdmin]
[Authorize(Permissions.Name)]
//[Authorize(Permissions.Name)]
public class SysUserController : ControllerBase
{
private readonly ISysOrganizationServices _sysOrganizationServices;

View File

@@ -14,7 +14,6 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
@@ -28,6 +27,7 @@ using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Model.ViewModels.UI;
namespace CoreCms.Net.Web.Admin.Controllers
{

View File

@@ -265,7 +265,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var userGrade = await _coreCmsUserGradeServices.QueryAsync();
var userGrade = await _coreCmsUserGradeServices.QueryAsync(false, true);
jm.data = userGrade;
return jm;
@@ -308,7 +308,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
@@ -338,7 +337,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.code = 0;
var sexTypes = EnumHelper.EnumToList<GlobalEnumVars.UserSexTypes>();
var userStatus = EnumHelper.EnumToList<GlobalEnumVars.UserStatus>();
var userGrade = await _coreCmsUserGradeServices.QueryAsync();
var userGrade = await _coreCmsUserGradeServices.QueryAsync(false, true);
jm.data = new
{
@@ -994,7 +993,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
[Description("修改余额提交")]
public async Task<AdminUiCallBack> DoEditBalance([FromBody] FMUpdateUserBalance entity)
{
var jm = await _coreCmsUserServices.UpdateBalance(entity.id, entity.balance, entity.memo);
var jm = await _coreCmsUserServices.UpdateBalance(entity.id, entity.balance,entity.memo);
return jm;
}

View File

@@ -151,7 +151,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
where = where.And(p => p.prioritySortId == prioritySortId);
}
//获取数据
var list = await _coreCmsUserGradeServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
var list = await _coreCmsUserGradeServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, false, true);
//返回数据
jm.data = list;
jm.code = 0;
@@ -217,7 +217,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var jm = new AdminUiCallBack();
var id = await _coreCmsUserGradeServices.InsertAsync(entity);
var id = await _coreCmsUserGradeServices.InsertAsync(entity, true);
var bl = id > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
@@ -225,9 +225,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
//其他处理
if (bl && entity.isDefault)
{
Expression<Func<CoreCmsUserGrade, bool>> predicate = p => p.id != id;
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false },
predicate);
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false }, p => p.id != id);
}
return jm;
@@ -294,7 +292,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
//事物处理过程开始
oldModel.id = entity.id;
//oldModel.id = entity.id;
oldModel.title = entity.title;
oldModel.isDefault = entity.isDefault;
oldModel.isOpenUpgrade = entity.isOpenUpgrade;
@@ -304,16 +302,14 @@ namespace CoreCms.Net.Web.Admin.Controllers
oldModel.prioritySortId = entity.prioritySortId;
//事物处理过程结束
var bl = await _coreCmsUserGradeServices.UpdateAsync(oldModel);
var bl = await _coreCmsUserGradeServices.UpdateAsync(oldModel, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
//其他处理
if (bl && entity.isDefault)
{
Expression<Func<CoreCmsUserGrade, bool>> predicate = p => p.id != entity.id;
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false },
predicate);
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false }, p => p.id != entity.id);
}
return jm;
@@ -356,7 +352,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm;
}
var bl = await _coreCmsUserGradeServices.DeleteByIdAsync(entity.id);
var bl = await _coreCmsUserGradeServices.DeleteByIdAsync(entity.id, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
@@ -404,7 +400,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("设置是否默认")]
public async Task<AdminUiCallBack> DoSetisDefault([FromBody] FMUpdateBoolDataByIntId entity)
public async Task<AdminUiCallBack> DoSetIsDefault([FromBody] FMUpdateBoolDataByIntId entity)
{
var jm = new AdminUiCallBack();
@@ -427,16 +423,14 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
}
var bl = await _coreCmsUserGradeServices.UpdateAsync(oldModel);
var bl = await _coreCmsUserGradeServices.UpdateAsync(oldModel, true);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
//其他处理
if (bl && oldModel.isDefault)
{
Expression<Func<CoreCmsUserGrade, bool>> predicate = p => p.id != entity.id;
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false },
predicate);
await _coreCmsUserGradeServices.UpdateAsync(it => new CoreCmsUserGrade { isDefault = false }, p => p.id != entity.id);
}
return jm;
@@ -453,11 +447,11 @@ namespace CoreCms.Net.Web.Admin.Controllers
/// <returns></returns>
[HttpPost]
[Description("设置开启自动升级")]
public async Task<AdminUiCallBack> DoSetisOpenUpgrade([FromBody] FMUpdateBoolDataByIntId entity)
public async Task<AdminUiCallBack> DoSetIsOpenUpgrade([FromBody] FMUpdateBoolDataByIntId entity)
{
var jm = new AdminUiCallBack();
var oldModel = await _coreCmsUserGradeServices.QueryByIdAsync(entity.id, false);
var oldModel = await _coreCmsUserGradeServices.QueryByIdAsync(entity.id);
if (oldModel == null)
{
jm.msg = "不存在此信息";

View File

@@ -199,7 +199,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
}
//获取数据
var list = await _coreCmsUserTocashServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize);
var list = await _coreCmsUserTocashServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
//返回数据
jm.data = list;
jm.code = 0;

View File

@@ -4,10 +4,11 @@
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021/1/31 21:45:10
* CreateTime: 2021/7/15 14:44:18
* Description: 暂无
***********************************************************************/
using System;
using System.ComponentModel;
using System.IO;
@@ -15,13 +16,14 @@ using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
@@ -32,36 +34,33 @@ using SqlSugar;
namespace CoreCms.Net.Web.Admin.Controllers
{
/// <summary>
/// 用户表
/// </summary>
[Description("用户表")]
/// 微信用户
///</summary>
[Description("微信用户表")]
[Route("api/[controller]/[action]")]
[ApiController]
[RequiredErrorForAdmin]
[Authorize(Permissions.Name)]
public class CoreCmsUserWeChatInfoController : ControllerBase
{
private readonly ICoreCmsUserWeChatInfoServices _coreCmsUserWeChatInfoServices;
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly ICoreCmsUserWeChatInfoServices _coreCmsUserWeChatInfoServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="webHostEnvironment"></param>
/// <param name="coreCmsUserWeChatInfoServices"></param>
/// 构造函数
///</summary>
public CoreCmsUserWeChatInfoController(IWebHostEnvironment webHostEnvironment
, ICoreCmsUserWeChatInfoServices coreCmsUserWeChatInfoServices
)
)
{
_webHostEnvironment = webHostEnvironment;
_coreCmsUserWeChatInfoServices = coreCmsUserWeChatInfoServices;
}
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/GetPageList
/// <summary>
/// 获取列表
/// 获取列表
/// </summary>
/// <returns></returns>
[HttpPost]
@@ -74,64 +73,28 @@ namespace CoreCms.Net.Web.Admin.Controllers
var where = PredicateBuilder.True<CoreCmsUserWeChatInfo>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<CoreCmsUserWeChatInfo, object>> orderEx;
switch (orderField)
Expression<Func<CoreCmsUserWeChatInfo, object>> orderEx = orderField switch
{
case "id":
orderEx = p => p.id;
break;
case "type":
orderEx = p => p.type;
break;
case "userId":
orderEx = p => p.userId;
break;
case "openid":
orderEx = p => p.openid;
break;
case "sessionKey":
orderEx = p => p.sessionKey;
break;
case "unionId":
orderEx = p => p.unionId;
break;
case "avatar":
orderEx = p => p.avatar;
break;
case "nickName":
orderEx = p => p.nickName;
break;
case "gender":
orderEx = p => p.gender;
break;
case "language":
orderEx = p => p.language;
break;
case "city":
orderEx = p => p.city;
break;
case "province":
orderEx = p => p.province;
break;
case "country":
orderEx = p => p.country;
break;
case "countryCode":
orderEx = p => p.countryCode;
break;
case "mobile":
orderEx = p => p.mobile;
break;
case "createTime":
orderEx = p => p.createTime;
break;
case "updateTime":
orderEx = p => p.updateTime;
break;
default:
orderEx = p => p.id;
break;
}
"id" => p => p.id,
"type" => p => p.type,
"userId" => p => p.userId,
"openid" => p => p.openid,
"sessionKey" => p => p.sessionKey,
"unionId" => p => p.unionId,
"avatar" => p => p.avatar,
"nickName" => p => p.nickName,
"gender" => p => p.gender,
"language" => p => p.language,
"city" => p => p.city,
"province" => p => p.province,
"country" => p => p.country,
"countryCode" => p => p.countryCode,
"mobile" => p => p.mobile,
"createTime" => p => p.createTime,
"updateTime" => p => p.updateTime,
_ => p => p.id
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
@@ -145,49 +108,94 @@ namespace CoreCms.Net.Web.Admin.Controllers
//用户ID int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0) @where = @where.And(p => p.id == id);
if (id > 0)
{
where = where.And(p => p.id == id);
}
//第三方登录类型 int
var type = Request.Form["type"].FirstOrDefault().ObjectToInt(0);
if (type > 0) @where = @where.And(p => p.type == type);
if (type > 0)
{
where = where.And(p => p.type == type);
}
//关联用户表 int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
if (userId > 0) @where = @where.And(p => p.userId == userId);
if (userId > 0)
{
where = where.And(p => p.userId == userId);
}
//openId nvarchar
var openid = Request.Form["openid"].FirstOrDefault();
if (!string.IsNullOrEmpty(openid)) @where = @where.And(p => p.openid.Contains(openid));
if (!string.IsNullOrEmpty(openid))
{
where = where.And(p => p.openid.Contains(openid));
}
//缓存key nvarchar
var sessionKey = Request.Form["sessionKey"].FirstOrDefault();
if (!string.IsNullOrEmpty(sessionKey)) @where = @where.And(p => p.sessionKey.Contains(sessionKey));
if (!string.IsNullOrEmpty(sessionKey))
{
where = where.And(p => p.sessionKey.Contains(sessionKey));
}
//unionid nvarchar
var unionId = Request.Form["unionId"].FirstOrDefault();
if (!string.IsNullOrEmpty(unionId)) @where = @where.And(p => p.unionId.Contains(unionId));
if (!string.IsNullOrEmpty(unionId))
{
where = where.And(p => p.unionId.Contains(unionId));
}
//头像 nvarchar
var avatar = Request.Form["avatar"].FirstOrDefault();
if (!string.IsNullOrEmpty(avatar)) @where = @where.And(p => p.avatar.Contains(avatar));
if (!string.IsNullOrEmpty(avatar))
{
where = where.And(p => p.avatar.Contains(avatar));
}
//昵称 nvarchar
var nickName = Request.Form["nickName"].FirstOrDefault();
if (!string.IsNullOrEmpty(nickName)) @where = @where.And(p => p.nickName.Contains(nickName));
if (!string.IsNullOrEmpty(nickName))
{
where = where.And(p => p.nickName.Contains(nickName));
}
//性别 int
var gender = Request.Form["gender"].FirstOrDefault().ObjectToInt(0);
if (gender > 0) @where = @where.And(p => p.gender == gender);
if (gender > 0)
{
where = where.And(p => p.gender == gender);
}
//语言 nvarchar
var language = Request.Form["language"].FirstOrDefault();
if (!string.IsNullOrEmpty(language)) @where = @where.And(p => p.language.Contains(language));
if (!string.IsNullOrEmpty(language))
{
where = where.And(p => p.language.Contains(language));
}
//城市 nvarchar
var city = Request.Form["city"].FirstOrDefault();
if (!string.IsNullOrEmpty(city)) @where = @where.And(p => p.city.Contains(city));
if (!string.IsNullOrEmpty(city))
{
where = where.And(p => p.city.Contains(city));
}
//省 nvarchar
var province = Request.Form["province"].FirstOrDefault();
if (!string.IsNullOrEmpty(province)) @where = @where.And(p => p.province.Contains(province));
if (!string.IsNullOrEmpty(province))
{
where = where.And(p => p.province.Contains(province));
}
//国家 nvarchar
var country = Request.Form["country"].FirstOrDefault();
if (!string.IsNullOrEmpty(country)) @where = @where.And(p => p.country.Contains(country));
if (!string.IsNullOrEmpty(country))
{
where = where.And(p => p.country.Contains(country));
}
//手机号码国家编码 nvarchar
var countryCode = Request.Form["countryCode"].FirstOrDefault();
if (!string.IsNullOrEmpty(countryCode)) @where = @where.And(p => p.countryCode.Contains(countryCode));
if (!string.IsNullOrEmpty(countryCode))
{
where = where.And(p => p.countryCode.Contains(countryCode));
}
//手机号码 nvarchar
var mobile = Request.Form["mobile"].FirstOrDefault();
if (!string.IsNullOrEmpty(mobile)) @where = @where.And(p => p.mobile.Contains(mobile));
if (!string.IsNullOrEmpty(mobile))
{
where = where.And(p => p.mobile.Contains(mobile));
}
//创建时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
@@ -206,7 +214,6 @@ namespace CoreCms.Net.Web.Admin.Controllers
where = where.And(p => p.createTime > dt);
}
}
//更新时间 datetime
var updateTime = Request.Form["updateTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(updateTime))
@@ -225,10 +232,8 @@ namespace CoreCms.Net.Web.Admin.Controllers
where = where.And(p => p.updateTime > dt);
}
}
//获取数据
var list = await _coreCmsUserWeChatInfoServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent,
pageSize);
var list = await _coreCmsUserWeChatInfoServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
//返回数据
jm.data = list;
jm.code = 0;
@@ -236,14 +241,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.msg = "数据调用成功!";
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/GetIndex
/// <summary>
/// 首页数据
/// 首页数据
/// </summary>
/// <returns></returns>
[HttpPost]
@@ -254,187 +257,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
var jm = new AdminUiCallBack { code = 0 };
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/GetCreate
/// <summary>
/// 创建数据
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("创建数据")]
public AdminUiCallBack GetCreate()
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/DoCreate
/// <summary>
/// 创建提交
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("创建提交")]
public async Task<AdminUiCallBack> DoCreate([FromBody] CoreCmsUserWeChatInfo entity)
{
var jm = new AdminUiCallBack();
var bl = await _coreCmsUserWeChatInfoServices.InsertAsync(entity) > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/GetEdit
/// <summary>
/// 编辑数据
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("编辑数据")]
public async Task<AdminUiCallBack> GetEdit([FromBody] FMIntId entity)
{
var jm = new AdminUiCallBack();
var model = await _coreCmsUserWeChatInfoServices.QueryByIdAsync(entity.id);
if (model == null)
{
jm.msg = "不存在此信息";
return jm;
}
jm.code = 0;
jm.data = model;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/Edit
/// <summary>
/// 编辑提交
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("编辑提交")]
public async Task<AdminUiCallBack> DoEdit([FromBody] CoreCmsUserWeChatInfo entity)
{
var jm = new AdminUiCallBack();
var oldModel = await _coreCmsUserWeChatInfoServices.QueryByIdAsync(entity.id);
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.type = entity.type;
oldModel.userId = entity.userId;
oldModel.openid = entity.openid;
oldModel.sessionKey = entity.sessionKey;
oldModel.unionId = entity.unionId;
oldModel.avatar = entity.avatar;
oldModel.nickName = entity.nickName;
oldModel.gender = entity.gender;
oldModel.language = entity.language;
oldModel.city = entity.city;
oldModel.province = entity.province;
oldModel.country = entity.country;
oldModel.countryCode = entity.countryCode;
oldModel.mobile = entity.mobile;
oldModel.createTime = entity.createTime;
oldModel.updateTime = entity.updateTime;
//事物处理过程结束
var bl = await _coreCmsUserWeChatInfoServices.UpdateAsync(oldModel);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/DoDelete/10
/// <summary>
/// 单选删除
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("单选删除")]
public async Task<AdminUiCallBack> DoDelete([FromBody] FMIntId entity)
{
var jm = new AdminUiCallBack();
var model = await _coreCmsUserWeChatInfoServices.QueryByIdAsync(entity.id);
if (model == null)
{
jm.msg = GlobalConstVars.DataisNo;
return jm;
}
var bl = await _coreCmsUserWeChatInfoServices.DeleteByIdAsync(entity.id);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/DoBatchDelete/10,11,20
/// <summary>
/// 批量删除
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("批量删除")]
public async Task<AdminUiCallBack> DoBatchDelete([FromBody] FMArrayIntIds entity)
{
var jm = new AdminUiCallBack();
var bl = await _coreCmsUserWeChatInfoServices.DeleteByIdsAsync(entity.id);
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/GetDetails/10
/// <summary>
/// 预览数据
/// 预览数据
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
@@ -444,253 +272,18 @@ namespace CoreCms.Net.Web.Admin.Controllers
{
var jm = new AdminUiCallBack();
var model = await _coreCmsUserWeChatInfoServices.QueryByIdAsync(entity.id);
var model = await _coreCmsUserWeChatInfoServices.QueryByIdAsync(entity.id, false);
if (model == null)
{
jm.msg = "不存在此信息";
return jm;
}
jm.code = 0;
jm.data = model;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/SelectExportExcel/10
/// <summary>
/// 选择导出
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("选择导出")]
public async Task<AdminUiCallBack> SelectExportExcel([FromBody] FMArrayIntIds entity)
{
var jm = new AdminUiCallBack();
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsUserWeChatInfoServices.QueryListByClauseAsync(p => entity.id.Contains(p.id),
p => p.id, OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("用户ID");
row1.CreateCell(1).SetCellValue("第三方登录类型");
row1.CreateCell(2).SetCellValue("关联用户表");
row1.CreateCell(3).SetCellValue("openId");
row1.CreateCell(4).SetCellValue("缓存key");
row1.CreateCell(5).SetCellValue("unionid");
row1.CreateCell(6).SetCellValue("头像");
row1.CreateCell(7).SetCellValue("昵称");
row1.CreateCell(8).SetCellValue("性别");
row1.CreateCell(9).SetCellValue("语言");
row1.CreateCell(10).SetCellValue("城市");
row1.CreateCell(11).SetCellValue("省");
row1.CreateCell(12).SetCellValue("国家");
row1.CreateCell(13).SetCellValue("手机号码国家编码");
row1.CreateCell(14).SetCellValue("手机号码");
row1.CreateCell(15).SetCellValue("创建时间");
row1.CreateCell(16).SetCellValue("更新时间");
//将数据逐步写入sheet1各个行
for (var i = 0; i < listmodel.Count; i++)
{
var rowtemp = sheet1.CreateRow(i + 1);
rowtemp.CreateCell(0).SetCellValue(listmodel[i].id.ToString());
rowtemp.CreateCell(1).SetCellValue(listmodel[i].type.ToString());
rowtemp.CreateCell(2).SetCellValue(listmodel[i].userId.ToString());
rowtemp.CreateCell(3).SetCellValue(listmodel[i].openid);
rowtemp.CreateCell(4).SetCellValue(listmodel[i].sessionKey);
rowtemp.CreateCell(5).SetCellValue(listmodel[i].unionId);
rowtemp.CreateCell(6).SetCellValue(listmodel[i].avatar);
rowtemp.CreateCell(7).SetCellValue(listmodel[i].nickName);
rowtemp.CreateCell(8).SetCellValue(listmodel[i].gender.ToString());
rowtemp.CreateCell(9).SetCellValue(listmodel[i].language);
rowtemp.CreateCell(10).SetCellValue(listmodel[i].city);
rowtemp.CreateCell(11).SetCellValue(listmodel[i].province);
rowtemp.CreateCell(12).SetCellValue(listmodel[i].country);
rowtemp.CreateCell(13).SetCellValue(listmodel[i].countryCode);
rowtemp.CreateCell(14).SetCellValue(listmodel[i].mobile);
rowtemp.CreateCell(15).SetCellValue(listmodel[i].createTime.ToString());
rowtemp.CreateCell(16).SetCellValue(listmodel[i].updateTime.ToString());
}
// 导出excel
var webRootPath = _webHostEnvironment.WebRootPath;
var tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
var fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsUserWeChatInfo导出(选择结果).xls";
var filePath = webRootPath + tpath;
var di = new DirectoryInfo(filePath);
if (!di.Exists) di.Create();
var fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsUserWeChatInfo/QueryExportExcel/10
/// <summary>
/// 查询导出
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("查询导出")]
public async Task<AdminUiCallBack> QueryExportExcel()
{
var jm = new AdminUiCallBack();
var where = PredicateBuilder.True<CoreCmsUserWeChatInfo>();
//查询筛选
//用户ID int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0) @where = @where.And(p => p.id == id);
//第三方登录类型 int
var type = Request.Form["type"].FirstOrDefault().ObjectToInt(0);
if (type > 0) @where = @where.And(p => p.type == type);
//关联用户表 int
var userId = Request.Form["userId"].FirstOrDefault().ObjectToInt(0);
if (userId > 0) @where = @where.And(p => p.userId == userId);
//openId nvarchar
var openid = Request.Form["openid"].FirstOrDefault();
if (!string.IsNullOrEmpty(openid)) @where = @where.And(p => p.openid.Contains(openid));
//缓存key nvarchar
var sessionKey = Request.Form["sessionKey"].FirstOrDefault();
if (!string.IsNullOrEmpty(sessionKey)) @where = @where.And(p => p.sessionKey.Contains(sessionKey));
//unionid nvarchar
var unionId = Request.Form["unionId"].FirstOrDefault();
if (!string.IsNullOrEmpty(unionId)) @where = @where.And(p => p.unionId.Contains(unionId));
//头像 nvarchar
var avatar = Request.Form["avatar"].FirstOrDefault();
if (!string.IsNullOrEmpty(avatar)) @where = @where.And(p => p.avatar.Contains(avatar));
//昵称 nvarchar
var nickName = Request.Form["nickName"].FirstOrDefault();
if (!string.IsNullOrEmpty(nickName)) @where = @where.And(p => p.nickName.Contains(nickName));
//性别 int
var gender = Request.Form["gender"].FirstOrDefault().ObjectToInt(0);
if (gender > 0) @where = @where.And(p => p.gender == gender);
//语言 nvarchar
var language = Request.Form["language"].FirstOrDefault();
if (!string.IsNullOrEmpty(language)) @where = @where.And(p => p.language.Contains(language));
//城市 nvarchar
var city = Request.Form["city"].FirstOrDefault();
if (!string.IsNullOrEmpty(city)) @where = @where.And(p => p.city.Contains(city));
//省 nvarchar
var province = Request.Form["province"].FirstOrDefault();
if (!string.IsNullOrEmpty(province)) @where = @where.And(p => p.province.Contains(province));
//国家 nvarchar
var country = Request.Form["country"].FirstOrDefault();
if (!string.IsNullOrEmpty(country)) @where = @where.And(p => p.country.Contains(country));
//手机号码国家编码 nvarchar
var countryCode = Request.Form["countryCode"].FirstOrDefault();
if (!string.IsNullOrEmpty(countryCode)) @where = @where.And(p => p.countryCode.Contains(countryCode));
//手机号码 nvarchar
var mobile = Request.Form["mobile"].FirstOrDefault();
if (!string.IsNullOrEmpty(mobile)) @where = @where.And(p => p.mobile.Contains(mobile));
//创建时间 datetime
var createTime = Request.Form["createTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(createTime))
{
var dt = createTime.ObjectToDate();
where = where.And(p => p.createTime > dt);
}
//更新时间 datetime
var updateTime = Request.Form["updateTime"].FirstOrDefault();
if (!string.IsNullOrEmpty(updateTime))
{
var dt = updateTime.ObjectToDate();
where = where.And(p => p.updateTime > dt);
}
//获取数据
//创建Excel文件的对象
var book = new HSSFWorkbook();
//添加一个sheet
var sheet1 = book.CreateSheet("Sheet1");
//获取list数据
var listmodel =
await _coreCmsUserWeChatInfoServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc);
//给sheet1添加第一行的头部标题
var row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue("用户ID");
row1.CreateCell(1).SetCellValue("第三方登录类型");
row1.CreateCell(2).SetCellValue("关联用户表");
row1.CreateCell(3).SetCellValue("openId");
row1.CreateCell(4).SetCellValue("缓存key");
row1.CreateCell(5).SetCellValue("unionid");
row1.CreateCell(6).SetCellValue("头像");
row1.CreateCell(7).SetCellValue("昵称");
row1.CreateCell(8).SetCellValue("性别");
row1.CreateCell(9).SetCellValue("语言");
row1.CreateCell(10).SetCellValue("城市");
row1.CreateCell(11).SetCellValue("省");
row1.CreateCell(12).SetCellValue("国家");
row1.CreateCell(13).SetCellValue("手机号码国家编码");
row1.CreateCell(14).SetCellValue("手机号码");
row1.CreateCell(15).SetCellValue("创建时间");
row1.CreateCell(16).SetCellValue("更新时间");
//将数据逐步写入sheet1各个行
for (var i = 0; i < listmodel.Count; i++)
{
var rowtemp = sheet1.CreateRow(i + 1);
rowtemp.CreateCell(0).SetCellValue(listmodel[i].id.ToString());
rowtemp.CreateCell(1).SetCellValue(listmodel[i].type.ToString());
rowtemp.CreateCell(2).SetCellValue(listmodel[i].userId.ToString());
rowtemp.CreateCell(3).SetCellValue(listmodel[i].openid);
rowtemp.CreateCell(4).SetCellValue(listmodel[i].sessionKey);
rowtemp.CreateCell(5).SetCellValue(listmodel[i].unionId);
rowtemp.CreateCell(6).SetCellValue(listmodel[i].avatar);
rowtemp.CreateCell(7).SetCellValue(listmodel[i].nickName);
rowtemp.CreateCell(8).SetCellValue(listmodel[i].gender.ToString());
rowtemp.CreateCell(9).SetCellValue(listmodel[i].language);
rowtemp.CreateCell(10).SetCellValue(listmodel[i].city);
rowtemp.CreateCell(11).SetCellValue(listmodel[i].province);
rowtemp.CreateCell(12).SetCellValue(listmodel[i].country);
rowtemp.CreateCell(13).SetCellValue(listmodel[i].countryCode);
rowtemp.CreateCell(14).SetCellValue(listmodel[i].mobile);
rowtemp.CreateCell(15).SetCellValue(listmodel[i].createTime.ToString());
rowtemp.CreateCell(16).SetCellValue(listmodel[i].updateTime.ToString());
}
// 写入到excel
var webRootPath = _webHostEnvironment.WebRootPath;
var tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
var fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-CoreCmsUserWeChatInfo导出(查询结果).xls";
var filePath = webRootPath + tpath;
var di = new DirectoryInfo(filePath);
if (!di.Exists) di.Create();
var fileHssf = new FileStream(filePath + fileName, FileMode.Create);
book.Write(fileHssf);
fileHssf.Close();
jm.code = 0;
jm.msg = GlobalConstVars.ExcelExportSuccess;
jm.data = tpath + fileName;
return jm;
}
#endregion
}
}
}

View File

@@ -19,10 +19,10 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;