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
fca9d00e
Commit
fca9d00e
authored
Dec 03, 2020
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
8fd0bae0
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
110 additions
and
299 deletions
+110
-299
StringHelper.cs
Edu.Common/Plugin/StringHelper.cs
+1
-146
DepartmentTree_ViewModel.cs
Edu.Model/ViewModel/User/DepartmentTree_ViewModel.cs
+5
-0
CourseModule.cs
Edu.Module.Course/CourseModule.cs
+19
-5
MsgLogModule.cs
Edu.Module.System/MsgLogModule.cs
+4
-23
DepartmentModule.cs
Edu.Module.User/DepartmentModule.cs
+21
-15
Edu.ThirdCore.csproj
Edu.ThirdCore/Edu.ThirdCore.csproj
+4
-0
MessageCore.cs
Edu.ThirdCore/Message/MessageCore.cs
+18
-79
QueueHelper.cs
Edu.ThirdCore/Message/QueueHelper.cs
+1
-1
SMSService.cs
Edu.ThirdCore/Message/SMSService.cs
+29
-23
MsgController.cs
Edu.WebApi/Controllers/Public/MsgController.cs
+8
-6
UserController.cs
Edu.WebApi/Controllers/User/UserController.cs
+0
-1
No files found.
Edu.Common/Plugin/StringHelper.cs
View file @
fca9d00e
...
...
@@ -175,25 +175,6 @@ namespace Edu.Common.Plugin
return
""
;
}
/// <summary>
/// 时间戳转换为时间
/// </summary>
/// <param name="ticks"></param>
/// <returns></returns>
public
static
DateTime
GetDateTimeByTicks
(
string
ticks
)
{
try
{
DateTime
startTime
=
TimeZone
.
CurrentTimeZone
.
ToLocalTime
(
new
System
.
DateTime
(
1970
,
1
,
1
));
// 当地时区
DateTime
dt
=
startTime
.
AddMilliseconds
(
long
.
Parse
(
ticks
));
return
dt
;
}
catch
(
Exception
)
{
return
new
DateTime
(
1970
,
1
,
1
);
}
}
/// <summary>
/// 获取年份月份中的最后一天
/// </summary>
...
...
@@ -205,25 +186,6 @@ namespace Edu.Common.Plugin
return
new
DateTime
(
year
,
month
,
1
).
AddMonths
(
1
).
AddDays
(-
1
);
}
/// <summary>
/// 是否为日期+时间型字符串
/// </summary>
/// <param name="StrSource"></param>
/// <returns></returns>
public
static
bool
IsDateTime
(
object
StrSource
)
{
DateTime
dt
=
DateTime
.
Now
;
if
(
DateTime
.
TryParse
(
StrSource
.
ToString
(),
out
dt
))
{
return
true
;
}
else
{
return
false
;
}
}
/// <summary>
/// 时间
/// </summary>
...
...
@@ -620,17 +582,6 @@ namespace Edu.Common.Plugin
return
Encoding
.
Default
.
GetString
(
Byt
);
}
/// <summary>
/// 截取指定长度HTML内容 (该方法未完成)
/// </summary>
/// <param name="html"></param>
/// <param name="len"></param>
/// <returns></returns>
public
static
string
SubstringHTML
(
string
html
,
int
len
)
{
return
""
;
}
/// <summary>
/// 截取指定长度字符
/// </summary>
...
...
@@ -1170,77 +1121,6 @@ namespace Edu.Common.Plugin
#
endregion
#
region
Url
获取
Get
参数
/// <summary>
/// 将查询字符串解析转换为名值集合.
/// </summary>
/// <param name="queryString"></param>
/// <returns></returns>
public
static
NameValueCollection
GetQueryString
(
string
queryString
)
{
return
GetQueryString
(
queryString
,
null
,
true
);
}
/// <summary>
/// 将查询字符串解析转换为名值集合.
/// </summary>
/// <param name="queryString"></param>
/// <param name="encoding"></param>
/// <param name="isEncoded"></param>
/// <returns></returns>
public
static
NameValueCollection
GetQueryString
(
string
queryString
,
Encoding
encoding
,
bool
isEncoded
)
{
queryString
=
queryString
.
TrimStart
(
'?'
);
NameValueCollection
result
=
new
NameValueCollection
(
StringComparer
.
OrdinalIgnoreCase
);
if
(!
string
.
IsNullOrEmpty
(
queryString
))
{
int
count
=
queryString
.
Length
;
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
int
startIndex
=
i
;
int
index
=
-
1
;
while
(
i
<
count
)
{
char
item
=
queryString
[
i
];
if
(
item
==
'='
)
{
if
(
index
<
0
)
{
index
=
i
;
}
}
else
if
(
item
==
'&'
)
{
break
;
}
i
++;
}
string
key
=
null
;
string
value
=
null
;
if
(
index
>=
0
)
{
key
=
queryString
.
Substring
(
startIndex
,
index
-
startIndex
);
value
=
queryString
.
Substring
(
index
+
1
,
(
i
-
index
)
-
1
);
}
else
{
key
=
queryString
.
Substring
(
startIndex
,
i
-
startIndex
);
}
if
(
isEncoded
)
{
result
[
MyUrlDeCode
(
key
,
encoding
)]
=
MyUrlDeCode
(
value
,
encoding
);
}
else
{
result
[
key
]
=
value
;
}
if
((
i
==
(
count
-
1
))
&&
(
queryString
[
i
]
==
'&'
))
{
result
[
key
]
=
string
.
Empty
;
}
}
}
return
result
;
}
/// <summary>
/// 解码URL.
...
...
@@ -1384,7 +1264,7 @@ namespace Edu.Common.Plugin
/// <returns></returns>
public
static
string
GetStarString
(
string
Input
)
{
string
Output
=
""
;
string
Output
;
switch
(
Input
.
Length
)
{
case
1
:
...
...
@@ -1433,31 +1313,6 @@ namespace Edu.Common.Plugin
return
str
;
}
/// <summary>
/// 获取缓存时间
/// </summary>
/// <returns></returns>
public
static
string
GetCacheDateTime
()
{
string
str
=
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmm"
);
int
lastM
=
Convert
.
ToInt32
(
str
.
Substring
(
str
.
Length
-
1
,
1
));
string
mType
=
"0"
;
if
(
lastM
>=
0
&&
lastM
<=
3
)
{
mType
=
"0"
;
}
if
(
lastM
>=
4
&&
lastM
<=
6
)
{
mType
=
"1"
;
}
if
(
lastM
>=
7
&&
lastM
<=
9
)
{
mType
=
"2"
;
}
string
newStr
=
str
.
Substring
(
0
,
str
.
Length
-
1
)
+
mType
;
return
newStr
;
}
/// <summary>
/// 繁体字转简体
/// </summary>
...
...
Edu.Model/ViewModel/User/DepartmentTree_ViewModel.cs
View file @
fca9d00e
...
...
@@ -23,6 +23,11 @@ namespace Edu.Model.ViewModel.User
/// </summary>
public
int
ParentId
{
get
;
set
;
}
/// <summary>
/// 校区编号
/// </summary>
public
int
School_Id
{
get
;
set
;
}
/// <summary>
/// 下级部门列表
...
...
Edu.Module.Course/CourseModule.cs
View file @
fca9d00e
...
...
@@ -107,7 +107,16 @@ namespace Edu.Module.Course
/// <returns></returns>
public
RB_Course_ViewModel
GetCourseModule
(
object
CourseId
)
{
return
courseRepository
.
GetEntity
<
RB_Course_ViewModel
>(
CourseId
);
var
extModel
=
courseRepository
.
GetEntity
<
RB_Course_ViewModel
>(
CourseId
);
if
(
extModel
!=
null
&&
extModel
.
CourseId
>
0
)
{
var
stepPriceList
=
course_StepPriceRepository
.
GetCourseStepPriceListRepository
(
new
RB_Course_StepPrice_ViewModel
()
{
CourseId
=
extModel
.
CourseId
});
extModel
.
StepPriceList
=
stepPriceList
??
new
List
<
RB_Course_StepPrice_ViewModel
>();
}
return
extModel
;
}
/// <summary>
...
...
@@ -117,6 +126,12 @@ namespace Edu.Module.Course
public
virtual
bool
SetCourseModule
(
RB_Course_ViewModel
model
)
{
bool
flag
;
if
(
model
.
IsRenew
==
0
)
{
model
.
RenewOgPrice
=
0
;
model
.
RenewSlPrice
=
0
;
}
if
(
model
.
CourseId
>
0
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
...
@@ -146,19 +161,18 @@ namespace Edu.Module.Course
model
.
CourseId
=
newId
;
flag
=
newId
>
0
;
}
//没有设置阶梯价格,删除原来的价格
course_StepPriceRepository
.
DeleteStepPriceRepository
(
model
.
CourseId
);
if
(
model
.
IsOpenStepPrice
==
1
)
{
if
(
model
.
StepPriceList
!=
null
&&
model
.
StepPriceList
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
StepPriceList
)
{
item
.
CourseId
=
model
.
CourseId
;
course_StepPriceRepository
.
Insert
(
item
);
}
}
}
else
{
}
return
flag
;
}
...
...
Edu.Module.System/MsgLogModule.cs
View file @
fca9d00e
...
...
@@ -28,8 +28,6 @@ namespace Edu.Module.System
/// </summary>
private
readonly
RB_Msg_BaseTemplateRepository
msgBaseTemplateRepository
=
new
RB_Msg_BaseTemplateRepository
();
#
region
短信记录
/// <summary>
/// 获取发送短信记录信息
...
...
@@ -120,7 +118,6 @@ namespace Edu.Module.System
}
#
endregion
#
region
短信模板配置
/// <summary>
/// 获取短信模板配置列表
...
...
@@ -200,8 +197,6 @@ namespace Edu.Module.System
#
region
发送短信统一方法
public
void
SendMsg
(
object
PhoneMessage
,
Common
.
Enum
.
System
.
BaseTemplateTypeEnum
BaseTemplateType
,
RB_Msg_Log
msgLogModel
)
{
//查询当前集团的短信基础配置
var
msgBaseList
=
msgBaseRepository
.
GetListRepository
(
new
RB_Msg_Base_Function_ViewModel
{
Group_Id
=
msgLogModel
.
Group_Id
});
//查询当前下面是否有模板
...
...
@@ -224,18 +219,13 @@ namespace Edu.Module.System
msgLogModel
.
StoreType
=
model
.
StoreType
;
msgLogModel
.
MsgConfigure
=
model
.
MsgConfigure
;
int
id
=
msgLogRepository
.
Insert
(
msgLogModel
);
model
.
MsgBase
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_Msg_Base_ViewModel
>(
model
.
MsgConfigure
);
var
msgBaseTemplateList
=
allMsgBaseTemplateList
.
Where
(
x
=>
x
.
BaseTemplateType
==
BaseTemplateType
);
if
(!
string
.
IsNullOrWhiteSpace
(
model
.
MsgBase
.
AccessKeyId
)
&&
!
string
.
IsNullOrWhiteSpace
(
model
.
MsgBase
.
AccessSecret
)
&&
!
string
.
IsNullOrWhiteSpace
(
model
.
MsgBase
.
Domain
)
&&
!
string
.
IsNullOrWhiteSpace
(
model
.
MsgBase
.
RegionId
))
{
if
(
msgBaseTemplateList
!=
null
&&
msgBaseTemplateList
.
Any
(
x
=>
x
.
TemplateStaus
==
0
))
{
var
msgBaseTemplateModel
=
msgBaseTemplateList
.
Where
(
x
=>
x
.
TemplateStaus
==
0
).
FirstOrDefault
();
if
(
Common
.
Config
.
IsSendMsg
==
1
)
{
ThirdCore
.
Message
.
SMSService
.
SendMsg
(
msgLogModel
.
ReceiverPhone
,
PhoneMessage
,
msgBaseTemplateModel
.
TemplateId
,
msgBaseTemplateModel
.
Sign
,
model
.
MsgBase
.
Domain
,
model
.
MsgBase
.
AccessKeyId
,
model
.
MsgBase
.
AccessSecret
,
model
.
MsgBase
.
RegionId
,
id
.
ToString
());
...
...
@@ -244,10 +234,8 @@ namespace Edu.Module.System
}
}
}
}
}
// ThirdCore.Message.SMSService.SendMsg("13551132417", PhoneMessage, "SMS_201722097", "印象之旅", "dysmsapi.aliyuncs.com", "LTAIwE7l9dImZSa3", "j47Ajn0d0WzUCIX8Biyj3P2r8QDltI", "cn-hangzhou");
}
...
...
@@ -281,7 +269,6 @@ namespace Edu.Module.System
{
sendStatus
=
(
int
)(
modelSmsSendDetailDTO
.
SendStatus
??
1
);
}
if
(
sendStatus
>
1
)
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
...
@@ -296,17 +283,11 @@ namespace Edu.Module.System
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"UpdateMsgSendStatus"
);
}
}
}
}
#
endregion
}
}
Edu.Module.User/DepartmentModule.cs
View file @
fca9d00e
...
...
@@ -158,9 +158,10 @@ namespace Edu.Module.User
{
DepartmentTree_ViewModel
tModel
=
new
DepartmentTree_ViewModel
()
{
DeptId
=
item
.
SId
,
DeptId
=
item
.
SId
+
10000
,
DeptName
=
item
.
SName
,
ParentId
=
item
.
Dept_Id
,
School_Id
=
item
.
SId
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>()
};
#
region
添加员工信息
...
...
@@ -171,9 +172,10 @@ namespace Edu.Module.User
{
tModel
.
ChildList
.
Add
(
new
DepartmentTree_ViewModel
()
{
DeptId
=
0
,
DeptId
=
empModel
.
Id
,
DeptName
=
empModel
.
EmployeeName
,
ParentId
=
0
ParentId
=
0
,
School_Id
=
empModel
.
School_Id
,
});
}
}
...
...
@@ -201,7 +203,8 @@ namespace Edu.Module.User
DeptId
=
fItem
.
DeptId
,
DeptName
=
fItem
.
DeptName
,
ParentId
=
fItem
.
ParentId
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>()
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
School_Id
=
fItem
.
School_Id
};
#
region
添加员工信息
...
...
@@ -214,10 +217,11 @@ namespace Edu.Module.User
{
tModel
.
ChildList
.
Add
(
new
DepartmentTree_ViewModel
()
{
DeptId
=
0
,
DeptId
=
eItem
.
Id
,
DeptName
=
eItem
.
EmployeeName
,
ParentId
=
0
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>()
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
School_Id
=
eItem
.
School_Id
});
}
}
...
...
@@ -225,14 +229,14 @@ namespace Edu.Module.User
#
endregion
tModel
.
ChildList
=
GetDeptTreeList
(
fItem
.
DeptId
,
deptList
.
Where
(
qitem
=>
qitem
.
School_Id
==
0
).
ToList
(),
SchoolId
:
0
,
schoolDeptList
:
schoolDeptList
,
empList
:
empList
);
if
(
schoolDeptList
!=
null
)
{
var
newSchoolDeptList
=
schoolDeptList
.
Where
(
qitem
=>
qitem
.
DeptId
==
fItem
.
DeptId
)?.
ToList
();
if
(
newSchoolDeptList
!=
null
&&
newSchoolDeptList
.
Count
>
0
)
{
tModel
.
ChildList
.
AddRange
(
newSchoolDeptList
);
}
}
//
if (schoolDeptList != null)
//
{
//
var newSchoolDeptList = schoolDeptList.Where(qitem => qitem.DeptId == fItem.DeptId)?.ToList();
//
if (newSchoolDeptList != null && newSchoolDeptList.Count>0)
//
{
//
tModel.ChildList.AddRange(newSchoolDeptList);
//
}
//
}
list
.
Add
(
tModel
);
}
}
...
...
@@ -260,6 +264,7 @@ namespace Edu.Module.User
DeptName
=
item
.
DeptName
,
ParentId
=
item
.
ParentId
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>(),
School_Id
=
item
.
School_Id
};
#
region
添加员工信息
if
(
empList
!=
null
&&
empList
.
Count
>
0
)
...
...
@@ -271,9 +276,10 @@ namespace Edu.Module.User
{
model
.
ChildList
.
Add
(
new
DepartmentTree_ViewModel
()
{
DeptId
=
0
,
DeptId
=
eItem
.
Id
,
DeptName
=
eItem
.
EmployeeName
,
ParentId
=
0
,
School_Id
=
eItem
.
School_Id
,
ChildList
=
new
List
<
DepartmentTree_ViewModel
>()
});
}
...
...
Edu.ThirdCore/Edu.ThirdCore.csproj
View file @
fca9d00e
...
...
@@ -14,6 +14,10 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="aliyun-net-sdk-core">
<HintPath>lib\aliyun-net-sdk-core.dll</HintPath>
...
...
Edu.ThirdCore/Message/MessageCore.cs
View file @
fca9d00e
...
...
@@ -60,8 +60,6 @@ namespace Edu.ThirdCore.Message
String
accessKeySecret
=
obj
[
"AccessKeySecret"
].
ToString
();
IClientProfile
profile
=
DefaultProfile
.
GetProfile
(
obj
[
"RegionId"
].
ToString
(),
accessKeyId
,
accessKeySecret
);
DefaultProfile
.
AddEndpoint
(
obj
[
"RegionId"
].
ToString
(),
obj
[
"RegionId"
].
ToString
(),
product
,
domain
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request
.
PhoneNumbers
=
obj
[
"phoneNumber"
].
ToString
();
...
...
@@ -77,83 +75,21 @@ namespace Edu.ThirdCore.Message
if
(!
sendSmsResponse
.
Code
.
Equals
(
"OK"
))
{
var
data
=
new
{
phoneNumber
=
obj
[
"phoneNumber"
].
ToString
(),
templateParam
=
obj
[
"templateParam"
].
ToString
(),
code
=
sendSmsResponse
.
Code
,
message
=
sendSmsResponse
.
Message
};
//return data;
}
var
datatst
=
new
{
phoneNumber
=
obj
[
"phoneNumber"
].
ToString
(),
templateParam
=
obj
[
"templateParam"
].
ToString
(),
code
=
sendSmsResponse
.
Code
,
message
=
sendSmsResponse
.
Message
};
//return datatst;
// Mall.Common.Plugin.LogHelper.WriteInfo(JsonConvert.SerializeObject(datatst));
}
catch
(
Aliyun
.
Acs
.
Core
.
Exceptions
.
ServerException
ex
)
{
var
data
=
new
{
phoneNumber
=
obj
[
"phoneNumber"
].
ToString
(),
templateParam
=
obj
[
"templateParam"
].
ToString
(),
code
=
"NO"
,
message
=
ex
.
ToString
()
};
// return data;
//LogHelper.Write(ex, "SendSMS1");
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
string
.
Format
(
"SendSMS1_{0}"
,
Common
.
Plugin
.
JsonHelper
.
Serialize
(
data
)));
}
catch
(
ClientException
ex
)
{
var
data
=
new
{
phoneNumber
=
obj
[
"phoneNumber"
].
ToString
(),
templateParam
=
obj
[
"templateParam"
].
ToString
(),
code
=
"NO"
,
message
=
ex
.
ToString
()
};
// return data;
// LogHelper.Write(ex, "SendSMS2");
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
string
.
Format
(
"SendSMS2_{0}"
,
Common
.
Plugin
.
JsonHelper
.
Serialize
(
data
)));
}
}
/// <summary>
/// java调用
/// </summary>
/// <param name="obj"></param>
public
static
string
SendSMSToJava
(
string
phoneNumber
,
string
templateCode
,
string
templateParam
,
string
SignName
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
)
{
SendSmsRequest
request
=
new
SendSmsRequest
();
try
{
//JObject aliSms = Config.AliSms;
//String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
//String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
//String accessKeyId = aliSms["accessKeyId"].ToString();
//String accessKeySecret = aliSms["accessKeySecret"].ToString();
//IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySecret);
//DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
String
product
=
"Dysmsapi"
;
//短信API产品名称(短信产品名固定,无需修改)
String
domain
=
Domain
;
//短信API产品域名(接口地址固定,无需修改)
String
accessKeyId
=
AccessKeyId
;
String
accessKeySecret
=
AccessKeySecret
;
IClientProfile
profile
=
DefaultProfile
.
GetProfile
(
RegionId
,
accessKeyId
,
accessKeySecret
);
DefaultProfile
.
AddEndpoint
(
RegionId
,
RegionId
,
product
,
domain
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request
.
PhoneNumbers
=
phoneNumber
;
request
.
SignName
=
SignName
;
// aliSms["signName"].ToString();
//必填:短信模板-可在短信控制台中找到
request
.
TemplateCode
=
templateCode
;
//可选:模板中的变量替换JSON串,如模板内容为"您的验证码为${code}"时,此处的值为
request
.
TemplateParam
=
templateParam
;
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
request
.
OutId
=
""
;
//请求失败这里会抛ClientException异常
SendSmsResponse
sendSmsResponse
=
acsClient
.
GetAcsResponse
(
request
);
if
(!
sendSmsResponse
.
Code
.
Equals
(
"OK"
))
{
var
data
=
new
{
phoneNumber
,
templateParam
,
code
=
sendSmsResponse
.
Code
,
message
=
sendSmsResponse
.
Message
};
return
""
;
}
else
{
return
sendSmsResponse
.
BizId
;
}
}
catch
(
Aliyun
.
Acs
.
Core
.
Exceptions
.
ServerException
ex
)
{
//LogHelper.Write(ex, "SendSMSToJava1");
}
catch
(
ClientException
ex
)
{
//LogHelper.Write(ex, "SendSMSToJava2");
}
return
""
;
}
/// <summary>
/// 获取短信发送状态
...
...
@@ -164,7 +100,6 @@ namespace Edu.ThirdCore.Message
/// <returns></returns>
public
static
string
SendSMSStatus
(
string
phoneNumber
,
string
SendDate
,
string
BizId
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
)
{
// JObject aliSms = Config.AliSms;
String
product
=
"Dysmsapi"
;
//短信API产品名称(短信产品名固定,无需修改)
String
domain
=
Domain
;
// "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
String
accessKeyId
=
AccessKeyId
;
// aliSms["accessKeyId"].ToString();
...
...
@@ -176,6 +111,7 @@ namespace Edu.ThirdCore.Message
string
url
=
$@"https://
{
domain
}
/?AccessKeyId=
{
accessKeyId
}
&Action=QuerySendDetails&CurrentPage=1&Format=JSON&PageSize=12&PhoneNumber=
{
phoneNumber
}
&RegionId=cn-hangzhou&SecureTransport=true&SendDate=
{
SendDate
}
&BizId=
{
BizId
}
&SignatureMethod=HMAC-SHA1&SignatureNonce=46edc0b6cc74e437aa0ba1703c71a99b&SignatureVersion=1.0&SourceIp=171.88.98.6&Timestamp=2019-09-25T02%3A12%3A35Z&Version=2017-05-25&Signature=Uvqz3E13092wPxNYUt3ytDojV50%3D"
;
return
url
;
}
/// <summary>
/// 获取短信发送状态
/// </summary>
...
...
@@ -185,10 +121,11 @@ namespace Edu.ThirdCore.Message
/// <returns></returns>
public
static
QuerySendDetailsResponse
QuerySendDetails
(
string
phoneNumber
,
string
SendDate
,
string
BizId
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
)
{
String
product
=
"Dysmsapi"
;
//短信API产品名称(短信产品名固定,无需修改)
// 初始化acsClient,暂不支持region化
//短信API产品名称(短信产品名固定,无需修改)
String
product
=
"Dysmsapi"
;
IClientProfile
profile
=
DefaultProfile
.
GetProfile
(
RegionId
,
AccessKeyId
,
AccessKeySecret
);
DefaultProfile
.
AddEndpoint
(
RegionId
,
RegionId
,
product
,
Domain
);
//初始化acsClient,暂不支持region化
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
// 组装请求对象
QuerySendDetailsRequest
request
=
new
QuerySendDetailsRequest
...
...
@@ -199,7 +136,7 @@ namespace Edu.ThirdCore.Message
PageSize
=
10
,
CurrentPage
=
1
};
QuerySendDetailsResponse
querySendDetailsResponse
=
null
;
QuerySendDetailsResponse
querySendDetailsResponse
;
try
{
// 请求失败这里会抛ClientException异常
...
...
@@ -208,15 +145,16 @@ namespace Edu.ThirdCore.Message
catch
(
ServerException
e
)
{
querySendDetailsResponse
=
new
QuerySendDetailsResponse
();
// LogHelper.LogException<ServerException>(e.ErrorMessage
);
Common
.
Plugin
.
LogHelper
.
Write
(
e
,
"QuerySendDetails_1"
);
}
catch
(
ClientException
e
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
e
,
"QuerySendDetails_2"
);
querySendDetailsResponse
=
new
QuerySendDetailsResponse
();
// LogHelper.LogException<ClientException>(e.ErrorMessage);
}
return
querySendDetailsResponse
;
}
/// <summary>
/// 获取短信状态
/// </summary>
...
...
@@ -234,13 +172,14 @@ namespace Edu.ThirdCore.Message
IClientProfile
profile
=
DefaultProfile
.
GetProfile
(
RegionId
,
accessKeyId
,
accessKeySecret
);
DefaultProfile
.
AddEndpoint
(
RegionId
,
RegionId
,
product
,
domain
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
QuerySendDetailsRequest
request
=
new
QuerySendDetailsRequest
();
request
.
CurrentPage
=
1
;
request
.
PageSize
=
12
;
request
.
PhoneNumber
=
phoneNumber
;
request
.
SendDate
=
SendDate
;
request
.
BizId
=
BizId
;
QuerySendDetailsRequest
request
=
new
QuerySendDetailsRequest
{
CurrentPage
=
1
,
PageSize
=
12
,
PhoneNumber
=
phoneNumber
,
SendDate
=
SendDate
,
BizId
=
BizId
};
//请求失败这里会抛ClientException异常
var
robj
=
acsClient
.
DoAction
(
request
);
if
(
robj
.
Status
==
200
)
...
...
Edu.ThirdCore/Message/QueueHelper.cs
View file @
fca9d00e
...
...
@@ -17,7 +17,7 @@ namespace Edu.ThirdCore.Message
/// <summary>
/// 线程锁
/// </summary>
private
static
object
locker
=
new
object
();
private
static
readonly
object
locker
=
new
object
();
/// <summary>
/// 添加消息到队列
...
...
Edu.ThirdCore/Message/SMSService.cs
View file @
fca9d00e
...
...
@@ -20,16 +20,18 @@ namespace Edu.ThirdCore.Message
/// <param name="code">验证码</param>
public
static
void
SendCode
(
string
phoneNumber
,
string
code
,
string
templateCode
,
string
SignName
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
,
string
OutId
)
{
JObject
obj
=
new
JObject
();
obj
[
"cmd"
]
=
"sms"
;
obj
[
"phoneNumber"
]
=
phoneNumber
;
obj
[
"templateCode"
]
=
templateCode
;
obj
[
"SignName"
]
=
SignName
;
obj
[
"Domain"
]
=
Domain
;
obj
[
"AccessKeyId"
]
=
AccessKeyId
;
obj
[
"AccessKeySecret"
]
=
AccessKeySecret
;
obj
[
"RegionId"
]
=
RegionId
;
var
TemplateParam
=
new
{
code
=
code
};
JObject
obj
=
new
JObject
{
[
"cmd"
]
=
"sms"
,
[
"phoneNumber"
]
=
phoneNumber
,
[
"templateCode"
]
=
templateCode
,
[
"SignName"
]
=
SignName
,
[
"Domain"
]
=
Domain
,
[
"AccessKeyId"
]
=
AccessKeyId
,
[
"AccessKeySecret"
]
=
AccessKeySecret
,
[
"RegionId"
]
=
RegionId
};
var
TemplateParam
=
new
{
code
};
obj
[
"OutId"
]
=
OutId
;
obj
[
"templateParam"
]
=
JsonConvert
.
SerializeObject
(
TemplateParam
);
QueueHelper
.
EnqueueTask
(
JsonConvert
.
SerializeObject
(
obj
));
...
...
@@ -43,15 +45,17 @@ namespace Edu.ThirdCore.Message
/// <param name="templateCode"></param>
public
static
void
SendMsg
(
string
phoneNumber
,
string
content
,
string
templateCode
,
string
SignName
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
,
string
OutId
)
{
JObject
obj
=
new
JObject
();
obj
[
"cmd"
]
=
"sms"
;
obj
[
"phoneNumber"
]
=
phoneNumber
;
obj
[
"templateCode"
]
=
templateCode
;
obj
[
"SignName"
]
=
SignName
;
obj
[
"Domain"
]
=
Domain
;
obj
[
"AccessKeyId"
]
=
AccessKeyId
;
obj
[
"RegionId"
]
=
RegionId
;
obj
[
"AccessKeySecret"
]
=
AccessKeySecret
;
JObject
obj
=
new
JObject
{
[
"cmd"
]
=
"sms"
,
[
"phoneNumber"
]
=
phoneNumber
,
[
"templateCode"
]
=
templateCode
,
[
"SignName"
]
=
SignName
,
[
"Domain"
]
=
Domain
,
[
"AccessKeyId"
]
=
AccessKeyId
,
[
"RegionId"
]
=
RegionId
,
[
"AccessKeySecret"
]
=
AccessKeySecret
};
var
TemplateParam
=
new
{
content
};
obj
[
"OutId"
]
=
OutId
;
obj
[
"templateParam"
]
=
JsonConvert
.
SerializeObject
(
TemplateParam
);
...
...
@@ -67,10 +71,12 @@ namespace Edu.ThirdCore.Message
/// <param name="templateCode"></param>
public
static
void
SendMsg
(
string
phoneNumber
,
object
templateParam
,
string
templateCode
,
string
SignName
,
string
Domain
,
string
AccessKeyId
,
string
AccessKeySecret
,
string
RegionId
,
string
OutId
)
{
JObject
obj
=
new
JObject
();
obj
[
"cmd"
]
=
"sms"
;
obj
[
"phoneNumber"
]
=
phoneNumber
;
obj
[
"templateCode"
]
=
templateCode
;
JObject
obj
=
new
JObject
{
[
"cmd"
]
=
"sms"
,
[
"phoneNumber"
]
=
phoneNumber
,
[
"templateCode"
]
=
templateCode
};
var
TemplateParam
=
templateParam
;
obj
[
"SignName"
]
=
SignName
;
obj
[
"Domain"
]
=
Domain
;
...
...
Edu.WebApi/Controllers/Public/MsgController.cs
View file @
fca9d00e
...
...
@@ -116,12 +116,14 @@ namespace Edu.WebApi.Controllers.Public
public
ApiResult
SetMsgBase
()
{
var
extModel
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
RB_Msg_Base_Function_ViewModel
>(
RequestParm
.
Msg
.
ToString
());
var
model
=
new
RB_Msg_Base
();
model
.
CreateDate
=
DateTime
.
Now
;
model
.
CreateBy
=
UserInfo
.
Id
;
model
.
Group_Id
=
base
.
UserInfo
.
Group_Id
;
model
.
ID
=
extModel
.
ID
;
model
.
StoreType
=
extModel
.
StoreType
;
var
model
=
new
RB_Msg_Base
{
CreateDate
=
DateTime
.
Now
,
CreateBy
=
UserInfo
.
Id
,
Group_Id
=
base
.
UserInfo
.
Group_Id
,
ID
=
extModel
.
ID
,
StoreType
=
extModel
.
StoreType
};
if
(
extModel
.
MsgBase
!=
null
)
{
model
.
MsgConfigure
=
Common
.
Plugin
.
JsonHelper
.
Serialize
(
extModel
.
MsgBase
);
...
...
Edu.WebApi/Controllers/User/UserController.cs
View file @
fca9d00e
...
...
@@ -775,7 +775,6 @@ namespace Edu.WebApi.Controllers.User
{
return
ApiResult
.
ParamIsNull
(
message
:
"请选择部门编号!"
);
}
var
groupId
=
base
.
UserInfo
.
Group_Id
;
var
list
=
departmentModule
.
GetCurrentAndChildDepartmentListModule
(
DeptId
);
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