General.Web/Controllers/Admin/SystemConfigController.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using General.Entities.Models;
using General.Entities.ViewData.SystemConfig;
using General.Framework;
using General.Mvc.Filters;
using General.Services.SystemConfig;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace General.Mvc.Controllers.Admin
{
    [Route("api/admin/[controller]/[action]")]
    [ApiController]
    [ServiceFilter(typeof(ResponseLogTimeFilter))]
    public class SystemConfigController : Controller
    {
        private readonly ISystemConfigService systemConfigService;

        public SystemConfigController(ISystemConfigService systemConfigService)
        {
            this.systemConfigService = systemConfigService;
        }

        #region 系统设置
        /// <summary>
        /// 添加系统配置信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ServiceFilter(typeof(AdminCheckFilter))]
        public async Task<IActionResult> AddSystemConfig([FromForm] tc_sysconfig sysconfig)
        {
            AjaxResult result = new AjaxResult();
            var isExist = await systemConfigService.GetConfigInfoByCode(sysconfig.code);
            if (isExist != null)
            {
                return Content(result.Error("添加失败!已存在此配置标识!"));
            }
            var res = await systemConfigService.AddConfigData(sysconfig);
            if (res > 0)
            {
                return Content(result.Ok("添加成功"));
            }
            return Content(result.Error("添加失败"));
        }

        /// <summary>
        /// 编辑系统配置信息
        /// </summary>
        /// <param name="tid"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        [HttpPost]
        [ServiceFilter(typeof(AdminCheckFilter))]
        public async Task<IActionResult> EditSystemConfig([FromForm] int tid, [FromForm] string data)
        {
            AjaxResult result = new AjaxResult();
后面还有 8 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。