@@ -18,6 +18,7 @@ using Learun.Application.TwoDevelopment.LR_Desktop; | |||||
using Learun.Application.TwoDevelopment.Permission; | using Learun.Application.TwoDevelopment.Permission; | ||||
using Learun.Application.WorkFlow; | using Learun.Application.WorkFlow; | ||||
using Learun.Application.OA.Email.EmailSend; | using Learun.Application.OA.Email.EmailSend; | ||||
using Quanjiang.DigitalScholl.SendSms; | |||||
namespace Learun.Application.Web.Controllers | namespace Learun.Application.Web.Controllers | ||||
{ | { | ||||
@@ -60,6 +61,7 @@ namespace Learun.Application.Web.Controllers | |||||
private ICache redisCache = CacheFactory.CaChe(); | private ICache redisCache = CacheFactory.CaChe(); | ||||
private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); | private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); | ||||
private EmailSendIBLL emailSendIBLL = new EmailSendBLL(); | private EmailSendIBLL emailSendIBLL = new EmailSendBLL(); | ||||
private readonly ISms aliyunSms = new AliyunSms(); | |||||
#region 视图功能 | #region 视图功能 | ||||
public ActionResult FirstChangePwd() | public ActionResult FirstChangePwd() | ||||
@@ -764,18 +766,11 @@ namespace Learun.Application.Web.Controllers | |||||
{ | { | ||||
return Fail("手机号格式不正确!"); | return Fail("手机号格式不正确!"); | ||||
} | } | ||||
//todo:待取消注释 | |||||
//string raRndNum = Learun.Util.CommonHelper.RndNum(6); | |||||
string raRndNum = "123456"; | |||||
var listStr = new List<string>(); | var listStr = new List<string>(); | ||||
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; | |||||
listStr.Add(str1); | |||||
//todo:待开发短信平台 | |||||
//var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
//if (result.Result.code == "0") | |||||
if (true) | |||||
var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
if (result.Result.code == "OK") | |||||
{ | { | ||||
redisCache.Write<string>("sendcodeinpc_" + codeType + "_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
redisCache.Write<string>("sendcodeinpc_" + codeType + "_" + userEntity.F_Mobile, result.Result.randomNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
//日志 | //日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_CategoryId = 3; | logEntity.F_CategoryId = 3; | ||||
@@ -784,10 +779,10 @@ namespace Learun.Application.Web.Controllers | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 200; | logEntity.F_ExecuteResult = 200; | ||||
logEntity.F_ExecuteResultJson = "短信发送成功:";// + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + raRndNum; | |||||
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + result.Result.randomNum; | |||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
return Success("短信发送成功:");// + result.Result.message); | |||||
return Success("短信发送成功:" + result.Result.message); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -798,10 +793,10 @@ namespace Learun.Application.Web.Controllers | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 400; | logEntity.F_ExecuteResult = 400; | ||||
//logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
//logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
//logEntity.WriteLog(); | |||||
//return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
logEntity.WriteLog(); | |||||
return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
} | } | ||||
} | } | ||||
@@ -1254,18 +1254,11 @@ namespace Learun.Application.Web.Controllers | |||||
{ | { | ||||
return Fail("当前用户非首次登录,请使用账号密码进行登录!"); | return Fail("当前用户非首次登录,请使用账号密码进行登录!"); | ||||
} | } | ||||
//todo:待取消注释 | |||||
//string raRndNum = Learun.Util.CommonHelper.RndNum(6); | |||||
string raRndNum = "123456"; | |||||
var listStr = new List<string>(); | var listStr = new List<string>(); | ||||
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; | |||||
listStr.Add(str1); | |||||
//todo:待开发短信平台 | |||||
//var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
//if (result.Result.code == "0") | |||||
if (true) | |||||
{ | |||||
redisCache.Write<string>("sendcodeinpc_" + codeType + "_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
if (result.Result.code == "OK") | |||||
{ | |||||
redisCache.Write<string>("sendcodeinpc_" + codeType + "_" + userEntity.F_Mobile, result.Result.randomNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
//日志 | //日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_CategoryId = 3; | logEntity.F_CategoryId = 3; | ||||
@@ -1274,10 +1267,10 @@ namespace Learun.Application.Web.Controllers | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 200; | logEntity.F_ExecuteResult = 200; | ||||
logEntity.F_ExecuteResultJson = "短信发送成功:";// + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + raRndNum; | |||||
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + result.Result.randomNum; | |||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
return Success("短信发送成功:");// + result.Result.message); | |||||
return Success("短信发送成功:" + result.Result.message); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -1288,10 +1281,10 @@ namespace Learun.Application.Web.Controllers | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 400; | logEntity.F_ExecuteResult = 400; | ||||
//logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
//logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
//logEntity.WriteLog(); | |||||
//return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
logEntity.WriteLog(); | |||||
return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -117,18 +117,11 @@ namespace Learun.Application.WebApi | |||||
{ | { | ||||
return Fail("手机号格式不正确!"); | return Fail("手机号格式不正确!"); | ||||
} | } | ||||
//todo:待取消注释 | |||||
//string raRndNum = Learun.Util.CommonHelper.RndNum(6); | |||||
string raRndNum = "123456"; | |||||
var listStr = new List<string>(); | var listStr = new List<string>(); | ||||
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; | |||||
listStr.Add(str1); | |||||
//todo:待开发短信平台 | |||||
//var result = aliyunSms.SendSmsToSingle(loginModel.username, SmsType.LoginBind, listStr); | |||||
//if (result.Result.code == "0") | |||||
if (true) | |||||
{ | |||||
redisCache.Write<string>("sendcodeinapp_" + loginModel.codeType + "_" + loginModel.username, raRndNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
var result = aliyunSms.SendSmsToSingle(loginModel.username, SmsType.LoginBind, listStr); | |||||
if (result.Result.code == "OK") | |||||
{ | |||||
redisCache.Write<string>("sendcodeinapp_" + loginModel.codeType + "_" + loginModel.username, result.Result.randomNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
//日志 | //日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_CategoryId = 3; | logEntity.F_CategoryId = 3; | ||||
@@ -137,10 +130,10 @@ namespace Learun.Application.WebApi | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 200; | logEntity.F_ExecuteResult = 200; | ||||
logEntity.F_ExecuteResultJson = "短信发送成功:";// + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + loginModel.username + " 验证码:" + raRndNum; | |||||
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + loginModel.username + " 验证码:" + result.Result.randomNum; | |||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
return Success("短信发送成功:");// + result.Result.message); | |||||
return Success("短信发送成功:" + result.Result.message); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -151,10 +144,10 @@ namespace Learun.Application.WebApi | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 400; | logEntity.F_ExecuteResult = 400; | ||||
//logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
//logEntity.F_Description = "短信发送:" + loginModel.username; | |||||
//logEntity.WriteLog(); | |||||
//return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
logEntity.F_Description = "短信发送:" + loginModel.username; | |||||
logEntity.WriteLog(); | |||||
return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
} | } | ||||
} | } | ||||
@@ -112,18 +112,11 @@ namespace Learun.Application.WebApi | |||||
{ | { | ||||
return Fail("当前用户非首次登录,请使用账号密码进行登录!"); | return Fail("当前用户非首次登录,请使用账号密码进行登录!"); | ||||
} | } | ||||
//todo:待取消注释 | |||||
//string raRndNum = Learun.Util.CommonHelper.RndNum(6); | |||||
string raRndNum = "123456"; | |||||
var listStr = new List<string>(); | var listStr = new List<string>(); | ||||
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; | |||||
listStr.Add(str1); | |||||
//todo:待开发短信平台 | |||||
//var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
//if (result.Result.code == "0") | |||||
if (true) | |||||
var result = aliyunSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); | |||||
if (result.Result.code == "OK") | |||||
{ | { | ||||
redisCache.Write<string>("sendcodeinapp_" + loginModel.codeType + "_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
redisCache.Write<string>("sendcodeinapp_" + loginModel.codeType + "_" + userEntity.F_Mobile, result.Result.randomNum, new TimeSpan(0, 5, 0), CacheId.sms); | |||||
//日志 | //日志 | ||||
LogEntity logEntity = new LogEntity(); | LogEntity logEntity = new LogEntity(); | ||||
logEntity.F_CategoryId = 3; | logEntity.F_CategoryId = 3; | ||||
@@ -132,10 +125,10 @@ namespace Learun.Application.WebApi | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 200; | logEntity.F_ExecuteResult = 200; | ||||
logEntity.F_ExecuteResultJson = "短信发送成功:";// + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + raRndNum; | |||||
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile + " 验证码:" + result.Result.randomNum; | |||||
logEntity.WriteLog(); | logEntity.WriteLog(); | ||||
return Success("短信发送成功:");// + result.Result.message); | |||||
return Success("短信发送成功:" + result.Result.message); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -146,10 +139,10 @@ namespace Learun.Application.WebApi | |||||
logEntity.F_OperateType = "sms"; | logEntity.F_OperateType = "sms"; | ||||
logEntity.F_OperateAccount = "system"; | logEntity.F_OperateAccount = "system"; | ||||
logEntity.F_ExecuteResult = 400; | logEntity.F_ExecuteResult = 400; | ||||
//logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
//logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
//logEntity.WriteLog(); | |||||
//return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; | |||||
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; | |||||
logEntity.WriteLog(); | |||||
return Fail("短信发送失败:" + result.Result.message + result.Result.errorType); | |||||
} | } | ||||
} | } | ||||
/// <summary> | /// <summary> | ||||
@@ -70,14 +70,11 @@ namespace Quanjiang.DigitalScholl.SendSms | |||||
var randomNum = CommonHelper.RandNum(6); | var randomNum = CommonHelper.RandNum(6); | ||||
switch (st) | switch (st) | ||||
{ | { | ||||
case SmsType.Register: | |||||
result = ("SMS_137485060", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); | |||||
break; | |||||
case SmsType.LoginBind: | case SmsType.LoginBind: | ||||
result = ("SMS_137485060", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); | |||||
result = ("SMS_468910589", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); | |||||
break; | break; | ||||
case SmsType.ForgetPassWord: | case SmsType.ForgetPassWord: | ||||
result = ("SMS_137485060", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); | |||||
result = ("SMS_468910589", JsonConvert.SerializeObject(new { code = randomNum }), randomNum); | |||||
break; | break; | ||||
default: | default: | ||||
throw new ArgumentOutOfRangeException(nameof(st), st, null); | throw new ArgumentOutOfRangeException(nameof(st), st, null); | ||||
@@ -7,7 +7,7 @@ | |||||
<add key="accessId" value="LTAI5tN7Ho7CDCofubXpnBV5" /> | <add key="accessId" value="LTAI5tN7Ho7CDCofubXpnBV5" /> | ||||
<add key="accessSecret" value="U3wm0BhY6S3x4bPcCOWrjUz6tDTo6H" /> | <add key="accessSecret" value="U3wm0BhY6S3x4bPcCOWrjUz6tDTo6H" /> | ||||
<add key="regionIdForPop" value="cn-hangzhou" /> | <add key="regionIdForPop" value="cn-hangzhou" /> | ||||
<add key="SignName" value="阿里云短信测试专用" /> | |||||
<add key="SignName" value="西昌民族幼专" /> | |||||
<!--斑羚短信平台--> | <!--斑羚短信平台--> | ||||
<add key="sdkappid" value="140009369387" /> | <add key="sdkappid" value="140009369387" /> | ||||
<add key="appkey" value="4d2743a4233e5d8625eefa31f876721b" /> | <add key="appkey" value="4d2743a4233e5d8625eefa31f876721b" /> | ||||