Commit fca9d00e authored by 黄奎's avatar 黄奎

页面修改

parent 8fd0bae0
...@@ -175,25 +175,6 @@ namespace Edu.Common.Plugin ...@@ -175,25 +175,6 @@ namespace Edu.Common.Plugin
return ""; 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>
/// 获取年份月份中的最后一天 /// 获取年份月份中的最后一天
/// </summary> /// </summary>
...@@ -205,25 +186,6 @@ namespace Edu.Common.Plugin ...@@ -205,25 +186,6 @@ namespace Edu.Common.Plugin
return new DateTime(year, month, 1).AddMonths(1).AddDays(-1); 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>
/// 时间 /// 时间
/// </summary> /// </summary>
...@@ -620,17 +582,6 @@ namespace Edu.Common.Plugin ...@@ -620,17 +582,6 @@ namespace Edu.Common.Plugin
return Encoding.Default.GetString(Byt); 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>
/// 截取指定长度字符 /// 截取指定长度字符
/// </summary> /// </summary>
...@@ -1170,77 +1121,6 @@ namespace Edu.Common.Plugin ...@@ -1170,77 +1121,6 @@ namespace Edu.Common.Plugin
#endregion #endregion
#region Url获取Get参数 #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> /// <summary>
/// 解码URL. /// 解码URL.
...@@ -1384,7 +1264,7 @@ namespace Edu.Common.Plugin ...@@ -1384,7 +1264,7 @@ namespace Edu.Common.Plugin
/// <returns></returns> /// <returns></returns>
public static string GetStarString(string Input) public static string GetStarString(string Input)
{ {
string Output = ""; string Output;
switch (Input.Length) switch (Input.Length)
{ {
case 1: case 1:
...@@ -1433,31 +1313,6 @@ namespace Edu.Common.Plugin ...@@ -1433,31 +1313,6 @@ namespace Edu.Common.Plugin
return str; 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>
/// 繁体字转简体 /// 繁体字转简体
/// </summary> /// </summary>
......
...@@ -23,6 +23,11 @@ namespace Edu.Model.ViewModel.User ...@@ -23,6 +23,11 @@ namespace Edu.Model.ViewModel.User
/// </summary> /// </summary>
public int ParentId { get; set; } public int ParentId { get; set; }
/// <summary>
/// 校区编号
/// </summary>
public int School_Id { get; set; }
/// <summary> /// <summary>
/// 下级部门列表 /// 下级部门列表
......
...@@ -107,7 +107,16 @@ namespace Edu.Module.Course ...@@ -107,7 +107,16 @@ namespace Edu.Module.Course
/// <returns></returns> /// <returns></returns>
public RB_Course_ViewModel GetCourseModule(object CourseId) 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> /// <summary>
...@@ -117,6 +126,12 @@ namespace Edu.Module.Course ...@@ -117,6 +126,12 @@ namespace Edu.Module.Course
public virtual bool SetCourseModule(RB_Course_ViewModel model) public virtual bool SetCourseModule(RB_Course_ViewModel model)
{ {
bool flag; bool flag;
if (model.IsRenew == 0)
{
model.RenewOgPrice = 0;
model.RenewSlPrice = 0;
}
if (model.CourseId > 0) if (model.CourseId > 0)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
...@@ -146,19 +161,18 @@ namespace Edu.Module.Course ...@@ -146,19 +161,18 @@ namespace Edu.Module.Course
model.CourseId = newId; model.CourseId = newId;
flag = newId > 0; flag = newId > 0;
} }
//没有设置阶梯价格,删除原来的价格
course_StepPriceRepository.DeleteStepPriceRepository(model.CourseId);
if (model.IsOpenStepPrice == 1) if (model.IsOpenStepPrice == 1)
{ {
if (model.StepPriceList != null && model.StepPriceList.Count > 0) if (model.StepPriceList != null && model.StepPriceList.Count > 0)
{ {
foreach (var item in model.StepPriceList) foreach (var item in model.StepPriceList)
{ {
item.CourseId = model.CourseId;
course_StepPriceRepository.Insert(item); course_StepPriceRepository.Insert(item);
} }
} }
}
else
{
} }
return flag; return flag;
} }
......
...@@ -28,8 +28,6 @@ namespace Edu.Module.System ...@@ -28,8 +28,6 @@ namespace Edu.Module.System
/// </summary> /// </summary>
private readonly RB_Msg_BaseTemplateRepository msgBaseTemplateRepository = new RB_Msg_BaseTemplateRepository(); private readonly RB_Msg_BaseTemplateRepository msgBaseTemplateRepository = new RB_Msg_BaseTemplateRepository();
#region 短信记录 #region 短信记录
/// <summary> /// <summary>
/// 获取发送短信记录信息 /// 获取发送短信记录信息
...@@ -120,7 +118,6 @@ namespace Edu.Module.System ...@@ -120,7 +118,6 @@ namespace Edu.Module.System
} }
#endregion #endregion
#region 短信模板配置 #region 短信模板配置
/// <summary> /// <summary>
/// 获取短信模板配置列表 /// 获取短信模板配置列表
...@@ -200,8 +197,6 @@ namespace Edu.Module.System ...@@ -200,8 +197,6 @@ namespace Edu.Module.System
#region 发送短信统一方法 #region 发送短信统一方法
public void SendMsg(object PhoneMessage, Common.Enum.System.BaseTemplateTypeEnum BaseTemplateType, RB_Msg_Log msgLogModel) 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 }); var msgBaseList = msgBaseRepository.GetListRepository(new RB_Msg_Base_Function_ViewModel { Group_Id = msgLogModel.Group_Id });
//查询当前下面是否有模板 //查询当前下面是否有模板
...@@ -224,18 +219,13 @@ namespace Edu.Module.System ...@@ -224,18 +219,13 @@ namespace Edu.Module.System
msgLogModel.StoreType = model.StoreType; msgLogModel.StoreType = model.StoreType;
msgLogModel.MsgConfigure = model.MsgConfigure; msgLogModel.MsgConfigure = model.MsgConfigure;
int id = msgLogRepository.Insert(msgLogModel); int id = msgLogRepository.Insert(msgLogModel);
model.MsgBase = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_ViewModel>(model.MsgConfigure); model.MsgBase = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_ViewModel>(model.MsgConfigure);
var msgBaseTemplateList = allMsgBaseTemplateList.Where(x => x.BaseTemplateType == BaseTemplateType); 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 (!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)) if (msgBaseTemplateList != null && msgBaseTemplateList.Any(x => x.TemplateStaus == 0))
{ {
var msgBaseTemplateModel = msgBaseTemplateList.Where(x => x.TemplateStaus == 0).FirstOrDefault(); var msgBaseTemplateModel = msgBaseTemplateList.Where(x => x.TemplateStaus == 0).FirstOrDefault();
if (Common.Config.IsSendMsg == 1) 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()); 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 ...@@ -244,10 +234,8 @@ namespace Edu.Module.System
} }
} }
} }
} }
} }
// ThirdCore.Message.SMSService.SendMsg("13551132417", PhoneMessage, "SMS_201722097", "印象之旅", "dysmsapi.aliyuncs.com", "LTAIwE7l9dImZSa3", "j47Ajn0d0WzUCIX8Biyj3P2r8QDltI", "cn-hangzhou"); // ThirdCore.Message.SMSService.SendMsg("13551132417", PhoneMessage, "SMS_201722097", "印象之旅", "dysmsapi.aliyuncs.com", "LTAIwE7l9dImZSa3", "j47Ajn0d0WzUCIX8Biyj3P2r8QDltI", "cn-hangzhou");
} }
...@@ -281,13 +269,12 @@ namespace Edu.Module.System ...@@ -281,13 +269,12 @@ namespace Edu.Module.System
{ {
sendStatus = (int)(modelSmsSendDetailDTO.SendStatus ?? 1); sendStatus = (int)(modelSmsSendDetailDTO.SendStatus ?? 1);
} }
if (sendStatus > 1) if (sendStatus > 1)
{ {
Dictionary<string, object> fileds = new Dictionary<string, object>() Dictionary<string, object> fileds = new Dictionary<string, object>()
{ {
{ nameof(RB_Msg_Log.SendStatus),sendStatus} { nameof(RB_Msg_Log.SendStatus),sendStatus}
}; };
msgLogRepository.Update(fileds, new WhereHelper(nameof(RB_Msg_Log.ID), Convert.ToInt32(modelSmsSendDetailDTO.OutId))); msgLogRepository.Update(fileds, new WhereHelper(nameof(RB_Msg_Log.ID), Convert.ToInt32(modelSmsSendDetailDTO.OutId)));
} }
} }
...@@ -296,17 +283,11 @@ namespace Edu.Module.System ...@@ -296,17 +283,11 @@ namespace Edu.Module.System
} }
catch (Exception ex) catch (Exception ex)
{ {
Common.Plugin.LogHelper.Write(ex, "UpdateMsgSendStatus");
} }
} }
} }
} }
#endregion #endregion
} }
} }
...@@ -158,9 +158,10 @@ namespace Edu.Module.User ...@@ -158,9 +158,10 @@ namespace Edu.Module.User
{ {
DepartmentTree_ViewModel tModel = new DepartmentTree_ViewModel() DepartmentTree_ViewModel tModel = new DepartmentTree_ViewModel()
{ {
DeptId = item.SId, DeptId = item.SId+10000,
DeptName = item.SName, DeptName = item.SName,
ParentId = item.Dept_Id, ParentId = item.Dept_Id,
School_Id=item.SId,
ChildList = new List<DepartmentTree_ViewModel>() ChildList = new List<DepartmentTree_ViewModel>()
}; };
#region 添加员工信息 #region 添加员工信息
...@@ -171,9 +172,10 @@ namespace Edu.Module.User ...@@ -171,9 +172,10 @@ namespace Edu.Module.User
{ {
tModel.ChildList.Add(new DepartmentTree_ViewModel() tModel.ChildList.Add(new DepartmentTree_ViewModel()
{ {
DeptId = 0, DeptId = empModel.Id,
DeptName = empModel.EmployeeName, DeptName = empModel.EmployeeName,
ParentId = 0 ParentId = 0,
School_Id=empModel.School_Id,
}); });
} }
} }
...@@ -201,7 +203,8 @@ namespace Edu.Module.User ...@@ -201,7 +203,8 @@ namespace Edu.Module.User
DeptId = fItem.DeptId, DeptId = fItem.DeptId,
DeptName = fItem.DeptName, DeptName = fItem.DeptName,
ParentId = fItem.ParentId, ParentId = fItem.ParentId,
ChildList = new List<DepartmentTree_ViewModel>() ChildList = new List<DepartmentTree_ViewModel>(),
School_Id=fItem.School_Id
}; };
#region 添加员工信息 #region 添加员工信息
...@@ -214,10 +217,11 @@ namespace Edu.Module.User ...@@ -214,10 +217,11 @@ namespace Edu.Module.User
{ {
tModel.ChildList.Add(new DepartmentTree_ViewModel() tModel.ChildList.Add(new DepartmentTree_ViewModel()
{ {
DeptId = 0, DeptId = eItem.Id,
DeptName = eItem.EmployeeName, DeptName = eItem.EmployeeName,
ParentId = 0, 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 ...@@ -225,14 +229,14 @@ namespace Edu.Module.User
#endregion #endregion
tModel.ChildList = GetDeptTreeList(fItem.DeptId, deptList.Where(qitem => qitem.School_Id == 0).ToList(), SchoolId: 0, schoolDeptList: schoolDeptList, empList: empList); tModel.ChildList = GetDeptTreeList(fItem.DeptId, deptList.Where(qitem => qitem.School_Id == 0).ToList(), SchoolId: 0, schoolDeptList: schoolDeptList, empList: empList);
if (schoolDeptList != null) //if (schoolDeptList != null)
{ //{
var newSchoolDeptList = schoolDeptList.Where(qitem => qitem.DeptId == fItem.DeptId)?.ToList(); // var newSchoolDeptList = schoolDeptList.Where(qitem => qitem.DeptId == fItem.DeptId)?.ToList();
if (newSchoolDeptList != null && newSchoolDeptList.Count>0) // if (newSchoolDeptList != null && newSchoolDeptList.Count>0)
{ // {
tModel.ChildList.AddRange(newSchoolDeptList); // tModel.ChildList.AddRange(newSchoolDeptList);
} // }
} //}
list.Add(tModel); list.Add(tModel);
} }
} }
...@@ -260,6 +264,7 @@ namespace Edu.Module.User ...@@ -260,6 +264,7 @@ namespace Edu.Module.User
DeptName = item.DeptName, DeptName = item.DeptName,
ParentId = item.ParentId, ParentId = item.ParentId,
ChildList = new List<DepartmentTree_ViewModel>(), ChildList = new List<DepartmentTree_ViewModel>(),
School_Id=item.School_Id
}; };
#region 添加员工信息 #region 添加员工信息
if (empList != null && empList.Count > 0) if (empList != null && empList.Count > 0)
...@@ -271,9 +276,10 @@ namespace Edu.Module.User ...@@ -271,9 +276,10 @@ namespace Edu.Module.User
{ {
model.ChildList.Add(new DepartmentTree_ViewModel() model.ChildList.Add(new DepartmentTree_ViewModel()
{ {
DeptId = 0, DeptId = eItem.Id,
DeptName = eItem.EmployeeName, DeptName = eItem.EmployeeName,
ParentId = 0, ParentId = 0,
School_Id=eItem.School_Id,
ChildList = new List<DepartmentTree_ViewModel>() ChildList = new List<DepartmentTree_ViewModel>()
}); });
} }
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Edu.Common\Edu.Common.csproj" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="aliyun-net-sdk-core"> <Reference Include="aliyun-net-sdk-core">
<HintPath>lib\aliyun-net-sdk-core.dll</HintPath> <HintPath>lib\aliyun-net-sdk-core.dll</HintPath>
......
...@@ -60,8 +60,6 @@ namespace Edu.ThirdCore.Message ...@@ -60,8 +60,6 @@ namespace Edu.ThirdCore.Message
String accessKeySecret = obj["AccessKeySecret"].ToString(); String accessKeySecret = obj["AccessKeySecret"].ToString();
IClientProfile profile = DefaultProfile.GetProfile(obj["RegionId"].ToString(), accessKeyId, accessKeySecret); IClientProfile profile = DefaultProfile.GetProfile(obj["RegionId"].ToString(), accessKeyId, accessKeySecret);
DefaultProfile.AddEndpoint(obj["RegionId"].ToString(), obj["RegionId"].ToString(), product, domain); DefaultProfile.AddEndpoint(obj["RegionId"].ToString(), obj["RegionId"].ToString(), product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile); IAcsClient acsClient = new DefaultAcsClient(profile);
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式 //必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式
request.PhoneNumbers = obj["phoneNumber"].ToString(); request.PhoneNumbers = obj["phoneNumber"].ToString();
...@@ -77,83 +75,21 @@ namespace Edu.ThirdCore.Message ...@@ -77,83 +75,21 @@ namespace Edu.ThirdCore.Message
if (!sendSmsResponse.Code.Equals("OK")) if (!sendSmsResponse.Code.Equals("OK"))
{ {
var data = new { phoneNumber = obj["phoneNumber"].ToString(), templateParam = obj["templateParam"].ToString(), code = sendSmsResponse.Code, message = sendSmsResponse.Message }; 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 }; 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) catch (Aliyun.Acs.Core.Exceptions.ServerException ex)
{ {
var data = new { phoneNumber = obj["phoneNumber"].ToString(), templateParam = obj["templateParam"].ToString(), code = "NO", message = ex.ToString() }; var data = new { phoneNumber = obj["phoneNumber"].ToString(), templateParam = obj["templateParam"].ToString(), code = "NO", message = ex.ToString() };
// return data; Common.Plugin.LogHelper.Write(ex, string.Format("SendSMS1_{0}", Common.Plugin.JsonHelper.Serialize(data)));
//LogHelper.Write(ex, "SendSMS1");
} }
catch (ClientException ex) catch (ClientException ex)
{ {
var data = new { phoneNumber = obj["phoneNumber"].ToString(), templateParam = obj["templateParam"].ToString(), code = "NO", message = ex.ToString() }; var data = new { phoneNumber = obj["phoneNumber"].ToString(), templateParam = obj["templateParam"].ToString(), code = "NO", message = ex.ToString() };
// return data; Common.Plugin.LogHelper.Write(ex, string.Format("SendSMS2_{0}",Common.Plugin.JsonHelper.Serialize(data)));
// LogHelper.Write(ex, "SendSMS2");
} }
} }
/// <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> /// <summary>
/// 获取短信发送状态 /// 获取短信发送状态
...@@ -164,7 +100,6 @@ namespace Edu.ThirdCore.Message ...@@ -164,7 +100,6 @@ namespace Edu.ThirdCore.Message
/// <returns></returns> /// <returns></returns>
public static string SendSMSStatus(string phoneNumber, string SendDate, string BizId, string Domain, string AccessKeyId, string AccessKeySecret, string RegionId) 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 product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改)
String domain = Domain;// "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改) String domain = Domain;// "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改)
String accessKeyId = AccessKeyId;// aliSms["accessKeyId"].ToString(); String accessKeyId = AccessKeyId;// aliSms["accessKeyId"].ToString();
...@@ -176,6 +111,7 @@ namespace Edu.ThirdCore.Message ...@@ -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"; 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; return url;
} }
/// <summary> /// <summary>
/// 获取短信发送状态 /// 获取短信发送状态
/// </summary> /// </summary>
...@@ -185,10 +121,11 @@ namespace Edu.ThirdCore.Message ...@@ -185,10 +121,11 @@ namespace Edu.ThirdCore.Message
/// <returns></returns> /// <returns></returns>
public static QuerySendDetailsResponse QuerySendDetails(string phoneNumber, string SendDate, string BizId, string Domain, string AccessKeyId, string AccessKeySecret, string RegionId) public static QuerySendDetailsResponse QuerySendDetails(string phoneNumber, string SendDate, string BizId, string Domain, string AccessKeyId, string AccessKeySecret, string RegionId)
{ {
String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改) //短信API产品名称(短信产品名固定,无需修改)
// 初始化acsClient,暂不支持region化 String product = "Dysmsapi";
IClientProfile profile = DefaultProfile.GetProfile(RegionId, AccessKeyId, AccessKeySecret); IClientProfile profile = DefaultProfile.GetProfile(RegionId, AccessKeyId, AccessKeySecret);
DefaultProfile.AddEndpoint(RegionId, RegionId, product, Domain); DefaultProfile.AddEndpoint(RegionId, RegionId, product, Domain);
//初始化acsClient,暂不支持region化
IAcsClient acsClient = new DefaultAcsClient(profile); IAcsClient acsClient = new DefaultAcsClient(profile);
// 组装请求对象 // 组装请求对象
QuerySendDetailsRequest request = new QuerySendDetailsRequest QuerySendDetailsRequest request = new QuerySendDetailsRequest
...@@ -199,7 +136,7 @@ namespace Edu.ThirdCore.Message ...@@ -199,7 +136,7 @@ namespace Edu.ThirdCore.Message
PageSize = 10, PageSize = 10,
CurrentPage = 1 CurrentPage = 1
}; };
QuerySendDetailsResponse querySendDetailsResponse = null; QuerySendDetailsResponse querySendDetailsResponse;
try try
{ {
// 请求失败这里会抛ClientException异常 // 请求失败这里会抛ClientException异常
...@@ -208,15 +145,16 @@ namespace Edu.ThirdCore.Message ...@@ -208,15 +145,16 @@ namespace Edu.ThirdCore.Message
catch (ServerException e) catch (ServerException e)
{ {
querySendDetailsResponse = new QuerySendDetailsResponse(); querySendDetailsResponse = new QuerySendDetailsResponse();
// LogHelper.LogException<ServerException>(e.ErrorMessage); Common.Plugin.LogHelper.Write(e, "QuerySendDetails_1");
} }
catch (ClientException e) catch (ClientException e)
{ {
Common.Plugin.LogHelper.Write(e, "QuerySendDetails_2");
querySendDetailsResponse = new QuerySendDetailsResponse(); querySendDetailsResponse = new QuerySendDetailsResponse();
// LogHelper.LogException<ClientException>(e.ErrorMessage);
} }
return querySendDetailsResponse; return querySendDetailsResponse;
} }
/// <summary> /// <summary>
/// 获取短信状态 /// 获取短信状态
/// </summary> /// </summary>
...@@ -234,13 +172,14 @@ namespace Edu.ThirdCore.Message ...@@ -234,13 +172,14 @@ namespace Edu.ThirdCore.Message
IClientProfile profile = DefaultProfile.GetProfile(RegionId, accessKeyId, accessKeySecret); IClientProfile profile = DefaultProfile.GetProfile(RegionId, accessKeyId, accessKeySecret);
DefaultProfile.AddEndpoint(RegionId, RegionId, product, domain); DefaultProfile.AddEndpoint(RegionId, RegionId, product, domain);
IAcsClient acsClient = new DefaultAcsClient(profile); IAcsClient acsClient = new DefaultAcsClient(profile);
QuerySendDetailsRequest request = new QuerySendDetailsRequest(); QuerySendDetailsRequest request = new QuerySendDetailsRequest
{
request.CurrentPage = 1; CurrentPage = 1,
request.PageSize = 12; PageSize = 12,
request.PhoneNumber = phoneNumber; PhoneNumber = phoneNumber,
request.SendDate = SendDate; SendDate = SendDate,
request.BizId = BizId; BizId = BizId
};
//请求失败这里会抛ClientException异常 //请求失败这里会抛ClientException异常
var robj = acsClient.DoAction(request); var robj = acsClient.DoAction(request);
if (robj.Status == 200) if (robj.Status == 200)
......
...@@ -17,7 +17,7 @@ namespace Edu.ThirdCore.Message ...@@ -17,7 +17,7 @@ namespace Edu.ThirdCore.Message
/// <summary> /// <summary>
/// 线程锁 /// 线程锁
/// </summary> /// </summary>
private static object locker = new object(); private static readonly object locker = new object();
/// <summary> /// <summary>
/// 添加消息到队列 /// 添加消息到队列
......
...@@ -20,16 +20,18 @@ namespace Edu.ThirdCore.Message ...@@ -20,16 +20,18 @@ namespace Edu.ThirdCore.Message
/// <param name="code">验证码</param> /// <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) 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(); JObject obj = new JObject
obj["cmd"] = "sms"; {
obj["phoneNumber"] = phoneNumber; ["cmd"] = "sms",
obj["templateCode"] = templateCode; ["phoneNumber"] = phoneNumber,
obj["SignName"] = SignName; ["templateCode"] = templateCode,
obj["Domain"] = Domain; ["SignName"] = SignName,
obj["AccessKeyId"] = AccessKeyId; ["Domain"] = Domain,
obj["AccessKeySecret"] = AccessKeySecret; ["AccessKeyId"] = AccessKeyId,
obj["RegionId"] = RegionId; ["AccessKeySecret"] = AccessKeySecret,
var TemplateParam = new { code = code }; ["RegionId"] = RegionId
};
var TemplateParam = new { code };
obj["OutId"] = OutId; obj["OutId"] = OutId;
obj["templateParam"] = JsonConvert.SerializeObject(TemplateParam); obj["templateParam"] = JsonConvert.SerializeObject(TemplateParam);
QueueHelper.EnqueueTask(JsonConvert.SerializeObject(obj)); QueueHelper.EnqueueTask(JsonConvert.SerializeObject(obj));
...@@ -43,15 +45,17 @@ namespace Edu.ThirdCore.Message ...@@ -43,15 +45,17 @@ namespace Edu.ThirdCore.Message
/// <param name="templateCode"></param> /// <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) 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(); JObject obj = new JObject
obj["cmd"] = "sms"; {
obj["phoneNumber"] = phoneNumber; ["cmd"] = "sms",
obj["templateCode"] = templateCode; ["phoneNumber"] = phoneNumber,
obj["SignName"] = SignName; ["templateCode"] = templateCode,
obj["Domain"] = Domain; ["SignName"] = SignName,
obj["AccessKeyId"] = AccessKeyId; ["Domain"] = Domain,
obj["RegionId"] = RegionId; ["AccessKeyId"] = AccessKeyId,
obj["AccessKeySecret"] = AccessKeySecret; ["RegionId"] = RegionId,
["AccessKeySecret"] = AccessKeySecret
};
var TemplateParam = new { content }; var TemplateParam = new { content };
obj["OutId"] = OutId; obj["OutId"] = OutId;
obj["templateParam"] = JsonConvert.SerializeObject(TemplateParam); obj["templateParam"] = JsonConvert.SerializeObject(TemplateParam);
...@@ -67,10 +71,12 @@ namespace Edu.ThirdCore.Message ...@@ -67,10 +71,12 @@ namespace Edu.ThirdCore.Message
/// <param name="templateCode"></param> /// <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) 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(); JObject obj = new JObject
obj["cmd"] = "sms"; {
obj["phoneNumber"] = phoneNumber; ["cmd"] = "sms",
obj["templateCode"] = templateCode; ["phoneNumber"] = phoneNumber,
["templateCode"] = templateCode
};
var TemplateParam = templateParam; var TemplateParam = templateParam;
obj["SignName"] = SignName; obj["SignName"] = SignName;
obj["Domain"] = Domain; obj["Domain"] = Domain;
......
...@@ -116,12 +116,14 @@ namespace Edu.WebApi.Controllers.Public ...@@ -116,12 +116,14 @@ namespace Edu.WebApi.Controllers.Public
public ApiResult SetMsgBase() public ApiResult SetMsgBase()
{ {
var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_Function_ViewModel>(RequestParm.Msg.ToString()); var extModel = Common.Plugin.JsonHelper.DeserializeObject<RB_Msg_Base_Function_ViewModel>(RequestParm.Msg.ToString());
var model = new RB_Msg_Base(); var model = new RB_Msg_Base
model.CreateDate = DateTime.Now; {
model.CreateBy = UserInfo.Id; CreateDate = DateTime.Now,
model.Group_Id = base.UserInfo.Group_Id; CreateBy = UserInfo.Id,
model.ID = extModel.ID; Group_Id = base.UserInfo.Group_Id,
model.StoreType = extModel.StoreType; ID = extModel.ID,
StoreType = extModel.StoreType
};
if (extModel.MsgBase != null) if (extModel.MsgBase != null)
{ {
model.MsgConfigure = Common.Plugin.JsonHelper.Serialize(extModel.MsgBase); model.MsgConfigure = Common.Plugin.JsonHelper.Serialize(extModel.MsgBase);
......
...@@ -775,7 +775,6 @@ namespace Edu.WebApi.Controllers.User ...@@ -775,7 +775,6 @@ namespace Edu.WebApi.Controllers.User
{ {
return ApiResult.ParamIsNull(message: "请选择部门编号!"); return ApiResult.ParamIsNull(message: "请选择部门编号!");
} }
var groupId = base.UserInfo.Group_Id;
var list = departmentModule.GetCurrentAndChildDepartmentListModule(DeptId); var list = departmentModule.GetCurrentAndChildDepartmentListModule(DeptId);
return ApiResult.Success(data: list); return ApiResult.Success(data: list);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment