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
98504ff4
Commit
98504ff4
authored
May 31, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
d423092a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
96 additions
and
33 deletions
+96
-33
ICommentRepository.cs
EduSpider.IRepository/ICommentRepository.cs
+7
-0
IStuCommentRepository.cs
EduSpider.IRepository/IStuCommentRepository.cs
+4
-3
ICourseService.cs
EduSpider.IServices/ICourseService.cs
+6
-0
CommentRepository.cs
EduSpider.Repository/CommentRepository.cs
+18
-1
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+7
-7
CourseService.cs
EduSpider.Services/CourseService.cs
+20
-10
TeacherController.cs
EduSpider.WebApi/Controllers/Student/TeacherController.cs
+34
-12
No files found.
EduSpider.IRepository/ICommentRepository.cs
View file @
98504ff4
using
EduSpider.Model.Entity
;
using
System.Collections.Generic
;
using
VTX.FW.Config
;
using
VTX.FW.DB
;
...
...
@@ -15,5 +16,11 @@ namespace EduSpider.IRepository
/// <param name="Score"></param>
/// <returns></returns>
public
RB_Comment
GetComment
(
decimal
Score
);
/// <summary>
/// 获取系统配置评价列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetCommentListRepository
();
}
}
EduSpider.IRepository/IStuCommentRepository.cs
View file @
98504ff4
...
...
@@ -34,10 +34,11 @@ namespace EduSpider.IRepository
public
bool
SetStuCommentShowTypeRepository
(
int
ShowType
,
string
Ids
);
/// <summary>
///
修改学员评论状态
///
根据课程评论次数修改可见等级
/// </summary>
/// <param name="ShowType"></param>
/// <param name="Ids"></param>
/// <param name="CourseId">课程编号</param>
/// <param name="Times">次数</param>
/// <param name="ShowType">可见性</param>
/// <returns></returns>
public
bool
SetStuCommentShowTypeByTimesRepository
(
int
CourseId
,
int
Times
,
int
ShowType
);
...
...
EduSpider.IServices/ICourseService.cs
View file @
98504ff4
...
...
@@ -124,5 +124,11 @@ namespace EduSpider.IServices
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Stu_Comment
>
GetCourseCommentTimesList
(
CourseQuery
query
);
/// <summary>
/// 获取系统评价配置
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetSysComment
();
}
}
EduSpider.Repository/CommentRepository.cs
View file @
98504ff4
using
EduSpider.IRepository
;
using
EduSpider.Model.Entity
;
using
EduSpider.Repository.Base
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
VTX.FW.DB.Dapper
;
...
...
@@ -33,8 +34,24 @@ WHERE 1=1
{
builder
.
AppendFormat
(
@" AND A.StartNum<={0} AND {0}<=A.EndNum "
,
Score
);
}
return
base
.
Get
<
RB_Comment
>(
builder
.
ToString
()).
ToList
().
FirstOrDefault
();
}
/// <summary>
/// 获取系统配置评价列表
/// </summary>
/// <returns></returns>
public
List
<
RB_Comment
>
GetCommentListRepository
()
{
StringBuilder
builder
=
new
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Comment AS A
WHERE 1=1
"
);
return
base
.
Get
<
RB_Comment
>(
builder
.
ToString
()).
ToList
();
}
}
}
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
98504ff4
...
...
@@ -125,7 +125,7 @@ WHERE 1=1
if
(
homeWorkList
.
Count
>=
5
)
{
var
firstList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
<=
5
).
ToList
();
var
firstFlag
=
firstList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
var
firstFlag
=
firstList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Any
()
;
//第一阶段有未提交的作业就不生成系统评价
if
(!
firstFlag
)
{
...
...
@@ -169,7 +169,7 @@ WHERE 1=1
if
(
homeWorkList
.
Count
>=
9
)
{
var
secondList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
5
&&
qitem
.
RowNum
<=
9
).
ToList
();
var
secondFlag
=
secondList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
var
secondFlag
=
secondList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Any
()
;
if
(!
secondFlag
)
{
var
secondScore
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
...
...
@@ -212,7 +212,7 @@ WHERE 1=1
if
(
homeWorkList
.
Count
>=
13
)
{
var
thirdList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
9
&&
qitem
.
RowNum
<=
13
).
ToList
();
var
thirdFlag
=
thirdList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
var
thirdFlag
=
thirdList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Any
()
;
if
(!
thirdFlag
)
{
var
thirdScore
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
...
...
@@ -290,9 +290,9 @@ WHERE 1=1
/// 生成随机数
/// </summary>
/// <returns></returns>
private
int
CreateRandomNum
()
private
static
int
CreateRandomNum
()
{
Random
rnd
=
new
Random
();
Random
rnd
=
new
();
return
rnd
.
Next
(
5
,
20
);
}
...
...
@@ -303,9 +303,9 @@ WHERE 1=1
/// <param name="CourseId"></param>
/// <param name="Stu_HomeWork_Id"></param>
/// <returns></returns>
private
RB_Stu_Comment
GetSystemCreateComment
(
List
<
RB_Stu_Comment
>
commentList
,
int
CourseId
,
int
Stu_HomeWork_Id
)
private
static
RB_Stu_Comment
GetSystemCreateComment
(
List
<
RB_Stu_Comment
>
commentList
,
int
CourseId
,
int
Stu_HomeWork_Id
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
CourseId
&&
qitem
.
HomeWorkId
==
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
return
tempModel
;
}
...
...
EduSpider.Services/CourseService.cs
View file @
98504ff4
This diff is collapsed.
Click to expand it.
EduSpider.WebApi/Controllers/Student/TeacherController.cs
View file @
98504ff4
...
...
@@ -138,19 +138,41 @@ namespace EduSpider.WebApi.Controllers
}
/// <summary>
/// 获取课程
评语列表
/// 获取课程
配置评价信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
HttpGet
]
public
ApiResult
GetCourseComment
List
()
public
ApiResult
GetCourseComment
()
{
var
query
=
new
Model
.
Query
.
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
)
};
var
list
=
CourseService
.
GetCourseCommentList
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
var
courseRule
=
CourseService
.
GetCourseCommentList
(
query
).
FirstOrDefault
();
object
result
;
if
(
courseRule
!=
null
)
{
result
=
new
{
courseRule
.
Id
,
courseRule
.
Title
,
courseRule
.
CourseId
,
courseRule
.
CommentDetails
};
}
else
{
var
sysList
=
CourseService
.
GetSysComment
();
result
=
new
{
Id
=
0
,
Title
=
"系统默认配置"
,
CourseId
=
0
,
CommentDetails
=
sysList
};
}
return
ApiResult
.
Success
(
data
:
result
);
}
/// <summary>
...
...
@@ -283,7 +305,7 @@ namespace EduSpider.WebApi.Controllers
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
);
;
var
flag
=
CourseService
.
SetStuCommentShowTypeByTimes
(
CourseId
,
Times
,
ShowType
);
;
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
@@ -295,13 +317,13 @@ namespace EduSpider.WebApi.Controllers
/// </summary>
/// <returns></returns>
public
ApiResult
GetCourseCommentTimes
()
{
{
var
query
=
new
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
),
CreateCommentType
=
1
CreateCommentType
=
1
};
List
<
object
>
result
=
new
List
<
object
>
();
List
<
object
>
result
=
new
();
var
list
=
CourseService
.
GetCourseCommentTimesList
(
query
);
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
...
...
@@ -328,9 +350,9 @@ namespace EduSpider.WebApi.Controllers
CreateTypeStr
=
item
.
CreateType
==
1
?
"系统创建"
:
"老师创建"
,
item
.
ShowType
,
ShowTypeStr
,
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatDate
(
item
.
CreateTime
),
optionsShow
=
false
,
});
CreateTime
=
VTX
.
FW
.
Helper
.
ConvertHelper
.
FormatDate
(
item
.
CreateTime
),
optionsShow
=
false
,
});
}
}
return
ApiResult
.
Success
(
data
:
result
);
...
...
@@ -346,7 +368,7 @@ namespace EduSpider.WebApi.Controllers
{
var
query
=
new
CourseQuery
()
{
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
)
CourseId
=
base
.
ReqParameters
.
GetInt
(
"CourseId"
)
};
var
list
=
CourseService
.
GetStuCommentList
(
query
);
return
ApiResult
.
Success
(
data
:
list
);
...
...
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