Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
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
viitto
EduSpider
Commits
d423092a
Commit
d423092a
authored
May 31, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
d7cb5ece
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
125 additions
and
2 deletions
+125
-2
IStuCommentRepository.cs
EduSpider.IRepository/IStuCommentRepository.cs
+8
-0
ICourseService.cs
EduSpider.IServices/ICourseService.cs
+9
-0
CourseQuery.cs
EduSpider.Model/Query/CourseQuery.cs
+5
-0
StuCommentRepository.cs
EduSpider.Repository/StuCommentRepository.cs
+17
-0
CourseService.cs
EduSpider.Services/CourseService.cs
+39
-1
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+47
-1
No files found.
EduSpider.IRepository/IStuCommentRepository.cs
View file @
d423092a
...
...
@@ -33,6 +33,14 @@ namespace EduSpider.IRepository
/// <returns></returns>
public
bool
SetStuCommentShowTypeRepository
(
int
ShowType
,
string
Ids
);
/// <summary>
/// 修改学员评论状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public
bool
SetStuCommentShowTypeByTimesRepository
(
int
CourseId
,
int
Times
,
int
ShowType
);
/// <summary>
/// 根据编号删除学员评论
/// </summary>
...
...
EduSpider.IServices/ICourseService.cs
View file @
d423092a
...
...
@@ -102,6 +102,15 @@ namespace EduSpider.IServices
/// <returns></returns>
public
bool
SetStuCommentShowType
(
int
ShowType
,
string
Ids
);
/// <summary>
/// 根据课程评论次数修改可见等级
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public
bool
SetStuCommentShowTypeByTimes
(
int
CourseId
,
int
Times
,
int
ShouType
);
/// <summary>
/// 根据编号删除学员评论
/// </summary>
...
...
EduSpider.Model/Query/CourseQuery.cs
View file @
d423092a
...
...
@@ -49,5 +49,10 @@
/// 创建类型(1-系统创建,2-老师创建)
/// </summary>
public
int
CreateCommentType
{
get
;
set
;
}
/// <summary>
/// 评论次数
/// </summary>
public
int
CommentTimes
{
get
;
set
;
}
}
}
EduSpider.Repository/StuCommentRepository.cs
View file @
d423092a
...
...
@@ -44,6 +44,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Stu_Comment
.
HomeWorkId
),
query
.
HomeWorkId
);
}
if
(
query
.
CommentTimes
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Stu_Comment
.
Times
),
query
.
CommentTimes
);
}
}
return
Get
<
RB_Stu_Comment
>(
builder
.
ToString
()).
ToList
();
}
...
...
@@ -85,6 +89,19 @@ WHERE 1=1
return
base
.
Execute
(
sql
)
>
0
;
}
/// <summary>
/// 根据课程评论次数修改可见等级
/// </summary>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public
bool
SetStuCommentShowTypeByTimesRepository
(
int
CourseId
,
int
Times
,
int
ShowType
)
{
string
sql
=
string
.
Format
(
"UPDATE RB_Stu_Comment SET ShowType={0} WHERE CourseId={1} AND Times={2}"
,
ShowType
,
CourseId
,
Times
);
return
base
.
Execute
(
sql
)
>
0
;
}
/// <summary>
/// 根据编号删除学员评论
/// </summary>
...
...
EduSpider.Services/CourseService.cs
View file @
d423092a
...
...
@@ -368,6 +368,18 @@ namespace EduSpider.Services
return
StuCommentRepository
.
SetStuCommentShowTypeRepository
(
ShowType
,
Ids
);
}
/// <summary>
/// 修改学员评论状态
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <returns></returns>
public
bool
SetStuCommentShowTypeByTimes
(
int
CourseId
,
int
Times
,
int
ShowType
)
{
return
StuCommentRepository
.
SetStuCommentShowTypeByTimesRepository
(
CourseId
,
Times
,
ShowType
);
}
/// <summary>
/// 根据编号删除学员评论
/// </summary>
...
...
@@ -385,7 +397,33 @@ namespace EduSpider.Services
/// <returns></returns>
public
List
<
RB_Stu_Comment
>
GetCourseCommentTimesList
(
CourseQuery
query
)
{
return
StuCommentRepository
.
GetCourseCommentTimesListRepository
(
query
);
var
list
=
StuCommentRepository
.
GetCourseCommentTimesListRepository
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
int
ShowType
=
3
;
var
subList
=
StuCommentRepository
.
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
item
.
CourseId
,
CommentTimes
=
item
.
Times
});
if
(
subList
!=
null
&&
subList
.
Count
>
0
)
{
var
totalCount
=
subList
.
Count
();
if
(
subList
.
Where
(
qitem
=>
qitem
.
ShowType
==
1
).
Count
()
==
totalCount
)
{
ShowType
=
1
;
}
else
if
(
subList
.
Where
(
qitem
=>
qitem
.
ShowType
==
3
).
Count
()
==
totalCount
)
{
ShowType
=
3
;
}
else
{
ShowType
=
2
;
}
}
item
.
ShowType
=
ShowType
;
}
}
return
list
;
}
}
...
...
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
d423092a
...
...
@@ -272,6 +272,21 @@ namespace EduSpider.WebApi.Controllers
}
[
HttpPost
]
[
HttpGet
]
/// <summary>
/// 设置学员评论可见性
/// </summary>
/// <returns></returns>
public
ApiResult
SetStuCommentShowTypeByTimes
()
{
int
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
);
int
Times
=
base
.
ReqParameters
.
GetInt
(
"Times"
);
int
ShowType
=
base
.
ReqParameters
.
GetInt
(
"ShowType"
);
var
flag
=
CourseService
.
SetStuCommentShowTypeByTimes
(
CourseId
,
Times
,
ShowType
);
;
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
[
HttpPost
]
[
HttpGet
]
...
...
@@ -286,8 +301,39 @@ namespace EduSpider.WebApi.Controllers
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
CreateCommentType
=
1
};
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
CourseService
.
GetCourseCommentTimesList
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
foreach
(
var
item
in
list
)
{
string
ShowTypeStr
=
""
;
if
(
item
.
ShowType
==
1
)
{
ShowTypeStr
=
"全部可见"
;
}
else
if
(
item
.
ShowType
==
2
)
{
ShowTypeStr
=
"部分可见"
;
}
else
if
(
item
.
ShowType
==
3
)
{
ShowTypeStr
=
"不可见"
;
}
result
.
Add
(
new
{
item
.
Times
,
item
.
CourseId
,
item
.
CreateType
,
CreateTypeStr
=
item
.
CreateType
==
1
?
"系统创建"
:
"老师创建"
,
item
.
ShowType
,
ShowTypeStr
,
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatDate
(
item
.
CreateTime
),
optionsShow
=
false
,
});
}
}
return
ApiResult
.
Success
(
data
:
result
);
}
[
HttpPost
]
...
...
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