Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
04f72823
Commit
04f72823
authored
Sep 10, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
6f5391ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
29 deletions
+1
-29
HolidayController.cs
Edu.WebApi/Controllers/Public/HolidayController.cs
+1
-29
No files found.
Edu.WebApi/Controllers/Public/HolidayController.cs
View file @
04f72823
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
;
}
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment