From f4e84a98facb28bbfc63343c81095a9787812e27 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期六, 30 八月 2025 16:25:51 +0800 Subject: [PATCH] 1.PDA分组织 --- service/base/LoginService.cs | 47 +++++++++++++++++++++++++++++++++++++---------- 1 files changed, 37 insertions(+), 10 deletions(-) diff --git a/service/base/LoginService.cs b/service/base/LoginService.cs index c483032..e3e9081 100644 --- a/service/base/LoginService.cs +++ b/service/base/LoginService.cs @@ -2,24 +2,49 @@ using NewPdaSqlServer.DB; using NewPdaSqlServer.entity; using NewPdaSqlServer.util; +using SqlSugar; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory; namespace NewPdaSqlServer.service.@base; public class LoginService : RepositoryNoEntity { - public SysUser login(string name, string pwd) + public dynamic login(string name, string pwd) { + var strPass = UtilityHelper.MD5Encrypt32(pwd); - var sysUser = Db.Queryable<SysUser>() - .Where(s => s.Account == name - && s.Password == strPass).First(); + //var sysUser = Db.Queryable<SysUser>() + // .Where(s => s.Account == name + // && s.Password == strPass).First(); - if (sysUser == null) throw new Exception("鐢ㄦ埛涓嶅瓨鍦�"); - var db_password = sysUser.Password; - if (!strPass.Equals(db_password)) throw new Exception("鐢ㄦ埛鍚嶆垨鑰呭瘑鐮侀敊璇�"); - return sysUser; + + var parameters = new[] + { + new SugarParameter("@pi_account", name), + new SugarParameter("@pi_password", strPass), + new SugarParameter("@inP1", null), + new SugarParameter("@inP2", null), + new SugarParameter("@inP3", null) + }; + + try + { + var sysUser = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_login_selUserOrgInfo @pi_account,@pi_password,@inP1,@inP2,@inP3", parameters).First(); + + if (sysUser == null) throw new Exception("鐢ㄦ埛涓嶅瓨鍦�"); + + var db_password = sysUser.Password; + if (!strPass.Equals(db_password)) throw new Exception("鐢ㄦ埛鍚嶆垨鑰呭瘑鐮侀敊璇�"); + return sysUser; + } + catch (Exception ex) + { + // 淇濈暀鍘熸湁寮傚父澶勭悊閫昏緫 + throw new Exception($"{ex.Message}"); + } + } public List<dynamic> getUserMenu(string name) @@ -35,7 +60,7 @@ else { string sql = string.Format(@"SELECT A.* FROM MES_SYS_PAGEVIEW A - LEFT JOIN SYS_USER_BIND B ON A.guid = B.aboutGuid + LEFT JOIN SYS_USER_BIND B ON CAST(A.guid AS VARCHAR(100)) = B.aboutGuid LEFT JOIN SYS_USER C ON C.GUID = B.userGuid WHERE C.ACCOUNT = '{0}'", name); pageViewList = Db.Ado.SqlQuery<MesSysPageview>(sql); @@ -65,7 +90,9 @@ foreach (var pageView in group) { var mesFile = Db.Queryable<MesFile>() - .Where(s => s.ParentGuid == pageView.Guid).First(); + .Where(s => s.ParentGuid == pageView.Guid) + .OrderByDescending(s => s.CreateDate) + .First(); var icoimg = ""; if (mesFile != null) -- Gitblit v1.9.3