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

代码优化

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