diff --git a/24Hour/Controllers/Common/LawyerArchivesController.cs b/24Hour/Controllers/Common/LawyerArchivesController.cs index 1a4604e..86fa6c7 100644 --- a/24Hour/Controllers/Common/LawyerArchivesController.cs +++ b/24Hour/Controllers/Common/LawyerArchivesController.cs @@ -1059,10 +1059,12 @@ namespace _24Hour.Controllers.Common if (System.IO.File.Exists(filepath)) { var basestr = Elight.Utility.Encrypt.DataEncryption.Decryptiones(filepath); + var filename = Path.GetFileName(filepath); + filename = Path.ChangeExtension(filename, ".jpg"); await twentyClient.UploadImage(new UploadDto() { Bmsah = registerinfo.bmsah, - FileName = Path.GetFileName(filepath), + FileName = filename, Code = typecode, Bhdlbm = registerinfo.bhdlbh, UnitCode = registerinfo.dwbm, @@ -1077,7 +1079,7 @@ namespace _24Hour.Controllers.Common await UploadPhoto(lawyer.identityphoto, "1423000000100"); - await UploadPhoto(lawyer.departmentPhoto, "1423000000200"); + await UploadPhoto(lawyersvc.departmentPhoto, "1423000000200"); await UploadPhoto(lawyersvc.annex, "1423000000300"); await UploadPhoto(lawyersvc.legalAidPhoto, "1423000000400"); await UploadPhoto(lawyer.cardIdphoto, "1423000000500"); @@ -1822,7 +1824,7 @@ namespace _24Hour.Controllers.Common { userim.cardIdphoto = cardids; userim.identityphoto = files; - userim.departmentPhoto = departments; + userim.unitCode = _userdata.unitCode; userim.identity = "律师"; userim.IsDeleted = 0; @@ -1834,7 +1836,6 @@ namespace _24Hour.Controllers.Common { user.cardIdphoto = cardids; user.identityphoto = files; - user.departmentPhoto = departments; user.unitCode = _userdata.unitCode; user.identity = "律师"; user.IsDeleted = 0; @@ -1844,7 +1845,6 @@ namespace _24Hour.Controllers.Common { x.cardIdphoto, x.identityphoto, - x.departmentPhoto, x.unitCode, x.identity, x.IsDeleted @@ -1892,6 +1892,14 @@ namespace _24Hour.Controllers.Common .ToList() .ConvertToJsonStr(); + var departmentPhoto = Path.Combine(ziplawyersvcs, lawyersvc.Id, "departmentPhoto"); + var departmentPhotos = new DirectoryInfo(departmentPhoto) + .GetFiles() + .Select(x => "/CaseFile/imports/" + Path.GetRelativePath(dir, x.FullName) + .Replace(@"\", @"/")) + .ToList() + .ConvertToJsonStr(); + if (svc == null) { var lawyer = await _db.Queryable() @@ -1906,6 +1914,7 @@ namespace _24Hour.Controllers.Common lawyersvc.legalAidPhoto = legalAidPhotos; lawyersvc.relationshipProofPhoto = relationshipProofPhotos; lawyersvc.otherPhoto = otherPhotos; + lawyersvc.departmentPhoto = departmentPhotos; lawyersvc.IsAssigned = false; _db.BeginTran(); var num = await _db.Insertable(lawyersvc).ExecuteCommandAsync(); @@ -2025,6 +2034,7 @@ namespace _24Hour.Controllers.Common packetPhotoField(item?.legalAidPhoto, "legalAidPhoto"); packetPhotoField(item?.relationshipProofPhoto, "relationshipProofPhoto"); packetPhotoField(item?.otherPhoto, "otherPhoto"); + packetPhotoField(item?.departmentPhoto, "departmentPhoto"); } //存储用户的相关附件 foreach (var item in users) @@ -2060,19 +2070,19 @@ namespace _24Hour.Controllers.Common } } - var departmentPhotos = item.departmentPhoto.ConvertToModel>(); - var departmentPhotosDir = Path.Combine(userdir, "departmentPhotos"); - if (Directory.Exists(departmentPhotosDir) == false) Directory.CreateDirectory(departmentPhotosDir); - foreach (var file in departmentPhotos) - { - //var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); - var urlpath = file.Split('/'); - var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot", Path.Combine(urlpath)); - if (System.IO.File.Exists(filepath)) - { - System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath)), true); - } - } + ////var departmentPhotos = item.departmentPhoto.ConvertToModel>(); + ////var departmentPhotosDir = Path.Combine(userdir, "departmentPhotos"); + ////if (Directory.Exists(departmentPhotosDir) == false) Directory.CreateDirectory(departmentPhotosDir); + ////foreach (var file in departmentPhotos) + ////{ + //// //var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot") + file.Replace("/", @"\"); + //// var urlpath = file.Split('/'); + //// var filepath = Path.Combine(Environment.CurrentDirectory, "wwwroot", Path.Combine(urlpath)); + //// if (System.IO.File.Exists(filepath)) + //// { + //// System.IO.File.Copy(filepath, Path.Combine(departmentPhotosDir, Path.GetFileName(filepath)), true); + //// } + ////} } logger.LogInformation("step4"); ZipFile.CreateFromDirectory(packegdir, packegzipname); diff --git a/24Hour/Controllers/LoginController.cs b/24Hour/Controllers/LoginController.cs index 7f084a2..6fdf6fa 100644 --- a/24Hour/Controllers/LoginController.cs +++ b/24Hour/Controllers/LoginController.cs @@ -1,57 +1,57 @@ using _24Hour.Model; using com.sun.org.apache.bcel.@internal.generic; -using com.sun.xml.@internal.ws.api.model; -using Elight.Entity; -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 java.security; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; +using com.sun.xml.@internal.ws.api.model; +using Elight.Entity; +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 java.security; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Microsoft.IdentityModel.Tokens; -using Newtonsoft.Json; -using SqlSugar; -using System.IdentityModel.Tokens.Jwt; -using System.Runtime.Serialization; -using System.Security.Claims; -using System.Text; - -namespace _24Hour.Controllers +using Microsoft.IdentityModel.Tokens; +using Newtonsoft.Json; +using SqlSugar; +using System.IdentityModel.Tokens.Jwt; +using System.Runtime.Serialization; +using System.Security.Claims; +using System.Text; + +namespace _24Hour.Controllers { - /// - /// ¼ - /// -#if DEBUG + /// + /// ¼ + /// +#if DEBUG -#else - [HiddenApi] -#endif - [ApiController] - [Route("api/APP")] - public class LoginController : ControllerBase - { - private readonly IConfiguration _configuration; - private readonly SqlSugarClient _db;//ݿ - private readonly WriteSysLog _logs;//־ - private readonly ILogger _logger;//־ - private readonly WechatMessagerClient wechatMessagerClient; - Result ret = new Result(); - public LoginController(ILogger logger, SqlSugarClient db, IConfiguration configuration, WechatMessagerClient _wechatMessagerClient) - { - _logger = logger; - _db = db; - _configuration = configuration; - this.wechatMessagerClient = _wechatMessagerClient; +#else + [HiddenApi] +#endif + [ApiController] + [Route("api/APP")] + public class LoginController : ControllerBase + { + private readonly IConfiguration _configuration; + private readonly SqlSugarClient _db;//ݿ + private readonly WriteSysLog _logs;//־ + private readonly ILogger _logger;//־ + private readonly WechatMessagerClient wechatMessagerClient; + Result ret = new Result(); + public LoginController(ILogger logger, SqlSugarClient db, IConfiguration configuration, WechatMessagerClient _wechatMessagerClient) + { + _logger = logger; + _db = db; + _configuration = configuration; + this.wechatMessagerClient = _wechatMessagerClient; } - [HttpPost] - [Route("LoginDefault")] + [HttpPost] + [Route("LoginDefault")] [CustomCorsActionFilterAttribute] public async Task LoginDefault() { @@ -77,10 +77,10 @@ namespace _24Hour.Controllers date.departmentName = dept.departname; } } - #region jwttoken + #region jwttoken var tokenHandler = new JwtSecurityTokenHandler(); var claims = new Claim[] - { + { new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), }; @@ -116,23 +116,23 @@ namespace _24Hour.Controllers #endregion ret.IsSucceed = true; return ret; - } - - - /// - /// ϵͳ¼ - /// - /// - /// - [HttpPost] - [Route("SystemLogin")] - [CustomCorsActionFilterAttribute] - public async Task SystemLogin(UserLogin login) - { - try - { + } + + + /// + /// ϵͳ¼ + /// + /// + /// + [HttpPost] + [Route("SystemLogin")] + [CustomCorsActionFilterAttribute] + public async Task SystemLogin(UserLogin login) + { + try + { var Passmd5 = Md5.Encrypt32(login.Password).ToLower(); - var date = await _db.Queryable().Where(x => x.phone == login.phone && x.IsDeleted == 0).FirstAsync(); + var date = await _db.Queryable().Where(x => x.phone == login.phone && x.IsDeleted == 0).FirstAsync(); if (date == null) { ret.IsSucceed = false; @@ -154,10 +154,10 @@ namespace _24Hour.Controllers } } - #region jwttoken + #region jwttoken var tokenHandler = new JwtSecurityTokenHandler(); var claims = new Claim[] - { + { new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), }; @@ -184,7 +184,7 @@ namespace _24Hour.Controllers phone = date.phone, photo = date.photo, duties = date.duties, - identity = date.identity, + identity = date.identity, openId = date.wechatId, unitCode = date.unitCode, unitname = Unitdate?.unitname, @@ -192,31 +192,31 @@ namespace _24Hour.Controllers departmentName = date.departmentName, token = tokenString }; - #endregion - } - catch (Exception ex) - { - ret.IsSucceed = false; - ret.Message = $"{ex.Message}"; - LogService.WriteLog(ex, "¼"); - } - return ret; - } - - /// - /// app--¼ - /// - /// - /// - [HttpPost] - [Route("Login")] - [CustomCorsActionFilterAttribute] - public async Task Login(UserLogin login) - { - try - { - var Passmd5 = Md5.Encrypt32(login.Password).ToLower(); - var date = await _db.Queryable().Where(x => x.phone == login.phone && x.IsDeleted == 0).FirstAsync(); + #endregion + } + catch (Exception ex) + { + ret.IsSucceed = false; + ret.Message = $"{ex.Message}"; + LogService.WriteLog(ex, "¼"); + } + return ret; + } + + /// + /// app--¼ + /// + /// + /// + [HttpPost] + [Route("Login")] + [CustomCorsActionFilterAttribute] + public async Task Login(UserLogin login) + { + try + { + var Passmd5 = Md5.Encrypt32(login.Password).ToLower(); + var date = await _db.Queryable().Where(x => x.phone == login.phone && x.IsDeleted == 0).FirstAsync(); if (date == null) { ret.IsSucceed = false; @@ -267,10 +267,10 @@ namespace _24Hour.Controllers date.departmentName = dept.departname; } } - #region jwttoken + #region jwttoken var tokenHandler = new JwtSecurityTokenHandler(); var claims = new Claim[] - { + { new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), }; @@ -295,7 +295,7 @@ namespace _24Hour.Controllers phone = date.phone, photo = date.photo, duties = date.duties, - identity = date.identity, + identity = date.identity, openId = date.wechatId, usertype = date.usertype, unitCode = date.unitCode, @@ -303,16 +303,16 @@ namespace _24Hour.Controllers departmentName = date.departmentName, token = tokenString }; - #endregion - ret.IsSucceed = true; - } - catch (Exception ex) - { - ret.IsSucceed = false; - ret.Message = $"{ex.Message}"; - LogService.WriteLog(ex, "¼"); - } - return ret; + #endregion + ret.IsSucceed = true; + } + catch (Exception ex) + { + ret.IsSucceed = false; + ret.Message = $"{ex.Message}"; + LogService.WriteLog(ex, "¼"); + } + return ret; } /// @@ -320,8 +320,8 @@ namespace _24Hour.Controllers /// /// /// - [HttpGet] - [Route("WeChatLoginCode")] + [HttpGet] + [Route("WeChatLoginCode")] public async Task WeChatLoginByCode(string code) { var opendata = await GetOpenId(code); @@ -339,8 +339,8 @@ namespace _24Hour.Controllers /// /// /// - [HttpGet] - [Route("WeChatLoginByGzhCode")] + [HttpGet] + [Route("WeChatLoginByGzhCode")] public async Task WeChatLoginByGzhCode(string code) { var opendata = await GetGzhOpenId(code); @@ -359,8 +359,8 @@ namespace _24Hour.Controllers ///// ///// ///// - //[HttpGet] - //[Route("GetCode")] + //[HttpGet] + //[Route("GetCode")] //public async Task GetCode(string code,string state) //{ // var opendata = await GetGzhOpenId(code); @@ -372,22 +372,22 @@ namespace _24Hour.Controllers // { // return opendata; // } - //} - - /// - /// ΢Ȩ¼ - /// - /// - /// - [HttpGet] - [Route("WeChatLogin")] - public async Task WeChatLogin(string openId) - { - var date = await _db.Queryable() - .Where(q => q.IsDeleted == 0 && q.wechatId == openId) - .OrderByDescending(x => x.createtime) - .FirstAsync(); - if (date != null) + //} + + /// + /// ΢Ȩ¼ + /// + /// + /// + [HttpGet] + [Route("WeChatLogin")] + public async Task WeChatLogin(string openId) + { + var date = await _db.Queryable() + .Where(q => q.IsDeleted == 0 && q.wechatId == openId) + .OrderByDescending(x => x.createtime) + .FirstAsync(); + if (date != null) { if (date.identity == "ʦ" && date.audit == 1) { @@ -403,103 +403,102 @@ namespace _24Hour.Controllers ret.Message = "ûϢУ"; ret.result = "ûϢ"; return ret; - } + } if (date.isdeactivate == 1) { ret.IsSucceed = false; ret.Message = "˺ѱãϵԱ"; ret.result = "˺ѱ"; return ret; - } - if (date.usertype == 0 && date.becurrent == 1) - { - ret.IsSucceed = false; - ret.Message = $"˺δȨ޷¼ϵԱ"; + } + if (date.usertype == 0 && date.becurrent == 1) + { + ret.IsSucceed = false; + ret.Message = $"˺δȨ޷¼ϵԱ"; ret.result = "˺δȨ޷¼"; - return ret; - } - #region jwttoken - var tokenHandler = new JwtSecurityTokenHandler(); - var claims = new Claim[] - { - new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), - }; - - var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration.GetSection("JwtConfiguration:Jwtkey").Value)); - var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - //Token - var jwttoken = new JwtSecurityToken( - issuer: _configuration.GetSection("JwtConfiguration:Issuer").Value, - audience: _configuration.GetSection("JwtConfiguration:Audience").Value, - claims: claims, - notBefore: DateTime.Now, - expires: DateTime.Now.AddDays(1), - signingCredentials: signingCredentials - ); - //var token = new JwtSecurityTokenHandler().CreateToken(jwttoken); - var tokenString = new JwtSecurityTokenHandler().WriteToken(jwttoken); - ret.result = new - { - Id = date.Id, - name = date.name, - sex = date.sex, - phone = date.phone, - photo = date.photo, - duties = date.duties, - identity = date.identity, - usertype = date.usertype, - unitCode = date.unitCode, - token = tokenString, - openId = date.wechatId, - departmentPhoto = date.departmentPhoto, - identityphoto = date.identityphoto, - cardIdphoto = date.cardIdphoto, - departmentName = date.departmentName, - identitycardId = date.identitycardId, - departmentSCC = date.departmentUnifiedSocialCreditCode - }; - #endregion - ret.IsSucceed = true; - } - else - { - ret.IsSucceed = false; - ret.Message = "΢δȨע˺ţ"; + return ret; + } + #region jwttoken + var tokenHandler = new JwtSecurityTokenHandler(); + var claims = new Claim[] + { + new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), + }; + + var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration.GetSection("JwtConfiguration:Jwtkey").Value)); + var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + //Token + var jwttoken = new JwtSecurityToken( + issuer: _configuration.GetSection("JwtConfiguration:Issuer").Value, + audience: _configuration.GetSection("JwtConfiguration:Audience").Value, + claims: claims, + notBefore: DateTime.Now, + expires: DateTime.Now.AddDays(1), + signingCredentials: signingCredentials + ); + //var token = new JwtSecurityTokenHandler().CreateToken(jwttoken); + var tokenString = new JwtSecurityTokenHandler().WriteToken(jwttoken); + ret.result = new + { + Id = date.Id, + name = date.name, + sex = date.sex, + phone = date.phone, + photo = date.photo, + duties = date.duties, + identity = date.identity, + usertype = date.usertype, + unitCode = date.unitCode, + token = tokenString, + openId = date.wechatId, + identityphoto = date.identityphoto, + cardIdphoto = date.cardIdphoto, + departmentName = date.departmentName, + identitycardId = date.identitycardId, + departmentSCC = date.departmentUnifiedSocialCreditCode + }; + #endregion + ret.IsSucceed = true; + } + else + { + ret.IsSucceed = false; + ret.Message = "΢δȨע˺ţ"; ret.result = "΢δȨ"; - } - return ret; - } - - /// - /// APPû - /// - /// - /// - [HttpPost] - [Route("AddUser1")] - public async Task AddUser1(App_Sys_UserModel UserModel) - { - try + } + return ret; + } + + /// + /// APPû + /// + /// + /// + [HttpPost] + [Route("AddUser1")] + public async Task AddUser1(App_Sys_UserModel UserModel) + { + try { - _logger.LogInformation(UserModel.ConvertToJsonStr()); + _logger.LogInformation(UserModel.ConvertToJsonStr()); //if (string.IsNullOrEmpty(UserModel.wechatId) && await _db.Queryable().AnyAsync(x => x.wechatId == UserModel.wechatId && x.IsDeleted == 0)) //{ // ret.IsSucceed = false; // ret.Message = "ǰ΢˺Ű"; // return ret; //} - if (string.IsNullOrEmpty(UserModel.wechatId) == false) - { - if (await _db.Queryable().AnyAsync(x => x.wechatId == UserModel.wechatId && x.IsDeleted == 0 && x.audit != 1 && x.isdeactivate == 0)) - { - ret.IsSucceed = false; - ret.Message = "ǰ΢˺Ű"; - return ret; - } - } - var data = await _db.Queryable().Where(q => q.phone == UserModel.phone && q.IsDeleted == 0).FirstAsync(); + if (string.IsNullOrEmpty(UserModel.wechatId) == false) + { + if (await _db.Queryable().AnyAsync(x => x.wechatId == UserModel.wechatId && x.IsDeleted == 0 && x.audit != 1 && x.isdeactivate == 0)) + { + ret.IsSucceed = false; + ret.Message = "ǰ΢˺Ű"; + return ret; + } + } + var data = await _db.Queryable().Where(q => q.phone == UserModel.phone && q.IsDeleted == 0).FirstAsync(); if (UserModel.identity == "ʦ") - { + { if (data != null && (data.identity != "ʦ" || data.audit == 0)) { ret.IsSucceed = false; @@ -528,7 +527,6 @@ namespace _24Hour.Controllers data.Password = Elight.Utility.Encrypt.Md5.Encrypt32($"{UserModel.Password}").ToLower(); data.cardIdphoto = UserModel.cardIdphoto; data.identityphoto = UserModel.identityphoto; - data.departmentPhoto = UserModel.departmentPhoto; var num = await _db.Updateable(data).IgnoreColumns(true).ExecuteCommandAsync(); _db.CommitTran(); if (num > 0) @@ -586,7 +584,7 @@ namespace _24Hour.Controllers ret.IsSucceed = true; ret.result = "ӳɹ"; } - } + } } else { @@ -612,57 +610,57 @@ namespace _24Hour.Controllers { ret.IsSucceed = true; ret.result = "ӳɹ"; - } - } - } - catch (System.Exception ex) - { - _db.RollbackTran(); - ret.IsSucceed = false; - ret.Message = ex.Message; - } - return ret; - } - - /// - /// λlist - /// - /// - /// - [HttpPost] - [Route("QueryUnitlist")] - public async Task QueryUnitlist(App_Sys_UnitInput Unitdata) - { - var list = await _db.Queryable() - .WhereIF(!Unitdata.unitCode.IsNull(), q => q.unitCode.Contains(Unitdata.unitCode)) - .WhereIF(!Unitdata.unitname.IsNull(), q => q.unitname.Contains(Unitdata.unitname)) - .WhereIF(!Unitdata.unitjc.IsNull(), q => q.unitjc.Contains(Unitdata.unitjc)) - .Where(q => q.IsDelete == 0).ToListAsync(); - ret.IsSucceed = true; - ret.result = list; - return ret; - } - - /// - /// ȡ豸Ƶַ - /// - /// - /// - [HttpGet] - [Route("getrtsp")] - public async Task getrtsp(string str) - { - ret.IsSucceed = true; - ret.result = $"{_configuration.GetSection($"Videoaddress:{str}").Value}"; - return ret; - } - - [HttpGet] - [Route("cardIdLogin")] - public async Task cardIdLogin(string cardId, string name) - { - var date = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.cardId == cardId && q.name == name).FirstAsync(); - if (date != null) + } + } + } + catch (System.Exception ex) + { + _db.RollbackTran(); + ret.IsSucceed = false; + ret.Message = ex.Message; + } + return ret; + } + + /// + /// λlist + /// + /// + /// + [HttpPost] + [Route("QueryUnitlist")] + public async Task QueryUnitlist(App_Sys_UnitInput Unitdata) + { + var list = await _db.Queryable() + .WhereIF(!Unitdata.unitCode.IsNull(), q => q.unitCode.Contains(Unitdata.unitCode)) + .WhereIF(!Unitdata.unitname.IsNull(), q => q.unitname.Contains(Unitdata.unitname)) + .WhereIF(!Unitdata.unitjc.IsNull(), q => q.unitjc.Contains(Unitdata.unitjc)) + .Where(q => q.IsDelete == 0).ToListAsync(); + ret.IsSucceed = true; + ret.result = list; + return ret; + } + + /// + /// ȡ豸Ƶַ + /// + /// + /// + [HttpGet] + [Route("getrtsp")] + public async Task getrtsp(string str) + { + ret.IsSucceed = true; + ret.result = $"{_configuration.GetSection($"Videoaddress:{str}").Value}"; + return ret; + } + + [HttpGet] + [Route("cardIdLogin")] + public async Task cardIdLogin(string cardId, string name) + { + var date = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.cardId == cardId && q.name == name).FirstAsync(); + if (date != null) { //if (date.usertype == 1 && date.audit == null) // { @@ -677,52 +675,52 @@ namespace _24Hour.Controllers // return ret; // } // else - if (date.usertype == 0 && date.becurrent == 1 && date.isdeactivate == 1) - { - ret.IsSucceed = false; - ret.Message = $"ûδȨ޷¼ϵԱ"; - return ret; - } - #region jwttoken - var tokenHandler = new JwtSecurityTokenHandler(); - var claims = new Claim[] - { - new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), - }; - - var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration.GetSection("JwtConfiguration:Jwtkey").Value)); - var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - //Token - var jwttoken = new JwtSecurityToken( - issuer: _configuration.GetSection("JwtConfiguration:Issuer").Value, - audience: _configuration.GetSection("JwtConfiguration:Audience").Value, - claims: claims, - notBefore: DateTime.Now, - expires: DateTime.Now.AddDays(1), - signingCredentials: signingCredentials - ); - //var token = new JwtSecurityTokenHandler().CreateToken(jwttoken); - var tokenString = new JwtSecurityTokenHandler().WriteToken(jwttoken); - ret.result = new - { - Id = date.Id, - name = date.name, - sex = date.sex, - phone = date.phone, - photo = date.photo, - duties = date.duties, - identity = date.identity, - openId = date.wechatId, - usertype = date.usertype, - unitCode = date.unitCode, - token = tokenString - }; - #endregion - ret.IsSucceed = true; - } - else + if (date.usertype == 0 && date.becurrent == 1 && date.isdeactivate == 1) + { + ret.IsSucceed = false; + ret.Message = $"ûδȨ޷¼ϵԱ"; + return ret; + } + #region jwttoken + var tokenHandler = new JwtSecurityTokenHandler(); + var claims = new Claim[] + { + new Claim(ClaimTypes.UserData,JsonConvert.SerializeObject(date)), + }; + + var key = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(_configuration.GetSection("JwtConfiguration:Jwtkey").Value)); + var signingCredentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + //Token + var jwttoken = new JwtSecurityToken( + issuer: _configuration.GetSection("JwtConfiguration:Issuer").Value, + audience: _configuration.GetSection("JwtConfiguration:Audience").Value, + claims: claims, + notBefore: DateTime.Now, + expires: DateTime.Now.AddDays(1), + signingCredentials: signingCredentials + ); + //var token = new JwtSecurityTokenHandler().CreateToken(jwttoken); + var tokenString = new JwtSecurityTokenHandler().WriteToken(jwttoken); + ret.result = new + { + Id = date.Id, + name = date.name, + sex = date.sex, + phone = date.phone, + photo = date.photo, + duties = date.duties, + identity = date.identity, + openId = date.wechatId, + usertype = date.usertype, + unitCode = date.unitCode, + token = tokenString + }; + #endregion + ret.IsSucceed = true; + } + else { - var datea = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.cardId == cardId).FirstAsync(); + var datea = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.cardId == cardId).FirstAsync(); if (datea == null) { var unitcode = _configuration.GetSection("CaseTwenty:UnitCode").Value; @@ -743,15 +741,15 @@ namespace _24Hour.Controllers ret.IsSucceed = true; ret.result = "ӳɹ"; } - } + } else { - ret.IsSucceed = false; - ret.Message = $"ûδȨ޷¼ϵԱ"; + ret.IsSucceed = false; + ret.Message = $"ûδȨ޷¼ϵԱ"; return ret; } - } - return ret; + } + return ret; } /// /// СAppID @@ -775,17 +773,17 @@ namespace _24Hour.Controllers /// [HttpGet("GetGzhOpenId")] public Task GetGzhOpenId(string code) => wechatMessagerClient.GetGzhOpenId(code); - } - - - public class UserLogin - { - [DataMember] - public string phone { get; set; } - /// - /// ¼ - /// - [DataMember] - public string Password { get; set; } - } + } + + + public class UserLogin + { + [DataMember] + public string phone { get; set; } + /// + /// ¼ + /// + [DataMember] + public string Password { get; set; } + } } \ No newline at end of file diff --git a/24Hour/Controllers/system/SystemControllerController.cs b/24Hour/Controllers/system/SystemControllerController.cs index fac2e69..c0b144c 100644 --- a/24Hour/Controllers/system/SystemControllerController.cs +++ b/24Hour/Controllers/system/SystemControllerController.cs @@ -695,74 +695,74 @@ namespace _24Hour.Controllers.system /// /// /// - [HttpGet] - [Route("EditDepartmentPhoto")] - public async Task EditDepartmentPhoto(string photo) - { - try - { - _db.BeginTran(); - var userlist = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.Id == _userdata.Id).ToListAsync(); - userlist.ForEach(q => - { - //头像地址 - q.departmentPhoto = photo; - }); - var num = await _db.Updateable(userlist).ExecuteCommandAsync(); - _db.CommitTran(); - if (num > 0) - { - result.IsSucceed = true; - result.result = "替换成功"; - } - } - catch (System.Exception ex) - { - _db.RollbackTran(); - result.IsSucceed = false; - result.Message = ex.Message; - LogService.WriteLog(ex, "用户部门证件替换"); - } - _logs.WriteSysLogadd("用户管理", "用户部门证件替换", result, _db); - return result; - } + //[HttpGet] + //[Route("EditDepartmentPhoto")] + //public async Task EditDepartmentPhoto(string photo) + //{ + // try + // { + // _db.BeginTran(); + // var userlist = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.Id == _userdata.Id).ToListAsync(); + // userlist.ForEach(q => + // { + // //头像地址 + // q.departmentPhoto = photo; + // }); + // var num = await _db.Updateable(userlist).ExecuteCommandAsync(); + // _db.CommitTran(); + // if (num > 0) + // { + // result.IsSucceed = true; + // result.result = "替换成功"; + // } + // } + // catch (System.Exception ex) + // { + // _db.RollbackTran(); + // result.IsSucceed = false; + // result.Message = ex.Message; + // LogService.WriteLog(ex, "用户部门证件替换"); + // } + // _logs.WriteSysLogadd("用户管理", "用户部门证件替换", result, _db); + // return result; + //} /// /// 根据律师id修改律师事务所证明图片 /// /// /// /// - [HttpPost] - [Route("EditLawyerDepartmentPhoto")] - public async Task EditLawyerDepartmentPhoto(EditLawyerInput input) - { - try - { - _db.BeginTran(); - var userlist = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.Id ==input.lawyerid).ToListAsync(); - userlist.ForEach(q => - { - //头像地址 - q.departmentPhoto = input.photo.ConvertToJsonStr(); - }); - var num = await _db.Updateable(userlist).ExecuteCommandAsync(); - _db.CommitTran(); - if (num > 0) - { - result.IsSucceed = true; - result.result = "替换成功"; - } - } - catch (System.Exception ex) - { - _db.RollbackTran(); - result.IsSucceed = false; - result.Message = ex.Message; - LogService.WriteLog(ex, "用户部门证件替换"); - } - _logs.WriteSysLogadd("用户管理", "用户部门证件替换", result, _db); - return result; - } + //[HttpPost] + //[Route("EditLawyerDepartmentPhoto")] + //public async Task EditLawyerDepartmentPhoto(EditLawyerInput input) + //{ + // try + // { + // _db.BeginTran(); + // var userlist = await _db.Queryable().Where(q => q.IsDeleted == 0 && q.Id ==input.lawyerid).ToListAsync(); + // userlist.ForEach(q => + // { + // //头像地址 + // q.departmentPhoto = input.photo.ConvertToJsonStr(); + // }); + // var num = await _db.Updateable(userlist).ExecuteCommandAsync(); + // _db.CommitTran(); + // if (num > 0) + // { + // result.IsSucceed = true; + // result.result = "替换成功"; + // } + // } + // catch (System.Exception ex) + // { + // _db.RollbackTran(); + // result.IsSucceed = false; + // result.Message = ex.Message; + // LogService.WriteLog(ex, "用户部门证件替换"); + // } + // _logs.WriteSysLogadd("用户管理", "用户部门证件替换", result, _db); + // return result; + //} public class EditLawyerInput { public string[] photo { get; set; } diff --git a/Elight.Entity/AppMode/App_LawyerServicesModel.cs b/Elight.Entity/AppMode/App_LawyerServicesModel.cs index 2bf1817..b6ade7f 100644 --- a/Elight.Entity/AppMode/App_LawyerServicesModel.cs +++ b/Elight.Entity/AppMode/App_LawyerServicesModel.cs @@ -165,7 +165,10 @@ namespace Elight.Entity /// [DataMember] public string? legalAidPhoto { get; set; } - + /// + /// 单位证明 律师事务所证明 + /// + public string? departmentPhoto { get; set; } /// /// 关系证明图片 /// diff --git a/Elight.Entity/SystemModel/App_Sys_UserModel.cs b/Elight.Entity/SystemModel/App_Sys_UserModel.cs index c5fd23d..8b81cd6 100644 --- a/Elight.Entity/SystemModel/App_Sys_UserModel.cs +++ b/Elight.Entity/SystemModel/App_Sys_UserModel.cs @@ -37,10 +37,6 @@ namespace Elight.Entity /// [DataMember] public string? departmentName { get; set; } - /// - /// 单位证明 律师事务所证明 - /// - public string? departmentPhoto { get; set; } /// /// 单位同意信用代码