|
|
@@ -47,6 +47,7 @@ namespace Learun.Application.WebApi |
|
|
|
|
|
|
|
} |
|
|
|
private UserIBLL userIBLL = new UserBLL(); |
|
|
|
//private logibll userIBLL = new UserBLL(); |
|
|
|
private PostIBLL postIBLL = new PostBLL(); |
|
|
|
private RoleIBLL roleIBLL = new RoleBLL(); |
|
|
|
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); |
|
|
@@ -230,6 +231,8 @@ namespace Learun.Application.WebApi |
|
|
|
{ |
|
|
|
pwd = true; |
|
|
|
} |
|
|
|
//是否发送短信了 |
|
|
|
bool whethersendsms = false; |
|
|
|
if (!pwd) |
|
|
|
{ |
|
|
|
//增加短信发送验证 |
|
|
@@ -242,39 +245,59 @@ namespace Learun.Application.WebApi |
|
|
|
{ |
|
|
|
res.userInfo.majorno = majorinfo.ID ?? ""; |
|
|
|
} |
|
|
|
try |
|
|
|
#region 判断是否需要发短信 |
|
|
|
string queryjson = "{\"keywords\":\"" + userEntity.F_Mobile + "\"}"; |
|
|
|
LogEntity lastsendlog = LogBLL.GetlikeList(queryjson); |
|
|
|
if (lastsendlog != null) |
|
|
|
{ |
|
|
|
//学生增加短信发送验证 |
|
|
|
string raRndNum = Learun.Util.CommonHelper.RndNum(6); |
|
|
|
var listStr = new List<string>(); |
|
|
|
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; |
|
|
|
listStr.Add(str1); |
|
|
|
var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); |
|
|
|
if (result.Result.code == "0") |
|
|
|
var aa = ((DateTime)lastsendlog.F_OperateTime - DateTime.Now).TotalMinutes; |
|
|
|
//大于30天就要发短信了 |
|
|
|
if (Math.Abs(aa) > 30 * 24 * 60 ) |
|
|
|
{ |
|
|
|
redisCache.Write<string>("studentuserlogin_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0)); |
|
|
|
//日志 |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 3; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 200; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
whethersendsms = true; |
|
|
|
} |
|
|
|
else |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
whethersendsms = true; |
|
|
|
} |
|
|
|
#endregion |
|
|
|
try |
|
|
|
{ |
|
|
|
if (whethersendsms) |
|
|
|
{ |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 4; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 400; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
//学生增加短信发送验证 |
|
|
|
string raRndNum = Learun.Util.CommonHelper.RndNum(6); |
|
|
|
var listStr = new List<string>(); |
|
|
|
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; |
|
|
|
listStr.Add(str1); |
|
|
|
var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); |
|
|
|
if (result.Result.code == "0") |
|
|
|
{ |
|
|
|
redisCache.Write<string>("studentuserlogin_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0)); |
|
|
|
//日志 |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 3; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 200; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 4; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 400; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
@@ -293,45 +316,60 @@ namespace Learun.Application.WebApi |
|
|
|
var teacherentity = empInfoIBLL.GetEmpInfoEntityByEmpNo(userEntity.F_Account); |
|
|
|
if (teacherentity != null) |
|
|
|
{ |
|
|
|
//res.userInfo.grade = studententity.Grade; |
|
|
|
//var majorinfo = majorIbll.GetCdMajorEntityByMajorNo(studententity.MajorNo); |
|
|
|
//if (majorinfo != null) |
|
|
|
//{ |
|
|
|
// res.userInfo.majorno = majorinfo.ID ?? ""; |
|
|
|
//} |
|
|
|
try |
|
|
|
|
|
|
|
#region 判断是否需要发短信 |
|
|
|
string queryjson = "{\"keywords\":\"" + userEntity.F_Mobile + "\"}"; |
|
|
|
LogEntity lastsendlog = LogBLL.GetlikeList(queryjson); |
|
|
|
if (lastsendlog != null) |
|
|
|
{ |
|
|
|
//学生增加短信发送验证 |
|
|
|
string raRndNum = Learun.Util.CommonHelper.RndNum(6); |
|
|
|
var listStr = new List<string>(); |
|
|
|
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; |
|
|
|
listStr.Add(str1); |
|
|
|
var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); |
|
|
|
if (result.Result.code == "0") |
|
|
|
var aa = ((DateTime)lastsendlog.F_OperateTime - DateTime.Now).TotalMinutes; |
|
|
|
//大于30天就要发短信了 |
|
|
|
if (Math.Abs(aa) > 7 * 24 * 60 ) |
|
|
|
{ |
|
|
|
redisCache.Write<string>("studentuserlogin_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0)); |
|
|
|
//日志 |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 3; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 200; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
whethersendsms = true; |
|
|
|
} |
|
|
|
else |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
whethersendsms = true; |
|
|
|
} |
|
|
|
#endregion |
|
|
|
try |
|
|
|
{ |
|
|
|
if (whethersendsms) |
|
|
|
{ |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 4; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 400; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
//学生增加短信发送验证 |
|
|
|
string raRndNum = Learun.Util.CommonHelper.RndNum(6); |
|
|
|
var listStr = new List<string>(); |
|
|
|
var str1 = $"欢迎使用智慧校园,您本次登录的验证码是 " + raRndNum + "。"; |
|
|
|
listStr.Add(str1); |
|
|
|
var result = yixintongSms.SendSmsToSingle(userEntity.F_Mobile, SmsType.LoginBind, listStr); |
|
|
|
if (result.Result.code == "0") |
|
|
|
{ |
|
|
|
redisCache.Write<string>("studentuserlogin_" + userEntity.F_Mobile, raRndNum, new TimeSpan(0, 5, 0)); |
|
|
|
//日志 |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 3; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 200; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送成功:" + result.Result.message; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
logEntity = new LogEntity(); |
|
|
|
logEntity.F_CategoryId = 4; |
|
|
|
logEntity.F_OperateTypeId = "sms"; |
|
|
|
logEntity.F_OperateType = "sms"; |
|
|
|
logEntity.F_OperateAccount = "system"; |
|
|
|
logEntity.F_ExecuteResult = 400; |
|
|
|
logEntity.F_ExecuteResultJson = "短信发送失败:" + result.Result.message + result.Result.errorType; |
|
|
|
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile; |
|
|
|
logEntity.WriteLog(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception e) |
|
|
@@ -358,7 +396,8 @@ namespace Learun.Application.WebApi |
|
|
|
baseinfo = res.userInfo, |
|
|
|
post = postIBLL.GetListByPostIds(res.userInfo.postIds), |
|
|
|
role = roleIBLL.GetListByRoleIds(res.userInfo.roleIds), |
|
|
|
pwd = pwd |
|
|
|
pwd = pwd, |
|
|
|
sendresult=whethersendsms |
|
|
|
}; |
|
|
|
return Success(jsonData); |
|
|
|
} |
|
|
|