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
e3f7ae99
Commit
e3f7ae99
authored
Aug 17, 2021
by
吴春
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/Kui2/education
parents
33868749
8e1c50c7
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
1340 additions
and
138 deletions
+1340
-138
CacheKey.cs
Edu.Cache/CacheKey.cs
+5
-0
UserReidsCache.cs
Edu.Cache/User/UserReidsCache.cs
+1
-3
WeChatReidsCache.cs
Edu.Cache/WeChat/WeChatReidsCache.cs
+111
-0
Config.cs
Edu.Common/Config.cs
+11
-0
WorkChatConfig.cs
Edu.Model/CacheModel/WorkChatConfig.cs
+86
-0
RB_Examination_Publish.cs
Edu.Model/Entity/Exam/RB_Examination_Publish.cs
+143
-0
RB_Order.cs
Edu.Model/Entity/Sell/RB_Order.cs
+30
-3
RB_Group.cs
Edu.Model/Entity/User/RB_Group.cs
+5
-0
ExamFolderTreeModel.cs
Edu.Model/ViewModel/Exam/ExamFolderTreeModel.cs
+32
-0
RB_Examination_Paper_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
+10
-0
RB_Examination_Publish_ViewModel.cs
Edu.Model/ViewModel/Exam/RB_Examination_Publish_ViewModel.cs
+15
-0
RB_Question_ViewModel.cs
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
+5
-0
CourseOfferModule.cs
Edu.Module.Course/CourseOfferModule.cs
+6
-5
EducationContractModule.cs
Edu.Module.Course/EducationContractModule.cs
+7
-9
OrderModule.cs
Edu.Module.Course/OrderModule.cs
+47
-10
StudentBillModule.cs
Edu.Module.Course/StudentBillModule.cs
+0
-14
OrderChangeModule.cs
Edu.Module.EduTask/OrderChangeModule.cs
+6
-0
PaperModule.cs
Edu.Module.Exam/PaperModule.cs
+212
-4
QYWeChatModule.cs
Edu.Module.QYWeChat/QYWeChatModule.cs
+24
-7
GroupModule.cs
Edu.Module.User/GroupModule.cs
+10
-0
RB_Examination_PaperRepository.cs
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
+62
-0
RB_Examination_PublishRepository.cs
Edu.Repository/Exam/RB_Examination_PublishRepository.cs
+41
-0
RB_GroupRepository.cs
Edu.Repository/User/RB_GroupRepository.cs
+4
-0
Edu.ThirdCore.csproj
Edu.ThirdCore/Edu.ThirdCore.csproj
+1
-0
QYWeiXinConfig.cs
Edu.ThirdCore/QYWinXin/QYWeiXinConfig.cs
+13
-0
QYWeiXinHelper.cs
Edu.ThirdCore/QYWinXin/QYWeiXinHelper.cs
+73
-0
ClassController.cs
Edu.WebApi/Controllers/Course/ClassController.cs
+1
-0
OrderController.cs
Edu.WebApi/Controllers/Course/OrderController.cs
+10
-4
QuestionController.cs
Edu.WebApi/Controllers/Course/QuestionController.cs
+52
-46
StuController.cs
Edu.WebApi/Controllers/Course/StuController.cs
+7
-5
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+157
-26
QYWeChatController.cs
Edu.WebApi/Controllers/QYWeChat/QYWeChatController.cs
+136
-0
Startup.cs
Edu.WebApi/Startup.cs
+16
-2
appsettings.json
Edu.WebApi/appsettings.json
+1
-0
No files found.
Edu.Cache/CacheKey.cs
View file @
e3f7ae99
...
...
@@ -58,5 +58,10 @@ namespace Edu.Cache
/// </summary>
public
static
string
QYWeChat_EmpToken_Key
=
"EWeChat_Token_Key_"
;
/// <summary>
/// 企业微信配置文件
/// </summary>
public
static
string
QYWECHAT_GLOBAL_CONFIG_KEY
=
"QYWECHAT_GLOBAL_CONFIG"
;
}
}
Edu.Cache/User/UserReidsCache.cs
View file @
e3f7ae99
...
...
@@ -84,9 +84,7 @@ namespace Edu.Cache.User
/// 获取缓存
/// </summary>
/// <param name="cacheKey"></param>
/// <param name="Data"></param>
/// <param name="JwtExpirTime"></param>
public
static
object
Get
(
string
cacheKey
,
object
Data
,
int
JwtExpirTime
)
public
static
object
Get
(
string
cacheKey
)
{
try
{
...
...
Edu.Cache/WeChat/WeChatReidsCache.cs
View file @
e3f7ae99
using
Edu.CacheManager.Base
;
using
Edu.Model.CacheModel
;
using
Edu.Repository.WeChat
;
using
System
;
using
System.Linq
;
namespace
Edu.Cache.WeChat
{
...
...
@@ -15,6 +18,13 @@ namespace Edu.Cache.WeChat
static
readonly
RedisHelper
redis
=
new
RedisHelper
(
REDIS_DB3
);
/// <summary>
/// 账号仓储层对象
/// </summary>
static
readonly
RB_WeChat_ConfigRepository
configRepository
=
new
RB_WeChat_ConfigRepository
();
/// <summary>
/// 设置缓存
/// </summary>
...
...
@@ -75,6 +85,107 @@ namespace Edu.Cache.WeChat
}
}
#
region
企业微信全局配置
/// <summary>
/// 设置配置缓存
/// </summary>
/// <param name="model"></param>
public
static
void
SetConfig
(
WorkChatConfig
model
,
int
JwtExpirTime
)
{
try
{
TimeSpan
ts
=
GetExpirTime
(
JwtExpirTime
);
redis
.
StringSet
<
WorkChatConfig
>(
CacheKey
.
QYWECHAT_GLOBAL_CONFIG_KEY
+
"_"
+
model
.
Group_Id
,
model
,
ts
);
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"WorkChatConfig缓存设置失败"
);
}
}
/// <summary>
/// 更新全局配置
/// </summary>
/// <param name="id"></param>
public
static
void
UpdateConfig
(
int
id
)
{
var
model
=
configRepository
.
GetEntity
(
id
);
if
(
model
!=
null
)
{
var
chatConfig
=
new
WorkChatConfig
{
Id
=
model
.
Id
,
Group_Id
=
model
.
Group_Id
,
Name
=
model
.
Name
,
WX_CorpId
=
model
.
WX_CorpId
,
Social_Code
=
model
.
Social_Code
,
Employee_Secret
=
model
.
Employee_Secret
,
Contact_Secret
=
model
.
Contact_Secret
,
TelEvent_CallBack
=
model
.
TelEvent_CallBack
,
Token
=
model
.
Token
,
Encoding_Aes_Key
=
model
.
Encoding_Aes_Key
,
EmpEvent_CallBack
=
model
.
EmpEvent_CallBack
,
CreateBy
=
model
.
CreateBy
,
CreateTime
=
model
.
CreateTime
,
UpdateBy
=
model
.
UpdateBy
,
UpdateTime
=
model
.
UpdateTime
};
SetConfig
(
chatConfig
,
Common
.
Config
.
JwtExpirTime
);
}
}
/// <summary>
/// 获取配置换成
/// </summary>
/// <returns></returns>
public
static
WorkChatConfig
GetWorkChatConfig
(
int
groupId
)
{
WorkChatConfig
chatConfig
=
null
;
string
cacheKey
=
CacheKey
.
QYWECHAT_GLOBAL_CONFIG_KEY
+
"_"
+
groupId
;
try
{
chatConfig
=
redis
.
StringGet
<
WorkChatConfig
>(
cacheKey
);
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"GeWorkChatConfig"
);
}
if
(
chatConfig
==
null
)
{
var
model
=
configRepository
.
GetList
(
new
Model
.
ViewModel
.
WeChat
.
RB_WeChat_Config_ViewModel
()
{
Group_Id
=
groupId
}).
FirstOrDefault
();
if
(
model
!=
null
)
{
chatConfig
=
new
WorkChatConfig
{
Id
=
model
.
Id
,
Group_Id
=
model
.
Group_Id
,
Name
=
model
.
Name
,
WX_CorpId
=
model
.
WX_CorpId
,
Social_Code
=
model
.
Social_Code
,
Employee_Secret
=
model
.
Employee_Secret
,
Contact_Secret
=
model
.
Contact_Secret
,
TelEvent_CallBack
=
model
.
TelEvent_CallBack
,
Token
=
model
.
Token
,
Encoding_Aes_Key
=
model
.
Encoding_Aes_Key
,
EmpEvent_CallBack
=
model
.
EmpEvent_CallBack
,
CreateBy
=
model
.
CreateBy
,
CreateTime
=
model
.
CreateTime
,
UpdateBy
=
model
.
UpdateBy
,
UpdateTime
=
model
.
UpdateTime
};
SetConfig
(
chatConfig
,
Common
.
Config
.
JwtExpirTime
);
}
}
return
chatConfig
;
}
#
endregion
}
/// <summary>
...
...
Edu.Common/Config.cs
View file @
e3f7ae99
...
...
@@ -159,6 +159,17 @@ namespace Edu.Common
}
}
/// <summary>
/// 企业应用APP地址
/// </summary>
public
static
string
WorkAPPDomain
{
get
{
return
ReadConfigKey
(
"WorkAPPDomain"
);
}
}
/// <summary>
/// 获取Oss文件全路径
/// </summary>
...
...
Edu.Model/CacheModel/WorkChatConfig.cs
0 → 100644
View file @
e3f7ae99
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.CacheModel
{
/// <summary>
/// 企业微信配置
/// </summary>
public
class
WorkChatConfig
{
/// <summary>
/// Id
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 企业名称
/// </summary>
public
string
Name
{
get
;
set
;
}
/// <summary>
/// 企业微信ID
/// </summary>
public
string
WX_CorpId
{
get
;
set
;
}
/// <summary>
/// 企业代码(企业统一社会信用代码)
/// </summary>
public
string
Social_Code
{
get
;
set
;
}
/// <summary>
/// 企业通讯录secret
/// </summary>
public
string
Employee_Secret
{
get
;
set
;
}
/// <summary>
/// 企业外部联系人secret
/// </summary>
public
string
Contact_Secret
{
get
;
set
;
}
/// <summary>
/// 事件回调地址(通讯录)
/// </summary>
public
string
TelEvent_CallBack
{
get
;
set
;
}
/// <summary>
/// 回调token
/// </summary>
public
string
Token
{
get
;
set
;
}
/// <summary>
/// 回调消息加密串
/// </summary>
public
string
Encoding_Aes_Key
{
get
;
set
;
}
/// <summary>
/// 事件回调地址(外部人员)
/// </summary>
public
string
EmpEvent_CallBack
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建日期
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 修改人
/// </summary>
public
int
UpdateBy
{
get
;
set
;
}
/// <summary>
/// 更新时间
/// </summary>
public
DateTime
UpdateTime
{
get
;
set
;
}
}
}
Edu.Model/Entity/Exam/RB_Examination_Publish.cs
0 → 100644
View file @
e3f7ae99
using
System
;
using
VT.FW.DB
;
namespace
Edu.Model.Entity.Exam
{
/// <summary>
/// 试卷发布实体类
/// </summary>
[
Serializable
]
[
DB
(
ConnectionName
=
"DefaultConnection"
)]
public
class
RB_Examination_Publish
{
/// <summary>
/// 发布考试主键编号
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 试卷编号
/// </summary>
public
int
PaperId
{
get
;
set
;
}
/// <summary>
/// 发放类型(1-按班级发放,2-指定学生发放)
/// </summary>
public
int
PublishType
{
get
;
set
;
}
/// <summary>
/// 考试开始时间
/// </summary>
public
DateTime
ExamStartTime
{
get
;
set
;
}
/// <summary>
/// 考试结束时间
/// </summary>
public
DateTime
ExamEndTime
{
get
;
set
;
}
/// <summary>
/// 考试限时
/// </summary>
public
int
ExamTimes
{
get
;
set
;
}
/// <summary>
/// 限时提交(多少分钟内不允许提交)
/// </summary>
public
int
SubmitTimes
{
get
;
set
;
}
/// <summary>
/// 限时进入(多少分钟后不允许参加考试)
/// </summary>
public
int
EnterTimes
{
get
;
set
;
}
/// <summary>
/// 创建人
/// </summary>
public
int
CreateBy
{
get
;
set
;
}
/// <summary>
/// 创建时间
/// </summary>
public
DateTime
CreateTime
{
get
;
set
;
}
/// <summary>
/// 集团编号
/// </summary>
public
int
Group_Id
{
get
;
set
;
}
/// <summary>
/// 学校编号
/// </summary>
public
int
School_Id
{
get
;
set
;
}
/// <summary>
/// 删除状态
/// </summary>
public
int
Status
{
get
;
set
;
}
/// <summary>
/// 题目乱序(1-是)
/// </summary>
public
int
IsQuestionRandom
{
get
;
set
;
}
/// <summary>
/// 选项乱序(1-是)
/// </summary>
public
int
IsOptionRandom
{
get
;
set
;
}
/// <summary>
/// 学生离开作答页面(1-是)
/// </summary>
public
int
IsLeaveAnswer
{
get
;
set
;
}
/// <summary>
/// 离开次数
/// </summary>
public
int
LeaveTimes
{
get
;
set
;
}
/// <summary>
/// 是否禁用多终端(1-是)
/// </summary>
public
int
IsDisableMultiTerminal
{
get
;
set
;
}
/// <summary>
/// 是否只允许(App、PC)考试(1-是)
/// </summary>
public
int
IsExamType
{
get
;
set
;
}
/// <summary>
/// 考试终端类型(1-App,2-PC)
/// </summary>
public
int
ExamTypeValue
{
get
;
set
;
}
/// <summary>
/// 考试须知
/// </summary>
public
string
ExamNotice
{
get
;
set
;
}
/// <summary>
/// 及格分数
/// </summary>
public
decimal
PassScore
{
get
;
set
;
}
/// <summary>
/// 考试到达截止时间后自动提交(1-是)
/// </summary>
public
int
IsAutoSubmit
{
get
;
set
;
}
/// <summary>
/// 填空类型的题目设为主观题(1-是)
/// </summary>
public
int
FillInIsSubject
{
get
;
set
;
}
/// <summary>
/// 填空题答案不区分大小写(1-是)
/// </summary>
public
int
FillInIsIgnore
{
get
;
set
;
}
/// <summary>
/// 多选题未选全给一半分(1-是)
/// </summary>
public
int
IsHalfScore
{
get
;
set
;
}
}
}
Edu.Model/Entity/Sell/RB_Order.cs
View file @
e3f7ae99
using
Edu.Common.Enum
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Sale
;
using
System
;
using
VT.FW.DB
;
...
...
@@ -32,63 +31,83 @@ namespace Edu.Model.Entity.Sell
/// 单价
/// </summary>
public
decimal
Class_Price
{
get
;
set
;
}
/// <summary>
/// 成交单价
/// </summary>
public
decimal
Unit_Price
{
get
;
set
;
}
/// <summary>
/// 客人数量
/// </summary>
public
int
GuestNum
{
get
;
set
;
}
/// <summary>
/// 应收总额
/// </summary>
public
decimal
PreferPrice
{
get
;
set
;
}
/// <summary>
/// 实收金额
/// </summary>
public
decimal
Income
{
get
;
set
;
}
/// <summary>
/// 退款金额
/// </summary>
public
decimal
Refund
{
get
;
set
;
}
/// <summary>
/// 优惠金额
/// </summary>
public
decimal
DiscountMoney
{
get
;
set
;
}
/// <summary>
/// 每人优惠金额
/// </summary>
public
decimal
PerDiscountMoney
{
get
;
set
;
}
/// <summary>
/// 平台税金
/// </summary>
public
decimal
PlatformTax
{
get
;
set
;
}
/// <summary>
/// 订单状态 枚举
/// </summary>
public
OrderStateEnum
OrderState
{
get
;
set
;
}
/// <summary>
/// 订单来源 枚举
/// </summary>
public
OrderSourceEnum
OrderSource
{
get
;
set
;
}
/// <summary>
/// 业务人员
/// </summary>
public
int
EnterID
{
get
;
set
;
}
/// <summary>
/// 订单来自于 枚举
/// </summary>
public
OrderFormEnum
OrderForm
{
get
;
set
;
}
private
decimal
commission
=
-
1
;
/// <summary>
/// 提成金额
/// </summary>
public
decimal
CommissionMoney
{
get
=>
commission
;
set
=>
commission
=
value
;
}
/// <summary>
/// 额外奖励金额
/// </summary>
public
decimal
ExtraRewardMoney
{
get
;
set
;
}
/// <summary>
/// 额外扣除金额
/// </summary>
public
decimal
ExtraDeductMoney
{
get
;
set
;
}
/// <summary>
/// 提成是否已发放 1是 0否
/// </summary>
...
...
@@ -97,14 +116,17 @@ namespace Edu.Model.Entity.Sell
/// 销售备注
/// </summary>
public
string
SaleRemark
{
get
;
set
;
}
/// <summary>
/// 教务备注
/// </summary>
public
string
TeacherRemark
{
get
;
set
;
}
/// <summary>
/// 校长备注
/// </summary>
public
string
RectorRemark
{
get
;
set
;
}
/// <summary>
/// 经理备注
/// </summary>
...
...
@@ -186,10 +208,15 @@ namespace Edu.Model.Entity.Sell
public
int
IsLessPrice
{
get
;
set
;
}
/// <summary>
/// 少价金额
/// 少价金额
(每人少价金额)
/// </summary>
public
decimal
LessPrice
{
get
;
set
;
}
/// <summary>
/// 每人少价金额
/// </summary>
public
decimal
PerLessMoney
{
get
;
set
;
}
/// <summary>
/// (教育订单使用)订单性质(1-直通车,2-代收代付,3-返佣)
/// </summary>
...
...
Edu.Model/Entity/User/RB_Group.cs
View file @
e3f7ae99
...
...
@@ -100,5 +100,10 @@ namespace Edu.Model.Entity.User
/// 官网地址
/// </summary>
public
string
WebSiteDomain
{
get
;
set
;
}
/// <summary>
/// 企业微信应用域名
/// </summary>
public
string
WorkAppDomain
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Model/ViewModel/Exam/ExamFolderTreeModel.cs
0 → 100644
View file @
e3f7ae99
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Exam
{
/// <summary>
/// 试卷文件树形结构
/// </summary>
public
class
ExamFolderTreeModel
{
/// <summary>
/// 试卷编号
/// </summary>
public
int
PaperId
{
get
;
set
;
}
/// <summary>
/// 试卷名称
/// </summary>
public
string
PaperName
{
get
;
set
;
}
/// <summary>
/// 父节点编号
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 下级文件夹列表
/// </summary>
public
List
<
ExamFolderTreeModel
>
ChildList
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Exam/RB_Examination_Paper_ViewModel.cs
View file @
e3f7ae99
...
...
@@ -21,5 +21,15 @@ namespace Edu.Model.ViewModel.Exam
/// 问题数量
/// </summary>
public
int
QuestionCount
{
get
;
set
;
}
/// <summary>
/// 试卷编号
/// </summary>
public
string
QPaperIds
{
get
;
set
;
}
/// <summary>
/// 是否查询文件夹
/// </summary>
public
int
IsQueryFolder
{
get
;
set
;
}
}
}
Edu.Model/ViewModel/Exam/RB_Examination_Publish_ViewModel.cs
0 → 100644
View file @
e3f7ae99
using
Edu.Model.Entity.Exam
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.Model.ViewModel.Exam
{
/// <summary>
/// 试卷发布视图实体类
/// </summary>
public
class
RB_Examination_Publish_ViewModel
:
RB_Examination_Publish
{
}
}
Edu.Model/ViewModel/Question/RB_Question_ViewModel.cs
View file @
e3f7ae99
...
...
@@ -101,5 +101,10 @@ namespace Edu.Model.ViewModel.Question
return
Common
.
Plugin
.
EnumHelper
.
ToName
(
this
.
LevelType
);
}
}
/// <summary>
/// 是否返回所有字段
/// </summary>
public
int
IsShowAllQuestion
{
get
;
set
;
}
}
}
\ No newline at end of file
Edu.Module.Course/CourseOfferModule.cs
View file @
e3f7ae99
...
...
@@ -359,11 +359,11 @@ namespace Edu.Module.Course
{
try
{
decimal
uPrice
=
item
.
OriginalPrice
/
item
.
JoinNum
;
var
orderModel
=
new
RB_Order
()
{
ClassId
=
item
.
ClassId
,
Class_Price
=
u
Price
,
Class_Price
=
item
.
Original
Price
,
CommissionMoney
=
-
1
,
CreateBy
=
offerModel
.
CreateBy
,
CreateTime
=
DateTime
.
Now
,
...
...
@@ -371,7 +371,8 @@ namespace Edu.Module.Course
School_Id
=
emModel
?.
School_Id
??
0
,
Group_Id
=
emModel
?.
Group_Id
??
0
,
DirectorRemark
=
""
,
DiscountMoney
=
item
.
DiscountPrice
,
DiscountMoney
=(
item
.
OriginalPrice
-
item
.
DiscountPrice
)*
item
.
JoinNum
,
PerDiscountMoney
=
item
.
OriginalPrice
-
item
.
DiscountPrice
,
EnterID
=
offerModel
.
CreateBy
,
ExtraDeductMoney
=
0
,
ExtraRewardMoney
=
0
,
...
...
@@ -383,7 +384,7 @@ namespace Edu.Module.Course
OrderSource
=
Common
.
Enum
.
Course
.
OrderSourceEnum
.
Employee
,
OrderState
=
Common
.
Enum
.
Course
.
OrderStateEnum
.
Normal
,
PlatformTax
=
0
,
PreferPrice
=
item
.
OriginalPrice
,
PreferPrice
=
item
.
OriginalPrice
*
item
.
JoinNum
,
RectorRemark
=
""
,
Refund
=
0
,
JoinType
=
OrderJoinTypeEnum
.
Normal
,
...
...
@@ -393,7 +394,7 @@ namespace Edu.Module.Course
SaleRemark
=
item
.
Remark
,
TeacherRemark
=
""
,
TradeWay
=
Common
.
Enum
.
Course
.
TradeWayEnum
.
OnLine
,
Unit_Price
=
u
Price
,
Unit_Price
=
item
.
Original
Price
,
UpdateBy
=
offerModel
.
CreateBy
,
UpdateTime
=
DateTime
.
Now
,
OfferId
=
offerId
,
...
...
Edu.Module.Course/EducationContractModule.cs
View file @
e3f7ae99
...
...
@@ -104,9 +104,8 @@ namespace Edu.Module.Course
public
object
GetStudentInfoModule
(
int
OrderId
,
int
GuestId
)
{
var
obj
=
new
object
();
var
glist
=
order_GuestRepository
.
GetOrderGuestListRepository
(
new
RB_Order_Guest_ViewModel
()
{
OrderId
=
OrderId
});
var
orderModel
=
orderRepository
.
GetEntity
(
OrderId
);
var
guestModel
=
glist
.
Where
(
qitem
=>
qitem
.
Id
==
GuestId
)?.
FirstOrDefault
(
);
var
guestModel
=
order_GuestRepository
.
GetEntity
<
RB_Order_Guest_ViewModel
>(
GuestId
);
var
classModel
=
new
RB_Class_ViewModel
();
var
courseModel
=
new
RB_Course_ViewModel
();
decimal
PreferPrice
=
0
;
//总金额
...
...
@@ -122,12 +121,11 @@ namespace Edu.Module.Course
}
var
qids
=
(
classModel
?.
ManagerId
??
0
).
ToString
()
+
","
+
(
orderModel
?.
EnterID
??
0
).
ToString
();
var
empList
=
accountRepository
.
GetEmployeeListRepository
(
new
Employee_ViewModel
()
{
QIds
=
qids
});
if
(
glist
!=
null
&&
glist
.
Count
>
0
)
{
PreferPrice
=
orderModel
.
PreferPrice
/
glist
.
Count
();
DiscountMoney
=
orderModel
.
DiscountMoney
/
glist
.
Count
();
Money
=
(
orderModel
.
PreferPrice
-
orderModel
.
DiscountMoney
)
/
glist
.
Count
();
//平均每人费用
}
PreferPrice
=
orderModel
.
PreferPrice
/
orderModel
.
GuestNum
;
DiscountMoney
=
orderModel
.
PerDiscountMoney
;
Money
=
(
orderModel
.
PreferPrice
-
orderModel
.
DiscountMoney
)
/
orderModel
.
GuestNum
;
//平均每人费用
string
dxMoney
=
StringHelper
.
MoneyToUpper
(
Money
.
ToString
());
obj
=
new
{
...
...
@@ -143,7 +141,7 @@ namespace Edu.Module.Course
StartLevel
=
guestModel
?.
Basics
??
""
,
CourseConsultant
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
(
orderModel
?.
EnterID
??
0
))?.
FirstOrDefault
()?.
EmployeeName
??
""
,
Payee
=
empList
?.
Where
(
qitem
=>
qitem
.
Id
==
(
orderModel
?.
EnterID
??
0
))?.
FirstOrDefault
()?.
EmployeeName
??
""
,
FirstClassHours
=
courseModel
?.
ClassHours
??
0
,
FirstClassHours
=
(
courseModel
?.
ClassHours
??
0
)-(
orderModel
?.
StartClassHours
??
0
)
,
FirstCourseFee
=
PreferPrice
,
FirstBookFee
=
0
,
FirstClassFee
=
0
,
...
...
Edu.Module.Course/OrderModule.cs
View file @
e3f7ae99
...
...
@@ -408,16 +408,35 @@ namespace Edu.Module.Course
}
//课程信息
var
courseModel
=
courseRepository
.
GetEntity
(
demodel
.
CourseId
);
decimal
coursePrice
=
courseModel
.
SellPrice
;
//课程最低单价
#
region
计算订单优惠信息
//获取课程优惠
var
coursePreferentialList
=
course_PreferentialRepository
.
GetCoursePreferentialListRepostory
(
new
RB_Course_Preferential_Extend
()
{
CourseId
=
demodel
.
CourseId
});
//课程优惠信息
//计算续费订单优惠
if
(
demodel
.
JoinType
==
OrderJoinTypeEnum
.
RenewOrder
&&
demodel
.
OrderId
==
0
)
{
var
renewOrderDiscount
=
coursePreferentialList
?.
Where
(
qitem
=>
qitem
.
PriceDiscountType
==
CoursePriceDiscountEnum
.
Renewal
)?.
FirstOrDefault
();
if
(
renewOrderDiscount
!=
null
)
{
if
((
renewOrderDiscount
?.
PriceType
??
0
)
==
0
)
{
demodel
.
DiscountMoney
=
coursePrice
-
coursePrice
*
(
100
-
(
renewOrderDiscount
?.
PriceMoney
??
0
))
/
100
;
demodel
.
SaleRemark
=
"续费报名优惠"
+
renewOrderDiscount
.
PriceMoney
+
"%"
;
}
else
{
demodel
.
DiscountMoney
=
(
coursePrice
-
(
renewOrderDiscount
?.
PriceMoney
??
0
))
*
demodel
.
GuestNum
;
demodel
.
SaleRemark
=
"续费报名优惠"
+
renewOrderDiscount
.
PriceMoney
+
"元"
;
}
demodel
.
PerDiscountMoney
=
demodel
.
DiscountMoney
/
demodel
.
GuestNum
;
}
}
decimal
disMoney
=
0
;
//课程最大优惠金额
decimal
coursePrice
=
courseModel
.
SellPrice
;
//课程最低单价
decimal
lessMoney
=
0
;
//课程最大少价金额
var
coursePreferentialModel
=
new
RB_Course_Preferential_Extend
();
if
(
coursePreferentialList
!=
null
&&
coursePreferentialList
.
Count
>
0
)
{
...
...
@@ -433,30 +452,33 @@ namespace Edu.Module.Course
if
(
saleCommissionType
==
0
)
{
var
tempMoney
=
(
courseModel
?.
SellPrice
??
0
)
*
(
coursePreferentialModel
?.
SaleCommissionMoney
??
0
);
di
sMoney
=
tempMoney
/
Convert
.
ToDecimal
(
100
);
les
sMoney
=
tempMoney
/
Convert
.
ToDecimal
(
100
);
}
else
{
di
sMoney
=
coursePreferentialModel
?.
SaleCommissionMoney
??
0
;
les
sMoney
=
coursePreferentialModel
?.
SaleCommissionMoney
??
0
;
}
var
b2bCommissionType
=
coursePreferentialModel
?.
B2BCommissionType
??
0
;
if
(
b2bCommissionType
==
0
)
{
var
tempMoney
=
(
courseModel
?.
SellPrice
??
0
)
*
(
coursePreferentialModel
?.
B2BCommissionMoney
??
0
);
di
sMoney
+=
tempMoney
/
Convert
.
ToDecimal
(
100
);
les
sMoney
+=
tempMoney
/
Convert
.
ToDecimal
(
100
);
}
else
{
di
sMoney
=
coursePreferentialModel
?.
B2BCommissionMoney
??
0
;
les
sMoney
=
coursePreferentialModel
?.
B2BCommissionMoney
??
0
;
}
var
priceCommissionType
=
coursePreferentialModel
?.
PriceType
??
0
;
if
(
priceCommissionType
==
0
)
{
disMoney
=
(
100
-
(
coursePreferentialModel
?.
PriceMoney
??
0
))
/
100
;
coursePrice
=
coursePrice
*
(
100
-
(
coursePreferentialModel
?.
PriceMoney
??
0
))
/
100
;
}
else
{
disMoney
=
coursePreferentialModel
?.
PriceMoney
??
0
;
coursePrice
-=
(
coursePreferentialModel
?.
PriceMoney
??
0
);
}
#
region
记录提成信息
...
...
@@ -478,7 +500,7 @@ namespace Edu.Module.Course
{
if
(
coursePreferentialList
!=
null
&&
coursePreferentialList
.
Count
>
0
)
{
if
(
demodel
.
LessPrice
>
di
sMoney
)
if
(
demodel
.
LessPrice
>
les
sMoney
)
{
message
=
string
.
Format
(
"优惠金额不能大于{0}"
,
disMoney
.
ToString
(
"0.00"
));
return
flag
;
...
...
@@ -510,6 +532,7 @@ namespace Edu.Module.Course
if
(
demodel
.
IsLessPrice
==
0
)
{
demodel
.
LessPrice
=
0
;
demodel
.
PerLessMoney
=
0
;
}
var
orderModel
=
new
RB_Order
();
if
(
demodel
.
OrderId
>
0
)
...
...
@@ -626,6 +649,8 @@ namespace Edu.Module.Course
{
{
nameof
(
RB_Order_ViewModel
.
GuestNum
),
demodel
.
GuestNum
},
{
nameof
(
RB_Order_ViewModel
.
Unit_Price
),
demodel
.
Unit_Price
},
{
nameof
(
RB_Order_ViewModel
.
DiscountMoney
),
demodel
.
DiscountMoney
},
{
nameof
(
RB_Order_ViewModel
.
PerDiscountMoney
),
demodel
.
PerDiscountMoney
},
{
nameof
(
RB_Order_ViewModel
.
PreferPrice
),
demodel
.
PreferPrice
},
{
nameof
(
RB_Order_ViewModel
.
OrderSource
),
demodel
.
OrderSource
},
{
nameof
(
RB_Order_ViewModel
.
SaleRemark
),
demodel
.
SaleRemark
},
...
...
@@ -634,6 +659,7 @@ namespace Edu.Module.Course
{
nameof
(
RB_Order_ViewModel
.
EduOccupation
),
demodel
.
EduOccupation
},
{
nameof
(
RB_Order_ViewModel
.
IsLessPrice
),
demodel
.
IsLessPrice
},
{
nameof
(
RB_Order_ViewModel
.
LessPrice
),
demodel
.
LessPrice
},
{
nameof
(
RB_Order_ViewModel
.
PerLessMoney
),
demodel
.
PerLessMoney
},
{
nameof
(
RB_Order_ViewModel
.
StartClassHours
),
demodel
.
StartClassHours
},
{
nameof
(
RB_Order_ViewModel
.
CourseId
),
demodel
.
CourseId
},
{
nameof
(
RB_Order_ViewModel
.
EffectStatus
),
demodel
.
EffectStatus
},
...
...
@@ -641,7 +667,6 @@ namespace Edu.Module.Course
{
nameof
(
RB_Order_ViewModel
.
UpOrderId
),
demodel
.
UpOrderId
},
};
flag
=
orderRepository
.
Update
(
keyValues
,
new
WhereHelper
(
nameof
(
RB_Order_ViewModel
.
OrderId
),
demodel
.
OrderId
));
//记录日志信息
LogContent
=
$"修改日语培训订单【
{
demodel
.
OrderId
}
】"
;
if
(
orderModel
.
GuestNum
!=
demodel
.
GuestNum
)
...
...
@@ -652,6 +677,14 @@ namespace Edu.Module.Course
{
LogContent
+=
$",成交单价由【
{
orderModel
.
Unit_Price
}
】修改为【
{
demodel
.
Unit_Price
}
】"
;
}
if
(
orderModel
.
DiscountMoney
!=
demodel
.
DiscountMoney
)
{
LogContent
+=
$",优惠金额由【
{(
orderModel
.
DiscountMoney
)}
】修改为【
{(
demodel
.
DiscountMoney
)}
】"
;
}
if
(
orderModel
.
PerDiscountMoney
!=
demodel
.
PerDiscountMoney
)
{
LogContent
+=
$",每人优惠金额由【
{(
orderModel
.
PerDiscountMoney
)}
】修改为【
{(
demodel
.
PerDiscountMoney
)}
】"
;
}
if
(
orderModel
.
PreferPrice
!=
demodel
.
PreferPrice
)
{
LogContent
+=
$",应收金额由【
{
orderModel
.
PreferPrice
}
】修改为【
{
demodel
.
PreferPrice
}
】"
;
...
...
@@ -679,7 +712,11 @@ namespace Edu.Module.Course
}
if
(
orderModel
.
LessPrice
!=
demodel
.
LessPrice
)
{
LogContent
+=
$",少价金额由【
{(
orderModel
.
LessPrice
)}
】修改为【
{(
demodel
.
LessPrice
)}
】"
;
LogContent
+=
$",少价金额由【
{(
orderModel
.
LessPrice
)}
】修改为【
{(
demodel
.
LessPrice
)}
】"
;
}
if
(
orderModel
.
PerLessMoney
!=
demodel
.
PerLessMoney
)
{
LogContent
+=
$",每人少价金额由【
{(
orderModel
.
PerLessMoney
)}
】修改为【
{(
demodel
.
PerLessMoney
)}
】"
;
}
//记录订单备注
if
(
orderModel
.
SaleRemark
!=
demodel
.
SaleRemark
)
...
...
Edu.Module.Course/StudentBillModule.cs
View file @
e3f7ae99
...
...
@@ -277,22 +277,8 @@ namespace Edu.Module.Course
}
foreach
(
var
item
in
classList
)
{
var
priceModel
=
coursePriceList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
item
.
CouseId
&&
qitem
.
PriceDiscountType
==
CoursePriceDiscountEnum
.
Renewal
)?.
FirstOrDefault
();
decimal
SellPrice
=
item
.
SellPrice
;
decimal
OriginalPrice
=
item
.
SellPrice
;
if
(
priceModel
!=
null
)
{
if
(
priceModel
.
PriceType
==
0
)
{
SellPrice
=
Math
.
Round
(
SellPrice
*
(
100
-
priceModel
.
PriceMoney
)
/
100
,
2
);
OriginalPrice
=
Math
.
Round
(
SellPrice
*
(
100
-
priceModel
.
PriceMoney
)
/
100
,
2
);
}
else
{
SellPrice
=
Math
.
Round
(
SellPrice
-
priceModel
.
PriceMoney
,
2
);
OriginalPrice
=
Math
.
Round
(
SellPrice
-
priceModel
.
PriceMoney
,
2
);
}
}
var
obj
=
new
{
item
.
ClassId
,
...
...
Edu.Module.EduTask/OrderChangeModule.cs
View file @
e3f7ae99
...
...
@@ -255,6 +255,9 @@ namespace Edu.Module.EduTask
SourceId
=
0
,
IsLessPrice
=
0
,
LessPrice
=
0
,
PerLessMoney
=
0
,
DiscountMoney
=
0
,
PerDiscountMoney
=
0
,
OrderNature
=
oldOrderModel
.
OrderNature
,
OldPreferPrice
=
newPreferPrice
,
//应收,
CourseId
=
orderChangeModel
.
NewCourseId
,
...
...
@@ -702,6 +705,9 @@ namespace Edu.Module.EduTask
SourceId
=
0
,
IsLessPrice
=
0
,
LessPrice
=
0
,
PerLessMoney
=
0
,
DiscountMoney
=
0
,
PerDiscountMoney
=
0
,
OrderNature
=
oldOrderModel
.
OrderNature
,
OldPreferPrice
=
newPreferPrice
,
//应收,
CourseId
=
orderChangeModel
.
NewCourseId
,
...
...
Edu.Module.Exam/PaperModule.cs
View file @
e3f7ae99
...
...
@@ -5,7 +5,6 @@ using System;
using
System.Collections.Generic
;
using
VT.FW.DB
;
using
System.Linq
;
using
System.Text.RegularExpressions
;
using
Edu.Cache.User
;
using
Edu.Common.Plugin
;
using
Edu.Module.Question
;
...
...
@@ -49,6 +48,11 @@ namespace Edu.Module.Exam
/// </summary>
private
readonly
RB_QuestionRepository
questionRepository
=
new
RB_QuestionRepository
();
/// <summary>
/// 考试发布仓储层对象
/// </summary>
private
readonly
RB_Examination_PublishRepository
examination_PublishRepository
=
new
RB_Examination_PublishRepository
();
/// <summary>
/// 获取试卷分页列表
/// </summary>
...
...
@@ -117,7 +121,7 @@ namespace Edu.Module.Exam
}
/// <summary>
/// 递归遍历所有
章节
/// 递归遍历所有
下级文件夹或试卷
/// </summary>
/// <param name="sourceList">源数据</param>
/// <param name="parentId">父节点编号</param>
...
...
@@ -227,6 +231,7 @@ namespace Edu.Module.Exam
{
foreach
(
var
dItem
in
gitem
.
DetailsList
)
{
dItem
.
PaperId
=
model
.
PaperId
;
if
(
dItem
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
...
@@ -514,11 +519,214 @@ namespace Edu.Module.Exam
/// 根据分组删除分组和题目
/// </summary>
/// <param name="GId"></param>
/// <param name="QuestionTypeId">问题类型编号</param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
RemoveExamnationGroupModule
(
int
GId
,
int
QuestionTypeId
)
{
var
flag
=
true
;
if
(
GId
>
0
)
{
flag
=
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
GId
),
GId
));
}
if
(
flag
&&
QuestionTypeId
>
0
)
{
flag
=
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
QuestionTypeId
),
QuestionTypeId
));
}
return
flag
;
}
/// <summary>
/// 根据试卷编号删除试卷
/// </summary>
/// <param name="PaperId"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
RemoveExamnationPaperModule
(
int
PaperId
)
{
var
flag
=
true
;
if
(
PaperId
>
0
)
{
flag
=
examination_PaperRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
{
flag
=
examination_GroupRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Group_ViewModel
.
PaperId
),
PaperId
));
}
if
(
flag
)
{
flag
=
examination_DetailsRepository
.
DeleteOne
(
new
WhereHelper
(
nameof
(
RB_Examination_Details_ViewModel
.
PaperId
),
PaperId
));
}
return
flag
;
}
/// <summary>
/// 根据试卷编号复制试卷
/// </summary>
/// <param name="PaperId"></param>
/// <returns></returns>
[
TransactionCallHandler
]
public
bool
CopyExamnationPaperModule
(
int
PaperId
)
{
var
flag
=
true
;
var
model
=
GetExaminationPaperModule
(
PaperId
);
if
(
model
==
null
)
{
flag
=
false
;
return
flag
;
}
model
.
PaperId
=
0
;
if
(
model
.
GroupList
!=
null
&&
model
.
GroupList
.
Count
>
0
)
{
foreach
(
var
gItem
in
model
.
GroupList
)
{
gItem
.
GId
=
0
;
gItem
.
PaperId
=
0
;
if
(
gItem
.
DetailsList
!=
null
&&
gItem
.
DetailsList
.
Count
>
0
)
{
foreach
(
var
sItem
in
gItem
.
DetailsList
)
{
sItem
.
Id
=
0
;
sItem
.
PaperId
=
0
;
}
}
}
}
flag
=
SetExaminationPaperModule
(
model
);
return
flag
;
}
/// <summary>
/// 移动试卷
/// </summary>
/// <param name="PaperId">试卷编号</param>
/// <param name="ParentId">父节点编号</param>
/// <returns></returns>
public
bool
MoveExamnationPaperModule
(
int
PaperId
,
int
ParentId
)
{
var
flag
=
true
;
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
ParentId
}
};
flag
=
examination_PaperRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
PaperId
));
return
flag
;
}
/// <summary>
/// 获取文件夹树形结构
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
object
GetFolderTreeModule
(
RB_Examination_Paper_ViewModel
query
)
{
List
<
ExamFolderTreeModel
>
list
=
new
List
<
ExamFolderTreeModel
>();
var
dataList
=
examination_PaperRepository
.
GetExaminationPaperListRepository
(
query
);
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
var
rootList
=
dataList
?.
Where
(
qitem
=>
qitem
.
ParentId
==
0
)?.
ToList
();
foreach
(
var
rItem
in
rootList
)
{
ExamFolderTreeModel
fTreeModel
=
new
ExamFolderTreeModel
()
{
PaperId
=
rItem
.
PaperId
,
ParentId
=
rItem
.
ParentId
,
PaperName
=
rItem
.
PaperName
,
ChildList
=
new
List
<
ExamFolderTreeModel
>()
};
fTreeModel
.
ChildList
=
GetFolderChild
(
dataList
,
rItem
.
PaperId
);
list
.
Add
(
fTreeModel
);
}
}
return
list
;
}
/// <summary>
/// 递归遍历所有下级文件夹
/// </summary>
/// <param name="sourceList">源数据</param>
/// <param name="parentId">父节点编号</param>
/// <returns></returns>
public
List
<
ExamFolderTreeModel
>
GetFolderChild
(
List
<
RB_Examination_Paper_ViewModel
>
sourceList
,
int
parentId
)
{
List
<
ExamFolderTreeModel
>
resultList
=
new
List
<
ExamFolderTreeModel
>();
//获取下级节点
var
subList
=
sourceList
?.
Where
(
qItem
=>
qItem
.
ParentId
==
parentId
).
ToList
();
//如果存在下级节点
if
(
subList
!=
null
&&
subList
.
Count
>
0
)
{
foreach
(
var
childItem
in
subList
)
{
var
childModel
=
new
ExamFolderTreeModel
()
{
PaperId
=
childItem
.
PaperId
,
ParentId
=
childItem
.
ParentId
,
PaperName
=
childItem
.
PaperName
,
ChildList
=
new
List
<
ExamFolderTreeModel
>()
};
childModel
.
ChildList
.
AddRange
(
GetFolderChild
(
sourceList
,
childItem
.
PaperId
));
resultList
.
Add
(
childModel
);
}
}
return
resultList
;
}
/// <summary>
/// 获取发布试卷分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
bool
RemoveExamnationGroupModule
(
int
GId
)
public
List
<
RB_Examination_Publish_ViewModel
>
GetExaminationPublishPageModule
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Examination_Publish_ViewModel
query
)
{
return
false
;
return
examination_PublishRepository
.
GetExaminationPublishPageRepository
(
pageIndex
,
pageSize
,
out
rowsCount
,
query
)
;
}
/// <summary>
/// 新增修改考试发布
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
bool
SetExaminationPublishModule
(
RB_Examination_Publish_ViewModel
model
)
{
bool
flag
=
true
;
if
(
model
.
Id
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
{
{
nameof
(
RB_Examination_Publish_ViewModel
.
PaperId
),
model
.
PaperId
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
PublishType
),
model
.
PublishType
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
ExamStartTime
),
model
.
ExamStartTime
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
ExamEndTime
),
model
.
ExamEndTime
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
ExamTimes
),
model
.
ExamTimes
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
SubmitTimes
),
model
.
SubmitTimes
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
EnterTimes
),
model
.
EnterTimes
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsQuestionRandom
),
model
.
IsQuestionRandom
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsOptionRandom
),
model
.
IsOptionRandom
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsLeaveAnswer
),
model
.
IsLeaveAnswer
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
LeaveTimes
),
model
.
LeaveTimes
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsDisableMultiTerminal
),
model
.
IsDisableMultiTerminal
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsExamType
),
model
.
IsExamType
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
ExamTypeValue
),
model
.
ExamTypeValue
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
ExamNotice
),
model
.
ExamNotice
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
PassScore
),
model
.
PassScore
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsAutoSubmit
),
model
.
IsAutoSubmit
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
FillInIsSubject
),
model
.
FillInIsSubject
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
FillInIsIgnore
),
model
.
FillInIsIgnore
},
{
nameof
(
RB_Examination_Publish_ViewModel
.
IsHalfScore
),
model
.
IsHalfScore
},
};
flag
=
examination_PublishRepository
.
Update
(
fileds
,
new
WhereHelper
(
nameof
(
RB_Examination_Publish_ViewModel
.
Id
),
model
.
Id
));
}
else
{
var
newId
=
examination_PublishRepository
.
Insert
(
model
);
model
.
Id
=
newId
;
flag
=
newId
>
0
;
}
return
flag
;
}
}
}
Edu.Module.QYWeChat/QYWeChatModule.cs
View file @
e3f7ae99
...
...
@@ -10,6 +10,8 @@ using Edu.Model.CacheModel;
using
Edu.Model.ViewModel.WeChat
;
using
Edu.Repository.WeChat
;
using
Edu.ThirdCore.QYWinXin
;
using
Newtonsoft.Json.Linq
;
using
Senparc.Weixin.Work.AdvancedAPIs.OAuth2
;
using
VT.FW.DB
;
namespace
Edu.Module.QYWeChat
...
...
@@ -32,11 +34,11 @@ namespace Edu.Module.QYWeChat
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public
RB_WeChat_Config_ViewModel
GetWeChatConfigModel
(
RB_WeChat_Config_ViewModel
model
)
public
WorkChatConfig
GetWeChatConfigModel
(
RB_WeChat_Config_ViewModel
model
)
{
var
dmodel
=
weChat_ConfigRepository
.
GetList
(
model
).
FirstOrDefault
();
if
(
dmodel
==
null
)
{
dmodel
=
new
RB_WeChat_Config_ViewModel
();
}
return
dmodel
;
//
var dmodel = weChat_ConfigRepository.GetList(model).FirstOrDefault();
//
if (dmodel == null) { dmodel = new RB_WeChat_Config_ViewModel(); }
return
WeChatReidsCache
.
GetWorkChatConfig
(
model
.
Group_Id
)
;
}
/// <summary>
...
...
@@ -79,15 +81,30 @@ namespace Edu.Module.QYWeChat
OperatorEnum
=
OperatorEnum
.
Equal
}
};
bool
flag
=
weChat_ConfigRepository
.
Update
(
keyValues
,
wheres
);
bool
flag
=
false
;
if
(
weChat_ConfigRepository
.
Update
(
keyValues
,
wheres
))
{
flag
=
true
;
//更新缓存
WeChatReidsCache
.
UpdateConfig
(
demdoel
.
Id
);
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
else
{
bool
flag
=
weChat_ConfigRepository
.
Insert
(
demdoel
)
>
0
;
var
id
=
weChat_ConfigRepository
.
Insert
(
demdoel
);
bool
flag
=
false
;
if
(
id
>
0
)
{
flag
=
true
;
//更新缓存
WeChatReidsCache
.
UpdateConfig
(
id
);
}
return
flag
?
""
:
"出错了,请联系管理员"
;
}
}
#
endregion
#
endregion
}
}
Edu.Module.User/GroupModule.cs
View file @
e3f7ae99
...
...
@@ -66,6 +66,16 @@ namespace Edu.Module.User
return
GetGroupListModule
(
new
RB_Group_ViewModel
()
{
GId
=
GId
})?.
FirstOrDefault
()
??
new
RB_Group_ViewModel
();
}
/// <summary>
/// 获取集团实体类
/// </summary>
/// <param name="GId"></param>
/// <returns></returns>
public
RB_Group_ViewModel
GetGroupEntityModule
(
string
workDomainUrl
)
{
return
GetGroupListModule
(
new
RB_Group_ViewModel
()
{
WorkAppDomain
=
workDomainUrl
})?.
FirstOrDefault
()
??
new
RB_Group_ViewModel
();
}
/// <summary>
/// 新增修改集团
/// </summary>
...
...
Edu.Repository/Exam/RB_Examination_PaperRepository.cs
View file @
e3f7ae99
...
...
@@ -43,11 +43,73 @@ WHERE 1=1
builder
.
AppendFormat
(
" AND A.{0} LIKE @PaperName "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperName
));
parameters
.
Add
(
"PaperName"
,
"%"
+
query
.
PaperName
.
Trim
()
+
"%"
);
}
if
(
query
.
ParentId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
query
.
ParentId
);
}
if
(
query
.
PaperId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
PaperId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QPaperIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
QPaperIds
);
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
));
return
GetPage
<
RB_Examination_Paper_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 获取试卷列表
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Examination_Paper_ViewModel
>
GetExaminationPaperListRepository
(
RB_Examination_Paper_ViewModel
query
)
{
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Examination_Paper AS A
WHERE 1=1
"
);
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
0
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
PaperName
))
{
builder
.
AppendFormat
(
" AND A.{0} LIKE @PaperName "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperName
));
parameters
.
Add
(
"PaperName"
,
"%"
+
query
.
PaperName
.
Trim
()
+
"%"
);
}
if
(
query
.
ParentId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
ParentId
),
query
.
ParentId
);
}
if
(
query
.
PaperId
>
0
)
{
builder
.
AppendFormat
(
@" AND A.{0}={1} "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
PaperId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
QPaperIds
))
{
builder
.
AppendFormat
(
@" AND A.{0} IN({1}) "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
),
query
.
QPaperIds
);
}
//查询文件夹
if
(
query
.
IsQueryFolder
==
1
)
{
builder
.
AppendFormat
(
@" AND A.{0}=1 "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperType
));
}
}
builder
.
AppendFormat
(
" ORDER BY A.{0} DESC "
,
nameof
(
RB_Examination_Paper_ViewModel
.
PaperId
));
return
Get
<
RB_Examination_Paper_ViewModel
>(
builder
.
ToString
(),
parameters
).
ToList
();
}
/// <summary>
/// 获取试卷所有下级列表
/// </summary>
...
...
Edu.Repository/Exam/RB_Examination_PublishRepository.cs
0 → 100644
View file @
e3f7ae99
using
Edu.Model.Entity.Exam
;
using
Edu.Model.ViewModel.Exam
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Edu.Repository.Exam
{
/// <summary>
/// 试卷发布仓储层
/// </summary>
public
class
RB_Examination_PublishRepository
:
BaseRepository
<
RB_Examination_Publish
>
{
/// <summary>
/// 获取发布试卷分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="query"></param>
/// <returns></returns>
public
List
<
RB_Examination_Publish_ViewModel
>
GetExaminationPublishPageRepository
(
int
pageIndex
,
int
pageSize
,
out
long
rowsCount
,
RB_Examination_Publish_ViewModel
query
)
{
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
SELECT A.*
FROM RB_Examination_Publish AS A
WHERE 1=1
"
);
if
(
query
!=
null
)
{
if
(
query
.
Group_Id
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Examination_Publish_ViewModel
.
Group_Id
),
query
.
Group_Id
);
}
}
return
GetPage
<
RB_Examination_Publish_ViewModel
>(
pageIndex
,
pageSize
,
out
rowsCount
,
builder
.
ToString
()).
ToList
();
}
}
}
Edu.Repository/User/RB_GroupRepository.cs
View file @
e3f7ae99
...
...
@@ -58,6 +58,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND {0}={1} "
,
nameof
(
RB_Group_ViewModel
.
GId
),
query
.
GId
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
WorkAppDomain
))
{
builder
.
AppendFormat
(
" AND {0}='{1}' "
,
nameof
(
RB_Group_ViewModel
.
WorkAppDomain
),
query
.
WorkAppDomain
);
}
if
(!
string
.
IsNullOrEmpty
(
query
.
WebSiteDomain
))
{
builder
.
AppendFormat
(
" AND {0}='{1}' "
,
nameof
(
RB_Group_ViewModel
.
WebSiteDomain
),
query
.
WebSiteDomain
);
...
...
Edu.ThirdCore/Edu.ThirdCore.csproj
View file @
e3f7ae99
...
...
@@ -19,6 +19,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Cache\Edu.Cache.csproj" />
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
</ItemGroup>
...
...
Edu.ThirdCore/QYWinXin/QYWeiXinConfig.cs
0 → 100644
View file @
e3f7ae99
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Edu.ThirdCore.QYWinXin
{
/// <summary>
///
/// </summary>
public
class
QYWeiXinConfig
{
}
}
Edu.ThirdCore/QYWinXin/QYWeiXinHelper.cs
View file @
e3f7ae99
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Web
;
using
Edu.Cache.User
;
using
Edu.Cache.WeChat
;
using
Edu.Common.Plugin
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
Senparc.Weixin.Work
;
using
Senparc.Weixin.Work.AdvancedAPIs
;
using
Senparc.Weixin.Work.AdvancedAPIs.OAuth2
;
using
Senparc.Weixin.Work.Containers
;
namespace
Edu.ThirdCore.QYWinXin
...
...
@@ -14,6 +19,74 @@ namespace Edu.ThirdCore.QYWinXin
/// </summary>
public
class
QYWeiXinHelper
{
#
region
全局静态
private
static
string
WORK_KEY
=
string
.
Empty
;
#
endregion
#
region
令牌
public
static
string
GetToken
(
int
groupId
,
bool
newToken
=
false
)
{
var
config
=
WeChatReidsCache
.
GetWorkChatConfig
(
groupId
);
if
(
config
!=
null
)
{
var
token
=
AccessTokenContainer
.
GetTokenAsync
(
config
.
WX_CorpId
,
config
.
Employee_Secret
,
newToken
);
return
token
.
Result
;
}
else
{
return
string
.
Empty
;
}
}
#
endregion
/// <summary>
/// 解析用户信息
/// </summary>
/// <param name="groupId"></param>
/// <param name="code"></param>
/// <returns></returns>
public
(
bool
status
,
GetUserInfoResult
result
)
GetLoginWorkUserInfo
(
int
groupId
,
string
code
)
{
var
token
=
GetToken
(
groupId
);
if
(!
string
.
IsNullOrEmpty
(
token
))
{
var
result
=
Senparc
.
Weixin
.
Work
.
AdvancedAPIs
.
OAuth2Api
.
GetUserId
(
token
,
code
);
return
(
true
,
result
);
}
else
{
return
(
false
,
null
);
}
}
/// <summary>
/// 组装跳转地址
/// </summary>
/// <param name="groupId">集团编号</param>
/// <param name="mark">唯一标识</param>
/// <returns></returns>
public
string
GetUserAuthorizationCodePath
(
int
groupId
,
string
mark
)
{
var
config
=
WeChatReidsCache
.
GetWorkChatConfig
(
groupId
);
var
token
=
GetToken
(
groupId
);
if
(!
string
.
IsNullOrEmpty
(
token
))
{
string
redirect_uri
=
$"http://mobileapis.kookaku.com/api/QYWeChat/UserCodeCallBack"
;
string
state
=
mark
;
JObject
cacheContent
=
new
JObject
();
cacheContent
.
Add
(
"group_id"
,
groupId
);
UserReidsCache
.
Set
(
mark
,
cacheContent
,
60
);
return
Senparc
.
Weixin
.
Work
.
AdvancedAPIs
.
OAuth2Api
.
GetCode
(
config
.
WX_CorpId
,
redirect_uri
,
state
,
"1000004"
);
}
else
{
return
string
.
Empty
;
}
}
/// <summary>
/// 获取token
/// </summary>
...
...
Edu.WebApi/Controllers/Course/ClassController.cs
View file @
e3f7ae99
...
...
@@ -182,6 +182,7 @@ namespace Edu.WebApi.Controllers.Course
item
.
ClassName
,
item
.
CouseId
,
item
.
CourseName
,
item
.
ClassNo
,
item
.
Teacher_Id
,
OpenTime
=
Common
.
ConvertHelper
.
FormatDate
(
item
.
OpenTime
),
PlanList
=
planList
...
...
Edu.WebApi/Controllers/Course/OrderController.cs
View file @
e3f7ae99
...
...
@@ -66,7 +66,7 @@ namespace Edu.WebApi.Controllers.Course
{
int
IsInsertClass
=
0
;
//不能插班报入
int
SurplusNum
=
x
.
ClassPersion
-
x
.
OrderStudentCount
;
if
(
x
.
ClassStatus
==
ClassStatusEnum
.
StudyIng
&&
SurplusNum
>
0
)
if
(
x
.
ClassStatus
!=
ClassStatusEnum
.
EndClass
&&
SurplusNum
>
0
)
{
IsInsertClass
=
1
;
//可以插班报入
}
...
...
@@ -480,18 +480,21 @@ namespace Edu.WebApi.Controllers.Course
HelpEnterId
=
base
.
ParmJObj
.
GetInt
(
"HelpEnterId"
),
GeneralOccupation
=
base
.
ParmJObj
.
GetStringValue
(
"GeneralOccupation"
),
EduOccupation
=
base
.
ParmJObj
.
GetStringValue
(
"EduOccupation"
),
IsLessPrice
=
base
.
ParmJObj
.
GetInt
(
"IsLessPrice"
),
LessPrice
=
base
.
ParmJObj
.
GetDecimal
(
"LessPrice"
),
OrderNature
=
(
OrderNatureEnum
)
base
.
ParmJObj
.
GetInt
(
"OrderNature"
),
OldPreferPrice
=
base
.
ParmJObj
.
GetDecimal
(
"OldPreferPrice"
),
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
StartClassHours
=
base
.
ParmJObj
.
GetInt
(
"StartClassHours"
),
EffectTime
=
base
.
ParmJObj
.
GetDateTime
(
"EffectTime"
),
UpOrderId
=
base
.
ParmJObj
.
GetInt
(
"UpOrderId"
),
VisitorReserveId
=
base
.
ParmJObj
.
GetInt
(
"VisitorReserveId"
),
JoinType
=
OrderJoinTypeEnum
.
Normal
,
TargetJoinType
=
OrderJoinTypeEnum
.
Normal
,
DiscountMoney
=
base
.
ParmJObj
.
GetDecimal
(
"DiscountMoney"
),
PerDiscountMoney
=
base
.
ParmJObj
.
GetDecimal
(
"PerDiscountMoney"
),
IsLessPrice
=
base
.
ParmJObj
.
GetInt
(
"IsLessPrice"
),
LessPrice
=
base
.
ParmJObj
.
GetDecimal
(
"LessPrice"
),
PerLessMoney
=
base
.
ParmJObj
.
GetDecimal
(
"PerLessMoney"
),
};
var
IsInsertClass
=
base
.
ParmJObj
.
GetInt
(
"IsChaBan"
);
if
(
IsInsertClass
==
1
)
...
...
@@ -624,6 +627,9 @@ namespace Edu.WebApi.Controllers.Course
model
.
EduOccupation
,
model
.
IsLessPrice
,
model
.
LessPrice
,
model
.
PerLessMoney
,
model
.
DiscountMoney
,
model
.
PerDiscountMoney
,
model
.
OrderNature
,
OrderNatureName
=
model
.
OrderNature
.
ToName
(),
model
.
OldPreferPrice
,
...
...
Edu.WebApi/Controllers/Course/QuestionController.cs
View file @
e3f7ae99
...
...
@@ -53,7 +53,7 @@ namespace Edu.WebApi.Controllers.Course
}
resultList
.
Add
(
new
{
RowNum
=(
pageModel
.
PageIndex
-
1
)*
pageModel
.
PageSize
+
index
,
RowNum
=
(
pageModel
.
PageIndex
-
1
)
*
pageModel
.
PageSize
+
index
,
item
.
BankId
,
item
.
BankNo
,
item
.
BankName
,
...
...
@@ -107,7 +107,7 @@ namespace Edu.WebApi.Controllers.Course
public
ApiResult
RemoveQuestionBank
()
{
var
bankId
=
base
.
ParmJObj
.
GetInt
(
"bankId"
,
0
);
int
status
=
base
.
ParmJObj
.
GetInt
(
"status"
,
0
);
int
status
=
base
.
ParmJObj
.
GetInt
(
"status"
,
0
);
var
flag
=
questionModule
.
RemoveQuestionBankModule
(
bankId
,
status
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
...
...
@@ -138,7 +138,8 @@ namespace Edu.WebApi.Controllers.Course
CourseId
=
base
.
ParmJObj
.
GetInt
(
"CourseId"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
PointName
=
base
.
ParmJObj
.
GetStringValue
(
"PointName"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
)
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
IsShowAllQuestion
=
base
.
ParmJObj
.
GetInt
(
"IsShowAllQuestion"
),
};
try
{
...
...
@@ -171,8 +172,8 @@ namespace Edu.WebApi.Controllers.Course
}
}
catch
{
{
}
var
list
=
questionModule
.
GetQuestionPageListModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
List
<
object
>
resultList
=
new
List
<
object
>();
...
...
@@ -188,18 +189,11 @@ namespace Edu.WebApi.Controllers.Course
item
.
UpdateByName
=
UserReidsCache
.
GetUserLoginInfo
(
item
.
UpdateBy
)?.
AccountName
??
""
;
}
// 定义正则表达式用来匹配 img 标签
string
str
=
@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>"
;
string
str
=
@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>"
;
string
newTitle
=
item
.
Title
;
try
{
newTitle
=
Regex
.
Replace
(
newTitle
,
str
,
"[图片]"
);
}
catch
{
newTitle
=
item
.
Title
;
}
try
{
newTitle
=
Regex
.
Replace
(
newTitle
,
@"<iframe\s*[^>]*>"
,
"[音频"
,
RegexOptions
.
IgnoreCase
);
newTitle
=
Regex
.
Replace
(
newTitle
,
@"</iframe>"
,
"]"
,
RegexOptions
.
IgnoreCase
);
}
...
...
@@ -207,22 +201,34 @@ namespace Edu.WebApi.Controllers.Course
{
newTitle
=
item
.
Title
;
}
resultList
.
Add
(
new
var
obj
=
new
{
Number
=(
pageModel
.
PageIndex
-
1
)*
pageModel
.
PageSize
+
index
,
Number
=
(
pageModel
.
PageIndex
-
1
)
*
pageModel
.
PageSize
+
index
,
item
.
QuestionId
,
item
.
CourseId
,
Title
=
newTitle
,
Title
=
newTitle
,
SourceTitle
=
item
.
Title
,
item
.
QuestionTypeId
,
item
.
QuestionTypeKey
,
QuestionTypeName
=
item
.
QuestionTypeKey
!=
"single-number"
?
item
.
QuestionTypeName
:
"选择题"
,
QuestionTypeName
=
item
.
QuestionTypeKey
!=
"single-number"
?
item
.
QuestionTypeName
:
"选择题"
,
item
.
CreateByName
,
item
.
CreateTimeStr
,
item
.
DifficultyType
,
item
.
CategoryName
,
DifficultyTypeName
=
item
.
DifficultyType
.
ToName
(),
item
.
LevelTypeName
});
;
item
.
LevelTypeName
,
QuestionContent
=
query
.
IsShowAllQuestion
==
1
?
item
.
QuestionContent
:
""
,
AnswerParse
=
query
.
IsShowAllQuestion
==
1
?
item
.
AnswerParse
:
""
,
Knowledge
=
query
.
IsShowAllQuestion
==
1
?
item
.
Knowledge
:
""
,
IsUpdateJobExam
=
query
.
IsShowAllQuestion
==
1
?
item
.
IsUpdateJobExam
:
0
,
Answer
=
query
.
IsShowAllQuestion
==
1
?
item
.
Answer
:
""
,
IsMutex
=
query
.
IsShowAllQuestion
==
1
?
item
.
IsMutex
:
0
,
Category
=
query
.
IsShowAllQuestion
==
1
?
item
.
Category
:
0
,
LevelType
=
query
.
IsShowAllQuestion
==
1
?
item
.
LevelType
:
0
,
BankId
=
query
.
IsShowAllQuestion
==
1
?
item
.
BankId
:
0
,
};
resultList
.
Add
(
obj
);
index
++;
}
pageModel
.
Count
=
rowsCount
;
...
...
@@ -244,7 +250,7 @@ namespace Edu.WebApi.Controllers.Course
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
PointName
=
base
.
ParmJObj
.
GetStringValue
(
"PointName"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
QBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"QBankIds"
),
QBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"QBankIds"
),
};
var
data
=
questionModule
.
GetQuestionCategoryListModule
(
query
);
return
ApiResult
.
Success
(
data
:
data
);
...
...
@@ -329,9 +335,9 @@ namespace Edu.WebApi.Controllers.Course
QuestionTypeKey
=
base
.
ParmJObj
.
GetStringValue
(
"QuestionTypeKey"
),
SortNum
=
base
.
ParmJObj
.
GetInt
(
"SortNum"
),
Title
=
base
.
ParmJObj
.
GetStringValue
(
"Title"
),
Category
=
(
QuestionCategoryEnum
)
base
.
ParmJObj
.
GetInt
(
"Category"
),
LevelType
=
(
LevelTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"LevelType"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
)
Category
=
(
QuestionCategoryEnum
)
base
.
ParmJObj
.
GetInt
(
"Category"
),
LevelType
=
(
LevelTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"LevelType"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
)
};
if
(
string
.
IsNullOrEmpty
(
extModel
.
Title
))
{
...
...
@@ -575,7 +581,7 @@ namespace Edu.WebApi.Controllers.Course
else
if
(
extModel
.
QuestionTypeKey
==
"sharing-choose"
)
{
var
shareList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
List
<
matchingItem
>>>(
extModel
.
QuestionContent
);
if
(
shareList
!=
null
&&
shareList
.
Count
==
2
)
if
(
shareList
!=
null
&&
shareList
.
Count
==
2
)
{
if
(
shareList
[
0
].
Where
(
qitem
=>
string
.
IsNullOrEmpty
(
qitem
.
Content
)).
Count
()
>
0
)
{
...
...
@@ -600,7 +606,7 @@ namespace Edu.WebApi.Controllers.Course
{
return
ApiResult
.
Failed
(
message
:
string
.
Format
(
"请设置题干的正确选项!"
));
}
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"请添加选项!"
);
...
...
@@ -626,7 +632,7 @@ namespace Edu.WebApi.Controllers.Course
var
flag
=
questionModule
.
SetBatchQuestionLevelModule
(
LevelType
,
questionIds
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 选择题验证
/// </summary>
...
...
@@ -690,7 +696,7 @@ namespace Edu.WebApi.Controllers.Course
string
message
=
""
;
if
(
string
.
IsNullOrEmpty
(
answer
))
{
message
=
"请填写简答题答案!"
;
message
=
"请填写简答题答案!"
;
}
return
message
;
}
...
...
@@ -704,7 +710,7 @@ namespace Edu.WebApi.Controllers.Course
{
var
QuestionId
=
base
.
ParmJObj
.
GetInt
(
"QuestionId"
,
0
);
int
isReplaceClozeTitle
=
base
.
ParmJObj
.
GetInt
(
"isReplaceClozeTitle"
,
0
);
var
extModel
=
questionModule
.
GetQuestionModule
(
QuestionId
,
isReplaceClozeTitle
:
isReplaceClozeTitle
);
var
extModel
=
questionModule
.
GetQuestionModule
(
QuestionId
,
isReplaceClozeTitle
:
isReplaceClozeTitle
);
return
ApiResult
.
Success
(
data
:
extModel
);
}
...
...
@@ -715,7 +721,7 @@ namespace Edu.WebApi.Controllers.Course
[
HttpPost
]
public
ApiResult
SetQuestionBeatch
()
{
bool
flag
=
false
;
bool
flag
=
false
;
var
list
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
RB_Question_ViewModel
>>(
RequestParm
.
Msg
.
ToString
());
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
...
...
@@ -865,7 +871,7 @@ namespace Edu.WebApi.Controllers.Course
/// 导入Excel问题
/// </summary>
/// <returns></returns>
public
ApiResult
ImportExcelQuestion
(
string
filePath
,
int
CourseId
,
int
Uid
)
public
ApiResult
ImportExcelQuestion
(
string
filePath
,
int
CourseId
,
int
Uid
)
{
var
userInfo
=
base
.
GetUserInfo
(
Uid
);
var
resultList
=
new
List
<
RB_Question_ViewModel
>();
...
...
@@ -885,7 +891,7 @@ namespace Edu.WebApi.Controllers.Course
}
}
System
.
IO
.
File
.
Delete
(
filePath
);
return
ApiResult
.
Success
(
data
:
resultList
);
return
ApiResult
.
Success
(
data
:
resultList
);
}
/// <summary>
...
...
@@ -978,8 +984,8 @@ namespace Edu.WebApi.Controllers.Course
AnswerParse
=
item
.
AnswerAnalysis
,
QuestionTypeId
=
questionTypeModel
?.
QId
??
0
,
QuestionTypeKey
=
questionTypeModel
?.
Key
??
""
,
QuestionTypeName
=
questionTypeModel
?.
Name
??
""
,
Category
=
Category
QuestionTypeName
=
questionTypeModel
?.
Name
??
""
,
Category
=
Category
};
Int32
.
TryParse
(
item
.
ChooseOptionCount
,
out
int
ChooseOptionCount
);
switch
(
item
.
QuestionTypeName
)
...
...
@@ -1285,23 +1291,23 @@ namespace Edu.WebApi.Controllers.Course
case
"阅读理解"
:
List
<
readingComprehensioItem
>
readingList
=
new
List
<
readingComprehensioItem
>();
foreach
(
var
subItem
in
item
.
SubQuestionList
)
{
foreach
(
var
subItem
in
item
.
SubQuestionList
)
{
Int32
.
TryParse
(
subItem
.
ChooseOptionCount
,
out
int
subChooseCount
);
List
<
optionItem
>
singleList
=
new
List
<
optionItem
>();
switch
(
subItem
.
QuestionTypeName
)
{
//单选题
case
"单选题"
:
{
//单选题
case
"单选题"
:
readingComprehensioItem
readingModel
=
new
readingComprehensioItem
()
{
QuestionKey
=
"single"
,
QuestionName
=
"单选题"
,
QuestionType
=
1
,
SubTitle
=
subItem
.
QuestionTitle
,
SubAnwser
=
new
object
()
SubAnwser
=
new
object
()
};
for
(
var
i
=
0
;
i
<
subChooseCount
;
i
++)
{
var
singleModel
=
new
optionItem
()
...
...
@@ -1344,14 +1350,14 @@ namespace Edu.WebApi.Controllers.Course
SubTitle
=
subItem
.
QuestionTitle
,
SubAnwser
=
new
object
()
};
for
(
var
i
=
0
;
i
<
subChooseCount
;
i
++)
{
var
singleModel
=
new
optionItem
()
{
Name
=
(
i
+
1
).
ToString
(),
Name
=
(
i
+
1
).
ToString
(),
Content
=
""
,
IsAnswer
=
subItem
.
QuestionAnswer
.
Trim
()
==(
i
+
1
).
ToString
()
IsAnswer
=
subItem
.
QuestionAnswer
.
Trim
()
==
(
i
+
1
).
ToString
()
};
if
(
i
==
0
)
{
...
...
@@ -1378,8 +1384,8 @@ namespace Edu.WebApi.Controllers.Course
readingModel2
.
SubAnwser
=
singleList
;
readingList
.
Add
(
readingModel2
);
break
;
}
}
}
model
.
QuestionContent
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
readingList
);
if
(
model
.
QuestionTypeId
==
0
)
{
...
...
@@ -1390,7 +1396,7 @@ namespace Edu.WebApi.Controllers.Course
break
;
case
"单选题(数字)"
:
AnalysisSingle
(
ChooseOptionCount
,
item
,
model
,
questionTypeList
,
isNumChoose
:
true
);
AnalysisSingle
(
ChooseOptionCount
,
item
,
model
,
questionTypeList
,
isNumChoose
:
true
);
break
;
}
model
.
QuestionContentObj
=
questionModule
.
ParsingQuestionModule
(
model
.
QuestionTypeKey
,
model
.
QuestionContent
);
...
...
@@ -1405,7 +1411,7 @@ namespace Edu.WebApi.Controllers.Course
/// <param name="model"></param>
/// <param name="questionTypeList"></param>
/// <param name="isNumChoose">是否数字选择题</param>
private
void
AnalysisSingle
(
int
ChooseOptionCount
,
ImportModel
item
,
RB_Question_ViewModel
model
,
List
<
RB_Question_Type_ViewModel
>
questionTypeList
,
bool
isNumChoose
=
false
)
private
void
AnalysisSingle
(
int
ChooseOptionCount
,
ImportModel
item
,
RB_Question_ViewModel
model
,
List
<
RB_Question_Type_ViewModel
>
questionTypeList
,
bool
isNumChoose
=
false
)
{
if
(
ChooseOptionCount
>
0
)
{
...
...
Edu.WebApi/Controllers/Course/StuController.cs
View file @
e3f7ae99
...
...
@@ -31,6 +31,9 @@ namespace Edu.WebApi.Controllers.Course
/// </summary>
private
readonly
StudentBillModule
studentBillModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
StudentBillModule
>();
/// <summary>
/// 订单处理类对象
/// </summary>
private
readonly
OrderModule
orderModule
=
AOP
.
AOPHelper
.
CreateAOPObject
<
OrderModule
>();
/// <summary>
...
...
@@ -63,11 +66,6 @@ namespace Edu.WebApi.Controllers.Course
var
SpecialNode
=
base
.
ParmJObj
.
GetInt
(
"SpecialNode"
);
//抄送人
string
RecipientIds
=
base
.
ParmJObj
.
GetStringValue
(
"RecipientIds"
);
// var flag = studentBillModule.SetBackBillAduitModule(BackId, AuditStatus, Description, base.UserInfo, out string message, SpecialNode: SpecialNode, BackMoney: BackMoney, RecipientIds: RecipientIds);
//return flag ? ApiResult.Success(message: message) : ApiResult.Failed(message: message);
return
ApiResult
.
Failed
();
}
...
...
@@ -140,6 +138,9 @@ namespace Edu.WebApi.Controllers.Course
SourceId
=
0
,
IsLessPrice
=
0
,
LessPrice
=
0
,
PerLessMoney
=
0
,
DiscountMoney
=
0
,
PerDiscountMoney
=
0
,
OrderNature
=
oldOrderModel
.
OrderNature
,
OldPreferPrice
=
base
.
ParmJObj
.
GetDecimal
(
"PreferPrice"
),
//应收,
CourseId
=
0
,
...
...
@@ -164,6 +165,7 @@ namespace Edu.WebApi.Controllers.Course
orderModel
.
UpdateBy
=
base
.
UserInfo
.
Id
;
orderModel
.
UpdateTime
=
DateTime
.
Now
;
orderModel
.
OldGuestId
=
guestId
;
bool
flag
=
orderModule
.
SetClassOrderModule
(
orderModel
,
base
.
UserInfo
,
base
.
CheckUserActionAuth
(
"Edit_Order"
),
out
string
message
);
if
(
flag
)
{
...
...
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
e3f7ae99
using
Edu.Cache.User
;
using
Edu.Common.API
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Course
;
using
Edu.Common.Enum.Question
;
using
Edu.Common.Plugin
;
...
...
@@ -11,8 +10,6 @@ using Microsoft.AspNetCore.Mvc;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Threading.Tasks
;
namespace
Edu.WebApi.Controllers.Exam
{
...
...
@@ -41,6 +38,9 @@ namespace Edu.WebApi.Controllers.Exam
var
query
=
new
RB_Examination_Paper_ViewModel
()
{
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
QPaperIds
=
base
.
ParmJObj
.
GetStringValue
(
"QPaperIds"
)
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
...
...
@@ -78,14 +78,14 @@ namespace Edu.WebApi.Controllers.Exam
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
PaperName
=
base
.
ParmJObj
.
GetStringValue
(
"PaperName"
),
QuestionBandIds
=
base
.
ParmJObj
.
GetStringValue
(
"QuestionBandIds"
),
DifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
DifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
CreateBy
=
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
GenerateType
=
base
.
ParmJObj
.
GetInt
(
"GenerateType"
),
CreateNum
=
base
.
ParmJObj
.
GetInt
(
"CreateNum"
),
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
GenerateType
=
base
.
ParmJObj
.
GetInt
(
"GenerateType"
),
CreateNum
=
base
.
ParmJObj
.
GetInt
(
"CreateNum"
),
PaperType
=
base
.
ParmJObj
.
GetInt
(
"PaperType"
),
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
};
extModel
.
GroupList
=
new
List
<
RB_Examination_Group_ViewModel
>();
string
groups
=
base
.
ParmJObj
.
GetStringValue
(
"GroupList"
);
...
...
@@ -105,7 +105,7 @@ namespace Edu.WebApi.Controllers.Exam
GroupName
=
jobj
.
GetStringValue
(
"GroupName"
),
QuestionTypeId
=
jobj
.
GetInt
(
"QuestionTypeId"
),
QuestionTypeKey
=
jobj
.
GetStringValue
(
"QuestionTypeKey"
),
GSortNum
=
gSortNum
,
GSortNum
=
gSortNum
,
DetailsList
=
new
List
<
RB_Examination_Details_ViewModel
>(),
};
gSortNum
++;
...
...
@@ -168,14 +168,14 @@ namespace Edu.WebApi.Controllers.Exam
TemplateName
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateName"
),
TemplateScore
=
base
.
ParmJObj
.
GetDecimal
(
"TemplateScore"
),
TemplateNum
=
base
.
ParmJObj
.
GetInt
(
"TemplateNum"
),
TemplateDifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
TemplateBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateBankIds"
),
TemplateDifficultyType
=
(
DifficultyTypeEnum
)
base
.
ParmJObj
.
GetInt
(
"DifficultyType"
),
TemplateBankIds
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateBankIds"
),
CreateBy
=
UserInfo
.
Id
,
CreateTime
=
DateTime
.
Now
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
School_Id
=
base
.
UserInfo
.
School_Id
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
School_Id
=
base
.
UserInfo
.
School_Id
,
Status
=
Common
.
Enum
.
DateStateEnum
.
Normal
,
IsSaveTemplate
=
base
.
ParmJObj
.
GetBoolValue
(
"IsSaveTemplate"
),
};
string
TemplateData
=
base
.
ParmJObj
.
GetStringValue
(
"TemplateData"
);
if
(!
string
.
IsNullOrEmpty
(
TemplateData
))
...
...
@@ -229,7 +229,7 @@ namespace Edu.WebApi.Controllers.Exam
{
tempStr
+=
"、"
+
string
.
Format
(
"{0}:{1}"
,
tItem
.
DifficultyType
.
ToName
(),
tItem
.
ChooseNum
);
}
QuestionStructure
+=
";"
+
string
.
Format
(
"{0}:{1}"
,
sItem
.
QuestionTypeName
,
tempStr
.
TrimStart
(
'、'
));
QuestionStructure
+=
";"
+
string
.
Format
(
"{0}:{1}"
,
sItem
.
QuestionTypeName
,
tempStr
.
TrimStart
(
'、'
));
}
}
}
...
...
@@ -241,10 +241,10 @@ namespace Edu.WebApi.Controllers.Exam
item
.
TemplateScore
,
item
.
TemplateNum
,
item
.
TemplateDifficultyType
,
TemplateDifficultyTypeName
=
item
.
TemplateDifficultyType
.
ToName
(),
TemplateData
=
templist
,
TemplateDifficultyTypeName
=
item
.
TemplateDifficultyType
.
ToName
(),
TemplateData
=
templist
,
item
.
TemplateBankIds
,
QuestionStructure
=
QuestionStructure
.
TrimStart
(
';'
)
QuestionStructure
=
QuestionStructure
.
TrimStart
(
';'
)
});
}
pageModel
.
Count
=
rowsCount
;
...
...
@@ -252,12 +252,12 @@ namespace Edu.WebApi.Controllers.Exam
return
ApiResult
.
Success
(
data
:
pageModel
);
}
/// <summary>
/// 新增修改文件夹
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
SetPaperFolder
()
{
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
...
...
@@ -277,8 +277,7 @@ namespace Edu.WebApi.Controllers.Exam
bool
flag
=
paperModule
.
SetExaminationPaperFolderModule
(
extModel
);
return
flag
?
ApiResult
.
Success
(
data
:
extModel
)
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据编号获取试卷信息
...
...
@@ -294,15 +293,147 @@ namespace Edu.WebApi.Controllers.Exam
/// <summary>
/// 根据编号删除试卷题目
/// 根据试卷详情编号删除
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaperDetails
()
{
var
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
);
var
flag
=
paperModule
.
RemoveExaminationDetailsModule
(
Id
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷分组编号删除
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaperGroup
()
{
var
GId
=
base
.
ParmJObj
.
GetInt
(
"GId"
);
var
QuestionTypeId
=
base
.
ParmJObj
.
GetInt
(
"QuestionTypeId"
);
var
flag
=
paperModule
.
RemoveExamnationGroupModule
(
GId
,
QuestionTypeId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷编号删除试卷
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
flag
=
paperModule
.
RemoveExamnationPaperModule
(
PaperId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 根据试卷编号复制试卷
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
DeletePaperQuestion
()
public
ApiResult
CopyPaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
model
=
paperModule
.
RemoveExaminationDetailsModule
(
PaperId
);
return
ApiResult
.
Success
(
data
:
model
);
var
flag
=
paperModule
.
CopyExamnationPaperModule
(
PaperId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 移动试卷或文件夹
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
MovePaper
()
{
var
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
);
var
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
);
var
flag
=
paperModule
.
MoveExamnationPaperModule
(
PaperId
,
ParentId
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取文件夹树形结构
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetFolderTree
()
{
var
extModel
=
new
RB_Examination_Paper_ViewModel
()
{
CreateBy
=
UserInfo
.
Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
ParentId
=
base
.
ParmJObj
.
GetInt
(
"ParentId"
),
IsQueryFolder
=
1
,
};
var
obj
=
paperModule
.
GetFolderTreeModule
(
extModel
);
return
ApiResult
.
Success
(
data
:
obj
);
}
/// <summary>
/// 发布考试
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
PublishExam
()
{
var
model
=
new
RB_Examination_Publish_ViewModel
()
{
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
),
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
PublishType
=
base
.
ParmJObj
.
GetInt
(
"PublishType"
),
ExamStartTime
=
base
.
ParmJObj
.
GetDateTime
(
"ExamStartTime"
),
ExamEndTime
=
base
.
ParmJObj
.
GetDateTime
(
"ExamEndTime"
),
ExamTimes
=
base
.
ParmJObj
.
GetInt
(
"ExamTimes"
),
SubmitTimes
=
base
.
ParmJObj
.
GetInt
(
"SubmitTimes"
),
EnterTimes
=
base
.
ParmJObj
.
GetInt
(
"EnterTimes"
),
IsQuestionRandom
=
base
.
ParmJObj
.
GetInt
(
"IsQuestionRandom"
),
IsOptionRandom
=
base
.
ParmJObj
.
GetInt
(
"IsOptionRandom"
),
IsLeaveAnswer
=
base
.
ParmJObj
.
GetInt
(
"IsLeaveAnswer"
),
LeaveTimes
=
base
.
ParmJObj
.
GetInt
(
"LeaveTimes"
),
IsDisableMultiTerminal
=
base
.
ParmJObj
.
GetInt
(
"IsDisableMultiTerminal"
),
IsExamType
=
base
.
ParmJObj
.
GetInt
(
"IsExamType"
),
ExamTypeValue
=
base
.
ParmJObj
.
GetInt
(
"ExamTypeValue"
),
ExamNotice
=
base
.
ParmJObj
.
GetStringValue
(
"ExamNotice"
),
PassScore
=
base
.
ParmJObj
.
GetDecimal
(
"PassScore"
),
IsAutoSubmit
=
base
.
ParmJObj
.
GetInt
(
"IsAutoSubmit"
),
FillInIsSubject
=
base
.
ParmJObj
.
GetInt
(
"FillInIsSubject"
),
FillInIsIgnore
=
base
.
ParmJObj
.
GetInt
(
"FillInIsIgnore"
),
IsHalfScore
=
base
.
ParmJObj
.
GetInt
(
"IsHalfScore"
),
};
model
.
CreateBy
=
base
.
UserInfo
.
Id
;
model
.
CreateTime
=
DateTime
.
Now
;
model
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
model
.
School_Id
=
base
.
UserInfo
.
School_Id
;
model
.
Status
=
0
;
var
flag
=
paperModule
.
SetExaminationPublishModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
/// <summary>
/// 获取发布考试分页列表
/// </summary>
/// <returns></returns>
[
HttpPost
]
public
ApiResult
GetPublishExamPage
()
{
var
pageModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
ResultPageModel
>(
RequestParm
.
Msg
.
ToString
());
var
query
=
new
RB_Examination_Publish_ViewModel
()
{
PaperId
=
base
.
ParmJObj
.
GetInt
(
"PaperId"
),
};
query
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
List
<
object
>
result
=
new
List
<
object
>();
var
list
=
paperModule
.
GetExaminationPublishPageModule
(
pageModel
.
PageIndex
,
pageModel
.
PageSize
,
out
long
rowsCount
,
query
);
foreach
(
var
item
in
list
)
{
result
.
Add
(
item
);
}
pageModel
.
Count
=
rowsCount
;
pageModel
.
PageData
=
result
;
return
ApiResult
.
Success
(
data
:
pageModel
);
}
}
}
Edu.WebApi/Controllers/QYWeChat/QYWeChatController.cs
View file @
e3f7ae99
...
...
@@ -3,12 +3,16 @@ using System.Collections.Generic;
using
System.Linq
;
using
System.Threading.Tasks
;
using
Edu.Cache.User
;
using
Edu.Common
;
using
Edu.Common.API
;
using
Edu.Common.Enum.Finance
;
using
Edu.Common.Plugin
;
using
Edu.Model.ViewModel.WeChat
;
using
Edu.Module.QYWeChat
;
using
Edu.Module.User
;
using
Edu.ThirdCore.QYWinXin
;
using
Edu.WebApi.Filter
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Cors
;
using
Microsoft.AspNetCore.Mvc
;
using
Newtonsoft.Json.Linq
;
...
...
@@ -29,6 +33,8 @@ namespace Edu.WebApi.Controllers.Finance
/// </summary>
private
readonly
QYWeChatModule
weChatModule
=
new
QYWeChatModule
();
private
readonly
GroupModule
groupModule
=
new
GroupModule
();
#
region
微信配置
/// <summary>
/// 获取活动配置
...
...
@@ -83,5 +89,135 @@ namespace Edu.WebApi.Controllers.Finance
}
#
endregion
#
region
企业微信客户端
API
/// <summary>
/// 获取企业微信TOKEN
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetWorkToken
()
{
var
referer
=
Request
.
Headers
[
"Origin"
].
ToString
().
Replace
(
"http://"
,
""
);
if
(!
string
.
IsNullOrEmpty
(
referer
))
{
var
group
=
groupModule
.
GetGroupEntityModule
(
referer
);
if
(
group
.
GId
!=
0
)
{
var
query
=
QYWeiXinHelper
.
GetToken
(
group
.
GId
);
if
(!
string
.
IsNullOrEmpty
(
query
))
{
return
ApiResult
.
Success
(
data
:
query
);
}
else
{
return
ApiResult
.
Failed
(
message
:
"解析用户信息失败"
);
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"未知的集团信息"
);
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"未找到域名来源"
);
}
}
/// <summary>
/// 发起登录请求
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
SetUserAutoLogin
()
{
var
referer
=
Request
.
Headers
[
"Origin"
].
ToString
().
Replace
(
"http://"
,
""
);
if
(!
string
.
IsNullOrEmpty
(
referer
))
{
var
group
=
groupModule
.
GetGroupEntityModule
(
referer
);
if
(
group
.
GId
!=
0
)
{
var
query
=
JObject
.
Parse
(
RequestParm
.
Msg
.
ToString
());
var
mark
=
query
.
GetStringValue
(
"mark"
);
var
path
=
new
QYWeiXinHelper
().
GetUserAuthorizationCodePath
(
group
.
GId
,
mark
);
if
(!
string
.
IsNullOrEmpty
(
path
))
{
HttpHelper
.
HttpGet
(
path
);
return
ApiResult
.
Success
(
data
:
path
);
}
else
{
return
ApiResult
.
Failed
(
message
:
"获取登录信息失败"
);
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"未知的集团信息"
);
}
}
else
{
return
ApiResult
.
Failed
(
message
:
"未找到域名来源"
);
}
}
/// <summary>
/// 获取登录信息
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowAnonymous
]
public
ApiResult
GetLoginUserInfo
()
{
var
mark
=
JObject
.
FromObject
(
RequestParm
.
Msg
).
GetStringValue
(
"mark"
);
mark
+=
"_Finish"
;
if
(
UserReidsCache
.
Exists
(
mark
))
{
var
cacheObj
=
UserReidsCache
.
Get
(
mark
);
var
cacheContent
=
JObject
.
FromObject
(
cacheObj
);
return
ApiResult
.
Success
(
data
:
cacheContent
[
"user"
].
ToString
());
}
else
{
return
ApiResult
.
Success
(
data
:
""
);
}
}
/// <summary>
/// 获取用户Code
/// </summary>
/// <returns></returns>
[
HttpGet
]
[
AllowAnonymous
]
public
IActionResult
UserCodeCallBack
()
{
var
mark
=
Request
.
Query
[
"state"
].
ToString
();
var
code
=
Request
.
Query
[
"code"
].
ToString
();
var
cacheObj
=
UserReidsCache
.
Get
(
mark
);
if
(
cacheObj
!=
null
&&
!
string
.
IsNullOrEmpty
(
code
))
{
var
cacheContent
=
JObject
.
FromObject
(
cacheObj
);
var
userInfo
=
new
QYWeiXinHelper
().
GetLoginWorkUserInfo
(
cacheContent
.
GetInt
(
"group_id"
),
code
);
if
(
userInfo
.
status
)
{
cacheContent
.
Add
(
"user"
,
JObject
.
FromObject
(
userInfo
.
result
));
UserReidsCache
.
Set
(
mark
+
"_Finish"
,
cacheContent
,
60
);
}
}
var
redirect_url
=
$"
{
Config
.
WorkAPPDomain
}
/login?mark=
{
mark
}
"
;
return
Redirect
(
redirect_url
);
}
#
endregion
}
}
Edu.WebApi/Startup.cs
View file @
e3f7ae99
...
...
@@ -12,6 +12,8 @@ using Microsoft.Extensions.DependencyInjection;
using
Microsoft.Extensions.Hosting
;
using
Microsoft.Extensions.Options
;
using
Senparc.CO2NET
;
using
Senparc.CO2NET.RegisterServices
;
using
Senparc.Weixin
;
using
Senparc.Weixin.Entities
;
using
Senparc.Weixin.RegisterServices
;
using
Senparc.Weixin.Work
;
...
...
@@ -42,6 +44,7 @@ namespace Edu.WebApi
List
<
string
>
corsArray
=
new
List
<
string
>()
{
"http://192.168.20.214:8400"
,
"http://localhost"
,
"http://localhost:8400"
,
"http://localhost:8081"
,
"http://localhost:8080"
,
...
...
@@ -68,15 +71,23 @@ namespace Edu.WebApi
"https://edu.kookaku.com"
,
"https://eduapi.oytour.com"
,
"http://eduapi.oytour.com"
,
"http://mobile.kookaku.com"
};
services
.
AddCors
(
options
=>
options
.
AddPolicy
(
"AllowCors"
,
policy
=>
policy
.
AllowAnyHeader
().
AllowAnyMethod
().
AllowCredentials
().
WithOrigins
(
corsArray
.
ToArray
())));
services
.
Configure
<
IISServerOptions
>(
options
=>
options
.
AllowSynchronousIO
=
true
);
services
.
AddSingleton
<
IHttpContextAccessor
,
HttpContextAccessor
>();
services
.
AddMemoryCache
();
//使用本地缓存必须添加
services
.
AddSenparcGlobalServices
(
Configuration
)
//Senparc.CO2NET 全局注册
.
AddSenparcWeixinServices
(
Configuration
);
services
.
AddSenparcWeixinServices
(
Configuration
);
//注册全局微信服务
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
,
IHostApplicationLifetime
appLifetime
)
public
void
Configure
(
IApplicationBuilder
app
,
IWebHostEnvironment
env
,
IHostApplicationLifetime
appLifetime
,
IOptions
<
SenparcSetting
>
senparcSetting
,
IOptions
<
SenparcWeixinSetting
>
senparcWeixinSetting
)
{
if
(
env
.
IsDevelopment
())
{
...
...
@@ -120,6 +131,9 @@ namespace Edu.WebApi
Path
.
Combine
(
Directory
.
GetCurrentDirectory
(),
"upfile"
)),
RequestPath
=
"/upfile"
});
IRegisterService
register
=
RegisterService
.
Start
(
senparcSetting
.
Value
).
UseSenparcGlobal
();
register
.
UseSenparcWeixin
(
senparcWeixinSetting
.
Value
,
senparcSetting
.
Value
);
}
}
}
\ No newline at end of file
Edu.WebApi/appsettings.json
View file @
e3f7ae99
...
...
@@ -29,6 +29,7 @@
"UploadSiteUrl"
:
"http://192.168.1.36:8120"
,
"ViewFileSiteUrl"
:
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com"
,
"ErpViewFileSiteUrl"
:
"http://imgfile.oytour.com"
,
"WorkAPPDomain"
:
"http://mobile.kookaku.com"
,
"Mongo"
:
"mongodb://47.96.25.130:27017"
,
"MongoDBName"
:
"Edu"
,
"WkHtmlToPdfPath"
:
"D:/wkhtmltopdf/bin/"
,
...
...
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