Commit 04f72823 authored by 黄奎's avatar 黄奎

代码优化

parent 6f5391ba
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Edu.Common.API;
using Edu.Common.Plugin;
using Edu.Model.CacheModel;
......@@ -10,7 +9,6 @@ using Edu.Model.ViewModel.Grade;
using Edu.Module.System;
using Edu.WebApi.Filter;
using Microsoft.AspNetCore.Cors;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
......@@ -44,7 +42,6 @@ namespace Edu.WebApi.Controllers.Public
public ApiResult SetHoliday()
{
UserInfo userInfo = base.UserInfo;
var startDate = base.ParmJObj.GetStringValue("StartTime");
var endDate = base.ParmJObj.GetStringValue("EndTime");
......@@ -72,9 +69,6 @@ namespace Edu.WebApi.Controllers.Public
{
return ApiResult.Failed("节假日时间范围重合");
}
if (dmodel.HolidayId == 0)
{
dmodel.CreateDate = System.DateTime.Now;
......@@ -203,15 +197,10 @@ namespace Edu.WebApi.Controllers.Public
}
else
{
return ApiResult.Failed("请求失败,数据不存在!");
}
}
/// <summary>
/// 批量新增节假日
/// </summary>
......@@ -226,9 +215,7 @@ namespace Edu.WebApi.Controllers.Public
// JObject parmsHoliday = JObject.Parse(holidayList);
try
{
JObject jsonObject = JObject.Parse(holidayList);
foreach (var item in jsonObject.Children())
{
var test1 = item.Children();// JsonConvert.DeserializeObject<test>();
......@@ -237,7 +224,6 @@ namespace Edu.WebApi.Controllers.Public
var test = item1.ToObject<test>();
RB_System_Holiday dmodel = new RB_System_Holiday
{
StartTime = Convert.ToDateTime(test.date),
EndTime = Convert.ToDateTime(test.date)
};
......@@ -253,7 +239,6 @@ namespace Edu.WebApi.Controllers.Public
dmodel.Status = 0;
dmodel.Group_Id = 100000;
dmodel.School_Id = 0;
bool flag = holidayModule.SetHoliday(dmodel);
}
}
......@@ -261,29 +246,16 @@ namespace Edu.WebApi.Controllers.Public
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "InsertHoliday");
return ApiResult.Failed("转换失败");
}
}
#endregion
}
public class holiday
{
// public string info { get; set; }
public test info { get; set; }
}
public class test
{
public bool holiday { get; set; }
public string date { get; set; }
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment