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
ad3d08e8
Commit
ad3d08e8
authored
Apr 08, 2021
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
官网接口修改
parent
208282f1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
128 additions
and
7 deletions
+128
-7
RB_Course_ViewModel.cs
Edu.Model/ViewModel/Course/RB_Course_ViewModel.cs
+10
-0
RB_CourseRepository.cs
Edu.Repository/Course/RB_CourseRepository.cs
+5
-0
RB_Web_MenuRepository.cs
Edu.Repository/Web/RB_Web_MenuRepository.cs
+1
-1
RB_Web_NavRepository.cs
Edu.Repository/Web/RB_Web_NavRepository.cs
+1
-1
RB_Web_NewsRepository.cs
Edu.Repository/Web/RB_Web_NewsRepository.cs
+1
-1
RB_Web_NewsTypeRepository.cs
Edu.Repository/Web/RB_Web_NewsTypeRepository.cs
+1
-1
WebController.cs
Edu.WebApi/Controllers/Web/WebController.cs
+109
-3
No files found.
Edu.Model/ViewModel/Course/RB_Course_ViewModel.cs
View file @
ad3d08e8
...
...
@@ -130,5 +130,15 @@ namespace Edu.Model.ViewModel.Course
return
list
;
}
}
/// <summary>
/// 是否取随机条数
/// </summary>
public
bool
IsRand
{
get
;
set
;
}
/// <summary>
/// 随机条数
/// </summary>
public
int
RandNum
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Repository/Course/RB_CourseRepository.cs
View file @
ad3d08e8
...
...
@@ -43,6 +43,11 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Course_ViewModel
.
CourseId
),
query
.
QCourseIds
);
}
//取随机前几条
if
(
query
.
IsRand
&&
query
.
RandNum
>
0
&&
query
.
CourseId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}<>{1} ORDER BY RAND() LIMIT {2} "
,
nameof
(
RB_Course_ViewModel
.
CourseId
),
query
.
CourseId
,
query
.
RandNum
);
}
}
return
Get
<
RB_Course_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
...
...
Edu.Repository/Web/RB_Web_MenuRepository.cs
View file @
ad3d08e8
...
...
@@ -48,7 +48,7 @@ WHERE 1=1
parameters
.
Add
(
"Name"
,
"%"
+
query
.
Name
.
Trim
()
+
"%"
);
}
if
(
query
.
Status
>
0
)
if
(
query
.
Status
>
=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Web_Menu_ViewModel
.
Status
),
(
int
)
query
.
Status
);
}
...
...
Edu.Repository/Web/RB_Web_NavRepository.cs
View file @
ad3d08e8
...
...
@@ -56,7 +56,7 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Web_Nav_ViewModel
.
NavType
),
(
int
)
query
.
NavType
);
}
if
(
query
.
Status
>
0
)
if
(
query
.
Status
>
=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Web_Nav_ViewModel
.
Status
),
(
int
)
query
.
Status
);
}
...
...
Edu.Repository/Web/RB_Web_NewsRepository.cs
View file @
ad3d08e8
...
...
@@ -48,7 +48,7 @@ WHERE 1=1
builder
.
AppendFormat
(
" AND A.{0} LIKE @Title "
,
nameof
(
RB_Web_News_ViewModel
.
Title
));
parameters
.
Add
(
"Title"
,
"%"
+
query
.
Title
.
Trim
()
+
"%"
);
}
if
(
query
.
Status
>
0
)
if
(
query
.
Status
>
=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Web_Nav_ViewModel
.
Status
),
(
int
)
query
.
Status
);
}
...
...
Edu.Repository/Web/RB_Web_NewsTypeRepository.cs
View file @
ad3d08e8
...
...
@@ -43,7 +43,7 @@ WHERE 1=1
builder
.
AppendFormat
(
" AND A.{0} LIKE @TypeName "
,
nameof
(
RB_Web_NewsType_ViewModel
.
TypeName
));
parameters
.
Add
(
"TypeName"
,
"%"
+
query
.
TypeName
.
Trim
()
+
"%"
);
}
if
(
query
.
Status
>
0
)
if
(
query
.
Status
>
=
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Web_NewsType_ViewModel
.
Status
),
(
int
)
query
.
Status
);
}
...
...
Edu.WebApi/Controllers/Web/WebController.cs
View file @
ad3d08e8
using
Edu.AOP
;
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Web
;
...
...
@@ -138,9 +139,9 @@ namespace Edu.WebApi.Controllers.Web
{
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
TypeId
=
base
.
ParmJObj
.
GetInt
(
"TypeId"
),
Status
=
DateStateEnum
.
Normal
,
Group_Id
=
base
.
ParmJObj
.
GetInt
(
"Group_Id"
)
};
query
.
Status
=
DateStateEnum
.
Normal
;
if
(
query
.
Group_Id
<=
0
)
{
string
Domain
=
base
.
ParmJObj
.
GetStringValue
(
"Domain"
);
...
...
@@ -148,11 +149,60 @@ namespace Edu.WebApi.Controllers.Web
query
.
Group_Id
=
groupId
;
}
var
list
=
newsModule
.
GetWebNewsPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
resultList
=
new
List
<
object
>();
foreach
(
var
item
in
list
)
{
string
CreateByName
=
"甲鹤教育"
;
if
(
item
.
CreateBy
>
0
)
{
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
CreateBy
)?.
AccountName
??
""
;
}
resultList
.
Add
(
new
{
item
.
Id
,
item
.
Title
,
item
.
Content
,
item
.
Img
,
CreateByName
,
CreateTime
=
Common
.
Plugin
.
StringHelper
.
DateFormatToString
(
item
.
CreateDate
)
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
l
ist
;
pageModel
.
PageData
=
resultL
ist
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取网站新闻详情
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetWebNews
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
,
0
);
var
extModel
=
newsModule
.
GetWebNewsModule
(
Id
);
object
obj
=
new
object
();
if
(
extModel
!=
null
&&
extModel
.
Id
>
0
)
{
string
CreateByName
=
"甲鹤教育"
;
if
(
extModel
.
CreateBy
>
0
)
{
CreateByName
=
UserReidsCache
.
GetUserLoginInfo
(
extModel
.
CreateBy
)?.
AccountName
??
""
;
}
obj
=
new
{
extModel
.
Id
,
extModel
.
Title
,
extModel
.
Img
,
extModel
.
Content
,
CreateByName
,
CreateTime
=
Common
.
Plugin
.
StringHelper
.
DateFormatToString
(
extModel
.
CreateDate
)
};
}
return
ApiResult
.
Success
(
data
:
obj
);
}
/// <summary>
/// 获取课程分类列表
/// </summary>
...
...
@@ -180,6 +230,7 @@ namespace Edu.WebApi.Controllers.Web
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetCoursePageList
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
...
...
@@ -199,11 +250,66 @@ namespace Edu.WebApi.Controllers.Web
query
.
Group_Id
=
groupId
;
}
var
list
=
courseModule
.
GetCoursePageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
resultList
=
new
List
<
object
>();
foreach
(
var
item
in
list
)
{
resultList
.
Add
(
new
{
item
.
CourseId
,
item
.
CourseName
,
item
.
CoverImg
,
item
.
CourseIntro
,
item
.
CourseFeature
,
});
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
l
ist
;
pageModel
.
PageData
=
resultL
ist
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 获取课程
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetCourse
()
{
var
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
,
0
);
var
Group_Id
=
base
.
ParmJObj
.
GetInt
(
"Group_Id"
);
if
(
Group_Id
<=
0
)
{
string
Domain
=
base
.
ParmJObj
.
GetStringValue
(
"Domain"
);
int
groupId
=
groupModule
.
GetGroupIdByDomainModule
(
Domain
);
Group_Id
=
groupId
;
}
var
extModel
=
courseModule
.
GetCourseModule
(
CourseId
);
object
obj
=
new
object
();
if
(
extModel
!=
null
&&
extModel
.
CourseId
>
0
)
{
obj
=
new
{
extModel
.
CourseId
,
extModel
.
CourseName
,
extModel
.
CourseIntro
,
extModel
.
CourseFeature
,
extModel
.
CoverImg
,
};
}
var
RandList
=
courseModule
.
GetCourseListModule
(
new
RB_Course_ViewModel
()
{
CourseId
=
CourseId
,
IsRand
=
true
,
RandNum
=
6
,
Group_Id
=
Group_Id
});
var
result
=
new
{
CourseObj
=
obj
,
RandList
=
RandList
.
Select
(
qitem
=>
new
{
qitem
.
CourseId
,
qitem
.
CourseName
,
qitem
.
CoverImg
,
qitem
.
CourseIntro
,
qitem
.
CourseFeature
})
};
return
ApiResult
.
Success
(
data
:
result
);
}
}
}
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