Browse Source

登录修改

娄底高职分支
hwh2023 9 months ago
parent
commit
ed4f5fcb3e
6 changed files with 287 additions and 4 deletions
  1. +2
    -2
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Officermailpage/Form.cshtml
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Officermailpage/Form.js
  3. +1
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj
  4. +135
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs
  5. +147
    -0
      Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs
  6. +1
    -1
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js

+ 2
- 2
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Officermailpage/Form.cshtml View File

@@ -11,10 +11,10 @@
<div class="lr-form-item-title">录取专业<font face="宋体">*</font></div>
<div id="speciality" isvalid="yes" checkexpession="NotNull" ></div>
</div>
<div class="col-xs-12 lr-form-item" data-table="Officermailpage" >
@*<div class="col-xs-12 lr-form-item" data-table="Officermailpage" >
<div class="lr-form-item-title">退档申请书模板</div>
<div id="tempfile" ></div>
</div>
</div>*@
<div class="col-xs-12 lr-form-item" data-table="Officermailpage" >
<div class="lr-form-item-title">学生退档申请书</div>
<div id="applicationfile" ></div>


+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/Officermailpage/Form.js View File

@@ -16,7 +16,7 @@ var bootstrap = function ($, learun) {
},
bind: function () {
$('#speciality').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname' });
$('#tempfile').lrUploader();
//$('#tempfile').lrUploader();
$('#applicationfile').lrUploader();
},
initData: function () {


+ 1
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj View File

@@ -294,6 +294,7 @@
<Compile Include="Modules\LR_Crm\Invoice.cs" />
<Compile Include="Modules\TimeTable.cs" />
<Compile Include="Modules\TransferApi.cs" />
<Compile Include="Modules\UsernologinApi.cs" />
<Compile Include="Modules\UtilityApi.cs" />
<Compile Include="Modules\WeixinApi.cs" />
<Compile Include="Modules\WorkFlowApi.cs" />


+ 135
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UserApi.cs View File

@@ -50,6 +50,7 @@ namespace Learun.Application.WebApi
private PostIBLL postIBLL = new PostBLL();
private RoleIBLL roleIBLL = new RoleBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
CdMajorIBLL majorIbll = new CdMajorBLL();
private readonly ISms yixintongSms = new YixintongSms();
private ICache redisCache = CacheFactory.CaChe();
@@ -97,6 +98,81 @@ namespace Learun.Application.WebApi

}

/// <summary>
/// 忘记密码,发送验证码
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
private Response Sendcode(dynamic _)
{
LoginModel loginModel = this.GetReqData<LoginModel>();
UserEntity userEntity = userIBLL.GetEntityByMobile(loginModel.username);

#region 写入日志
LogEntity logEntity = new LogEntity();
logEntity.F_CategoryId = 1;
logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString();
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login);
logEntity.F_OperateAccount = loginModel.username + "(" + userEntity.F_RealName + ")";
logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : loginModel.username;
logEntity.F_Module = Config.GetValue("SoftName");
logEntity.F_Description = "移动端";
#endregion

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();
return Success("短信发送成功:" + result.Result.message);
}
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();
return Success("短信发送失败:" + result.Result.message + result.Result.errorType);
}
}
/// <summary>
/// 忘记密码修改密码
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
private Response forgetpass(dynamic _)
{
ModifyModel modifyModel = this.GetReqData<ModifyModel>();

UserEntity userEntity = userIBLL.GetEntityByMobile(modifyModel.phone);
userIBLL.setPassword(userEntity.F_UserId, modifyModel.newpassword);

return Success("密码修改成功");
}






/// <summary>
/// 登录接口
/// </summary>
@@ -156,6 +232,7 @@ namespace Learun.Application.WebApi
}
if (!pwd)
{
//增加短信发送验证
var studententity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(userEntity.F_Account);
if (studententity != null)
{
@@ -213,6 +290,63 @@ namespace Learun.Application.WebApi
logEntity.WriteLog();
}
}
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
{
//学生增加短信发送验证
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)
{
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 = "短信发送失败:" + e.Message;
logEntity.F_Description = "短信发送:" + userEntity.F_Mobile;
logEntity.WriteLog();
}
}
}
var jsonData = new
{
@@ -603,6 +737,7 @@ namespace Learun.Application.WebApi
/// </summary>
public class ModifyModel
{
public string phone { set; get; }
/// <summary>
/// 新密码
/// </summary>


+ 147
- 0
Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/UsernologinApi.cs View File

@@ -0,0 +1,147 @@
using System;
using Learun.Application.Base.SystemModule;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.EducationalAdministration;
using Learun.Util;
using Learun.Util.Operat;
using Nancy;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using Learun.Application.TwoDevelopment.LR_Desktop;
using Learun.Cache.Base;
using Learun.Cache.Factory;
using Quanjiang.DigitalScholl.SendSms;

namespace Learun.Application.WebApi
{
/// <summary>
/// 版 本 Learun-ADMS V7.0.0 数字化智慧校园
/// Copyright (c) 2013-2018 北京泉江科技有限公司
/// 创建人:数字化智慧校园-框架开发组
/// 日 期:2017.05.12
/// 描 述:用户信息
/// </summary>
public class UsernologinApi : BaseNoLoginApi
{
/// <summary>
/// 注册接口
/// </summary>
public UsernologinApi()
: base("/learun/adms/usernologin")
{
Post["/sendcode"] = Sendcode;
Post["/forgetpass"] = forgetpass;

}
private UserIBLL userIBLL = new UserBLL();
private PostIBLL postIBLL = new PostBLL();
private RoleIBLL roleIBLL = new RoleBLL();
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL();
private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL();
CdMajorIBLL majorIbll = new CdMajorBLL();
private readonly ISms yixintongSms = new YixintongSms();
private ICache redisCache = CacheFactory.CaChe();
private Sys_UpdateRecordIBLL sysUpdateRecordIbll = new Sys_UpdateRecordBLL();
AnnexesFileIBLL annexesFileIbll=new AnnexesFileBLL();



/// <summary>
/// 登录二次短信验证
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
private Response LoginCodeVerify(dynamic _)
{
MobileVerify mobileVerify = this.GetReqData<MobileVerify>();
var code = redisCache.Read<string>("studentuserlogin_" + mobileVerify.mobile);
if (!string.IsNullOrEmpty(code) && code == mobileVerify.verifycode)
{
return Success("验证成功。");
}
else
{
return Fail("验证失败,验证码错误或已失效。");
}

}
/// <summary>
/// 忘记密码,发送验证码
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
private Response Sendcode(dynamic _)
{
LoginModel loginModel = this.GetReqData<LoginModel>();
UserEntity userEntity = userIBLL.GetEntityByMobile(loginModel.username);
if (userEntity == null)
{
return Fail("用户不存在");
}
#region 写入日志
LogEntity logEntity = new LogEntity();
logEntity.F_CategoryId = 1;
logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString();
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login);
logEntity.F_OperateAccount = loginModel.username + "(" + userEntity.F_RealName + ")";
logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : loginModel.username;
logEntity.F_Module = Config.GetValue("SoftName");
logEntity.F_Description = "移动端";
#endregion

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();
return Success("短信发送成功:" + result.Result.message);
}
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();
return Fail("短信发送失败:" + result.Result.message + result.Result.errorType);
}
}
/// <summary>
/// 忘记密码修改密码
/// </summary>
/// <param name="_"></param>
/// <returns></returns>
private Response forgetpass(dynamic _)
{
ModifyModel modifyModel = this.GetReqData<ModifyModel>();

UserEntity userEntity = userIBLL.GetEntityByMobile(modifyModel.phone);
if (userEntity == null)
{
return Fail("用户不存在");
}
userIBLL.setPassword(userEntity.F_UserId, modifyModel.newpassword);

return Success("密码修改成功");
}

}
}

+ 1
- 1
Learun.Framework.Ultimate V7/LearunApp-2.2.0/config.js View File

@@ -7,7 +7,7 @@ export default {
"enableSignUp": true,
//请求数据的接口地址;可以配置多个,开发环境下登录页会出现选择菜单供您选择
"apiHost": [
"http://fwh.ldyesz.edu.cn:9000/",//H5打包
"http://localhost:31173/",//H5打包
// "http://10.10.4.45:9000/"//app打包,
// "http://localhost:31173/",
],


Loading…
Cancel
Save