|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
using com.sun.xml.@internal.ws.api.model; |
|
|
|
|
using Elight.Entity; |
|
|
|
|
using Elight.Entity.SystemModel; |
|
|
|
|
using Elight.Logic; |
|
|
|
|
using Elight.Logic.SystemModel; |
|
|
|
|
using Elight.Utility; |
|
|
|
|
using Elight.Utility.Code; |
|
|
|
|
using Elight.Utility.Encrypt; |
|
|
|
|
using Elight.Utility.Extensions; |
|
|
|
|
using Elight.Utility.logs; |
|
|
|
|
using javax.xml.crypto; |
|
|
|
@ -160,7 +162,7 @@ namespace _24Hour.Controllers.system
|
|
|
|
|
UserModel.createusername = _userdata.name; |
|
|
|
|
UserModel.usertype = 0; |
|
|
|
|
//默认密码 |
|
|
|
|
UserModel.Password = Elight.Utility.Encrypt.Md5.Encrypt32($"mr123456").ToLower(); |
|
|
|
|
UserModel.Password = string.IsNullOrEmpty(UserModel.Password) ? Elight.Utility.Encrypt.Md5.Encrypt32($"mr123456").ToLower() : Elight.Utility.Encrypt.Md5.Encrypt32(UserModel.Password).ToLower(); |
|
|
|
|
var num = await _db.Insertable(UserModel).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
if (num > 0) |
|
|
|
@ -179,6 +181,53 @@ namespace _24Hour.Controllers.system
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 修改密码 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="info"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPost] |
|
|
|
|
[Route("UpdatePass")] |
|
|
|
|
public async Task<Result> UpdateUser(UpdatePassModel UserModel) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
var model = await _db.Queryable<App_Sys_UserModel>().Where(x => x.Id== UserModel.Id).FirstAsync(); |
|
|
|
|
if (model == null) |
|
|
|
|
{ |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
result.result = "数据不存在"; |
|
|
|
|
} |
|
|
|
|
var Passmd5 = Md5.Encrypt32(UserModel.OldPassword).ToLower(); |
|
|
|
|
var newpass = Md5.Encrypt32(UserModel.Password).ToLower(); |
|
|
|
|
if (Passmd5 != model.Password) |
|
|
|
|
{ |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
result.Message = "账号或密码错误!"; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
model.Password= newpass; |
|
|
|
|
|
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Updateable(model).UpdateColumns(it => new { it.Password }).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
if (num > 0) |
|
|
|
|
{ |
|
|
|
|
result.IsSucceed = true; |
|
|
|
|
result.result = "修改成功"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (System.Exception ex) |
|
|
|
|
{ |
|
|
|
|
_db.RollbackTran(); |
|
|
|
|
result.IsSucceed = false; |
|
|
|
|
result.Message = ex.Message; |
|
|
|
|
} |
|
|
|
|
_logs.WriteSysLogadd("用户管理", "修改人员信息", result, _db); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 修改用户 |
|
|
|
|
/// </summary> |
|
|
|
@ -190,8 +239,20 @@ namespace _24Hour.Controllers.system
|
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
var model = await _db.Queryable<App_Sys_UserModel>().Where(x => x.Id== UserModel.Id).FirstAsync(); |
|
|
|
|
if (model != null) |
|
|
|
|
{ |
|
|
|
|
model.unitCode=UserModel.unitCode; |
|
|
|
|
model.department=UserModel.department; |
|
|
|
|
model.name=UserModel.name; |
|
|
|
|
model.sex=UserModel.sex; |
|
|
|
|
model.duties=UserModel.duties; |
|
|
|
|
model.phone=UserModel.phone; |
|
|
|
|
model.cardId=UserModel.cardId; |
|
|
|
|
} |
|
|
|
|
_db.BeginTran(); |
|
|
|
|
var num = await _db.Updateable(UserModel).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
|
|
|
|
var num = await _db.Updateable(model).UpdateColumns(it => new { it.unitCode, it.department, it.name, it.sex, it.duties, it.phone, it.cardId }).ExecuteCommandAsync(); |
|
|
|
|
//var num = await _db.Updateable(UserModel).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); |
|
|
|
|
_db.CommitTran(); |
|
|
|
|
if (num > 0) |
|
|
|
|
{ |
|
|
|
|