mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2026-03-23 12:17:21 +08:00
添加项目文件。
This commit is contained in:
@@ -0,0 +1,271 @@
|
||||
/***********************************************************************
|
||||
* 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.ComponentModel;
|
||||
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.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息配置表
|
||||
/// </summary>
|
||||
[Description("消息配置表")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class CoreCmsMessageCenterController : ControllerBase
|
||||
{
|
||||
private readonly ICoreCmsMessageCenterServices _coreCmsMessageCenterServices;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="webHostEnvironment"></param>
|
||||
/// <param name="coreCmsMessageCenterServices"></param>
|
||||
public CoreCmsMessageCenterController(IWebHostEnvironment webHostEnvironment
|
||||
, ICoreCmsMessageCenterServices coreCmsMessageCenterServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsMessageCenterServices = coreCmsMessageCenterServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
|
||||
// POST: Api/CoreCmsMessageCenter/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<CoreCmsMessageCenter>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
Expression<Func<CoreCmsMessageCenter, object>> orderEx;
|
||||
switch (orderField)
|
||||
{
|
||||
case "id":
|
||||
orderEx = p => p.id;
|
||||
break;
|
||||
case "code":
|
||||
orderEx = p => p.code;
|
||||
break;
|
||||
case "isSms":
|
||||
orderEx = p => p.isSms;
|
||||
break;
|
||||
case "isMessage":
|
||||
orderEx = p => p.isMessage;
|
||||
break;
|
||||
case "isWxTempletMessage":
|
||||
orderEx = p => p.isWxTempletMessage;
|
||||
break;
|
||||
default:
|
||||
orderEx = p => p.id;
|
||||
break;
|
||||
}
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//序列 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0) @where = @where.And(p => p.id == id);
|
||||
//编码 nvarchar
|
||||
var code = Request.Form["code"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(code)) @where = @where.And(p => p.code.Contains(code));
|
||||
//启用短信 bit
|
||||
var isSms = Request.Form["isSms"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isSms) && isSms.ToLowerInvariant() == "true")
|
||||
@where = @where.And(p => p.isSms);
|
||||
else if (!string.IsNullOrEmpty(isSms) && isSms.ToLowerInvariant() == "false")
|
||||
@where = @where.And(p => p.isSms == false);
|
||||
//启用站内消息 bit
|
||||
var isMessage = Request.Form["isMessage"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isMessage) && isMessage.ToLowerInvariant() == "true")
|
||||
@where = @where.And(p => p.isMessage);
|
||||
else if (!string.IsNullOrEmpty(isMessage) && isMessage.ToLowerInvariant() == "false")
|
||||
@where = @where.And(p => p.isMessage == false);
|
||||
//启用微信模板消息 bit
|
||||
var isWxTempletMessage = Request.Form["isWxTempletMessage"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isWxTempletMessage) && isWxTempletMessage.ToLowerInvariant() == "true")
|
||||
@where = @where.And(p => p.isWxTempletMessage);
|
||||
else if (!string.IsNullOrEmpty(isWxTempletMessage) && isWxTempletMessage.ToLowerInvariant() == "false")
|
||||
@where = @where.And(p => p.isWxTempletMessage == false);
|
||||
//获取数据
|
||||
var list = await _coreCmsMessageCenterServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent,
|
||||
pageSize);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
|
||||
// POST: Api/CoreCmsMessageCenter/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var platformMessageTypes = EnumHelper.EnumToList<GlobalEnumVars.PlatformMessageTypes>();
|
||||
jm.data = new
|
||||
{
|
||||
platformMessageTypes
|
||||
};
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设置启用短信============================================================
|
||||
|
||||
// POST: Api/CoreCmsMessageCenter/DoSetisSms/10
|
||||
/// <summary>
|
||||
/// 设置启用短信
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置启用短信")]
|
||||
public async Task<AdminUiCallBack> DoSetisSms([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsMessageCenterServices.QueryByIdAsync(entity.id);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
oldModel.isSms = entity.data;
|
||||
|
||||
var bl = await _coreCmsMessageCenterServices.UpdateAsync(oldModel);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设置启用站内消息============================================================
|
||||
|
||||
// POST: Api/CoreCmsMessageCenter/DoSetisMessage/10
|
||||
/// <summary>
|
||||
/// 设置启用站内消息
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置启用站内消息")]
|
||||
public async Task<AdminUiCallBack> DoSetisMessage([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsMessageCenterServices.QueryByIdAsync(entity.id);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
oldModel.isMessage = entity.data;
|
||||
|
||||
var bl = await _coreCmsMessageCenterServices.UpdateAsync(oldModel);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 设置启用微信模板消息============================================================
|
||||
|
||||
// POST: Api/CoreCmsMessageCenter/DoSetisWxTempletMessage/10
|
||||
/// <summary>
|
||||
/// 设置启用微信模板消息
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("设置启用微信模板消息")]
|
||||
public async Task<AdminUiCallBack> DoSetisWxTempletMessage([FromBody] FMUpdateBoolDataByIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await _coreCmsMessageCenterServices.QueryByIdAsync(entity.id);
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
|
||||
oldModel.isWxTempletMessage = entity.data;
|
||||
|
||||
var bl = await _coreCmsMessageCenterServices.UpdateAsync(oldModel);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,251 @@
|
||||
/***********************************************************************
|
||||
* 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.ComponentModel;
|
||||
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.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信发送日志
|
||||
/// </summary>
|
||||
[Description("短信发送日志")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class CoreCmsSmsController : ControllerBase
|
||||
{
|
||||
private readonly ICoreCmsSmsServices _coreCmsSmsServices;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="webHostEnvironment"></param>
|
||||
/// <param name="coreCmsSmsServices"></param>
|
||||
public CoreCmsSmsController(IWebHostEnvironment webHostEnvironment, ICoreCmsSmsServices coreCmsSmsServices)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsSmsServices = coreCmsSmsServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
|
||||
// POST: Api/CoreCmsSms/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<CoreCmsSms>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
Expression<Func<CoreCmsSms, object>> orderEx;
|
||||
switch (orderField)
|
||||
{
|
||||
case "id":
|
||||
orderEx = p => p.id;
|
||||
break;
|
||||
case "mobile":
|
||||
orderEx = p => p.mobile;
|
||||
break;
|
||||
case "code":
|
||||
orderEx = p => p.code;
|
||||
break;
|
||||
case "parameters":
|
||||
orderEx = p => p.parameters;
|
||||
break;
|
||||
case "contentBody":
|
||||
orderEx = p => p.contentBody;
|
||||
break;
|
||||
case "ip":
|
||||
orderEx = p => p.ip;
|
||||
break;
|
||||
case "isUsed":
|
||||
orderEx = p => p.isUsed;
|
||||
break;
|
||||
case "createTime":
|
||||
orderEx = p => p.createTime;
|
||||
break;
|
||||
default:
|
||||
orderEx = p => p.id;
|
||||
break;
|
||||
}
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//序列 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0) @where = @where.And(p => p.id == id);
|
||||
//手机号码 nvarchar
|
||||
var mobile = Request.Form["mobile"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(mobile)) @where = @where.And(p => p.mobile.Contains(mobile));
|
||||
//发送编码 nvarchar
|
||||
var code = Request.Form["code"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(code)) @where = @where.And(p => p.code.Contains(code));
|
||||
//参数 nvarchar
|
||||
var parameters = Request.Form["parameters"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(parameters)) @where = @where.And(p => p.parameters.Contains(parameters));
|
||||
//内容 nvarchar
|
||||
var contentBody = Request.Form["contentBody"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(contentBody)) @where = @where.And(p => p.contentBody.Contains(contentBody));
|
||||
//ip nvarchar
|
||||
var ip = Request.Form["ip"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(ip)) @where = @where.And(p => p.ip.Contains(ip));
|
||||
//是否使用 bit
|
||||
var isUsed = Request.Form["isUsed"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(isUsed) && isUsed.ToLowerInvariant() == "true")
|
||||
@where = @where.And(p => p.isUsed);
|
||||
else if (!string.IsNullOrEmpty(isUsed) && isUsed.ToLowerInvariant() == "false")
|
||||
@where = @where.And(p => p.isUsed == false);
|
||||
//创建时间 datetime
|
||||
var createTime = Request.Form["createTime"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(createTime))
|
||||
{
|
||||
if (createTime.Contains("到"))
|
||||
{
|
||||
var dts = createTime.Split("到");
|
||||
var dtStart = dts[0].Trim().ObjectToDate();
|
||||
where = where.And(p => p.createTime > dtStart);
|
||||
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||
where = where.And(p => p.createTime < dtEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = createTime.ObjectToDate();
|
||||
where = where.And(p => p.createTime > dt);
|
||||
}
|
||||
}
|
||||
|
||||
//获取数据
|
||||
var list = await _coreCmsSmsServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
|
||||
// POST: Api/CoreCmsSms/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
|
||||
var smsMessageTypes = EnumHelper.EnumToList<GlobalEnumVars.SmsMessageTypes>();
|
||||
var platformMessageTypes = EnumHelper.EnumToList<GlobalEnumVars.PlatformMessageTypes>();
|
||||
jm.data = new
|
||||
{
|
||||
smsMessageTypes,
|
||||
platformMessageTypes
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 删除数据============================================================
|
||||
|
||||
// POST: Api/CoreCmsSms/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 _coreCmsSmsServices.QueryByIdAsync(entity.id);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = GlobalConstVars.DataisNo;
|
||||
return jm;
|
||||
}
|
||||
|
||||
var bl = await _coreCmsSmsServices.DeleteByIdAsync(entity.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
return jm;
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 批量删除============================================================
|
||||
|
||||
// POST: Api/CoreCmsSms/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 _coreCmsSmsServices.DeleteByIdsAsync(entity.id);
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
/***********************************************************************
|
||||
* 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.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
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.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 短信配置表
|
||||
///</summary>
|
||||
[Description("短信配置表")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize(Permissions.Name)]
|
||||
public class CoreCmsSmsSettingController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly ICoreCmsSettingServices _coreCmsSettingServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
/// <param name="webHostEnvironment"></param>
|
||||
///<param name="coreCmsSettingServices"></param>
|
||||
public CoreCmsSmsSettingController(IWebHostEnvironment webHostEnvironment, ICoreCmsSettingServices coreCmsSettingServices)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_coreCmsSettingServices = coreCmsSettingServices;
|
||||
}
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/CoreCmsSetting/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public async Task<AdminUiCallBack> GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
var configs = await _coreCmsSettingServices.GetConfigDictionaries();
|
||||
var filesStorageOptionsType = EnumHelper.EnumToList<GlobalEnumVars.FilesStorageOptionsType>();
|
||||
|
||||
jm.data = new
|
||||
{
|
||||
configs,
|
||||
filesStorageOptionsType
|
||||
};
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 保存提交============================================================
|
||||
// POST: Api/CoreCmsSetting/DoSave
|
||||
/// <summary>
|
||||
/// 保存提交
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("保存提交")]
|
||||
public async Task<AdminUiCallBack> DoSave([FromBody] FMCoreCmsSettingDoSaveModel model)
|
||||
{
|
||||
var jm = await _coreCmsSettingServices.UpdateAsync(model);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user