From 6c8e038aad394c1e91c8c046d3de25dc8e84ecbe Mon Sep 17 00:00:00 2001 From: lg <999544862qq.com> Date: 星期日, 01 九月 2024 09:31:27 +0800 Subject: [PATCH] 优化 --- DevApp/Gs.DevApp/DevFrm/FrmMain.cs | 11 + WebApi/.vs/ProjectEvaluation/gsmessolution.metadata.v8.bin | 0 DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs | 21 +++ WebApi/Gs.User/Service/UserController.cs | 2 DevApp/Gs.DevApp/Gs.DevApp.csproj | 1 WebApi/.vs/ProjectEvaluation/gsmessolution.strings.v8.bin | 0 WebApi/.vs/GsMesSolution/DesignTimeBuild/.dtbcache.v2 | 0 DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.resx | 120 +++++++++++++++++ DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs | 38 ++++- DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs | 20 +- WebApi/.vs/GsMesSolution/v17/DocumentLayout.json | 41 ----- WebApi/Gs.Toolbox/UtilityHelper.cs | 33 ++++ WebApi/.vs/GsMesSolution/v17/.futdcache.v2 | 0 WebApi/Gs.HostIIS/Program.cs | 1 WebApi/.vs/ProjectEvaluation/gsmessolution.projects.v8.bin | 0 DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs | 7 DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.Designer.cs | 47 ++++++ DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.Designer.cs | 5 WebApi/Gs.User/Service/MenuActionController.cs | 14 + 19 files changed, 292 insertions(+), 69 deletions(-) diff --git a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs index 270fdae..c71d77b 100644 --- a/DevApp/Gs.DevApp/DevFrm/FrmMain.cs +++ b/DevApp/Gs.DevApp/DevFrm/FrmMain.cs @@ -29,10 +29,12 @@ { int i = 100; Gs.DevApp.UserControl.ShowDialogForm sdf = new Gs.DevApp.UserControl.ShowDialogForm("鎻愮ず", "", "璇疯�愬績绛夊�欙紝姝e湪鎿嶄綔涓紒"); - for (int j = 0; j < i; j++) { - sdf.SetCaption("鎵ц杩涘害锛�" + (j) + "/" +i.ToString() + "锛�"); + for (int j = 0; j < i; j++) + { + sdf.SetCaption("鎵ц杩涘害锛�" + (j) + "/" + i.ToString() + "锛�"); } - sdf.Close(); + sdf.Close(); + getTree(); } private void Tab_CloseButtonClick(object sender, EventArgs e) @@ -54,6 +56,7 @@ strJson = UtilityHelper.HttpPost("", "User/GetUserLoginInfo", JsonConvert.SerializeObject(_obj)); JObject _job = JObject.Parse(strJson); string rtnCode = _job["rtnCode"].ToString(); + this.acrd.Clear(); string rtnMsg = _job["rtnMsg"].ToString(); barMsg.Caption = rtnMsg; JArray array = new JArray(); @@ -88,7 +91,7 @@ _itm.Click += _grp_Click; _grp.Elements.Add(_itm); // - if (idx == 0) + if (idx == 0 && tab.TabPages.Count <= 0) { string tabPageName = _itm.Name + "_page"; string tabText = _itm.Text;//褰撳墠閫夐」鍗¢〉Text鏍囬 diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.Designer.cs b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.Designer.cs new file mode 100644 index 0000000..aa61b63 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.Designer.cs @@ -0,0 +1,47 @@ +锘� +namespace Gs.DevApp.DevFrm.Sys +{ + partial class DocNoRule + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.SuspendLayout(); + // + // DocNoRule + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(657, 342); + this.Name = "DocNoRule"; + this.Text = "DocNoRule"; + this.ResumeLayout(false); + + } + + #endregion + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs new file mode 100644 index 0000000..3e45ef2 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.cs @@ -0,0 +1,21 @@ +锘縰sing DevExpress.XtraEditors; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace Gs.DevApp.DevFrm.Sys +{ + public partial class DocNoRule : DevExpress.XtraEditors.XtraForm + { + public DocNoRule() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.resx b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DevApp/Gs.DevApp/DevFrm/Sys/DocNoRule.resx @@ -0,0 +1,120 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file diff --git a/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs b/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs index c46e12a..94d72a9 100644 --- a/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs +++ b/DevApp/Gs.DevApp/DevFrm/User/SysMenu.cs @@ -17,7 +17,6 @@ this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick; this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick; this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick; - } private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e) @@ -70,9 +69,13 @@ private void ToolBarMenu1_btnAddClick(object sender, EventArgs e) { SysMenuAdd frm = new SysMenuAdd(""); + frm.UpdateParent += Frm_UpdateParent; frm.ShowDialog(); } - + private void Frm_UpdateParent(object sender, UpdateParentEventArgs e) + { + getTree(); + } private void getTree() { Models.PageQueryModel pgq = new Models.PageQueryModel(1, 999999, "idx", "asc", "", ""); diff --git a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.Designer.cs b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.Designer.cs index 405dc32..7ab4cbe 100644 --- a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.Designer.cs +++ b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.Designer.cs @@ -99,6 +99,11 @@ this.txtIdx.Name = "txtIdx"; this.txtIdx.Size = new System.Drawing.Size(120, 26); this.txtIdx.TabIndex = 113; + this.txtIdx.Value = new decimal(new int[] { + 2, + 0, + 0, + 0}); // // labelControl1 // diff --git a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs index 21495ff..e9effcb 100644 --- a/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs +++ b/DevApp/Gs.DevApp/DevFrm/User/SysMenuAdd.cs @@ -9,6 +9,8 @@ { public partial class SysMenuAdd : DevExpress.XtraEditors.XtraForm { + public event EventHandler<UpdateParentEventArgs> UpdateParent; + public SysMenuAdd(string guid) { InitializeComponent(); @@ -42,19 +44,19 @@ private void BtnSave_Click(object sender, EventArgs e) { + if (string.IsNullOrEmpty(txtMenuType.Text.Trim()) || txtMenuType.SelectedIndex == 0) + { + Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟绫诲瀷涓嶈兘涓虹┖锛�"); + txtMenuType.Focus(); + return; + } if (string.IsNullOrEmpty(txtMenuName.Text.Trim())) { Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鍚嶇О涓嶈兘涓虹┖锛�"); txtMenuName.Focus(); return; } - if (string.IsNullOrEmpty(txtMenuType.Text.Trim())) - { - Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟绫诲瀷涓嶈兘涓虹┖锛�"); - txtMenuType.Focus(); - return; - } - if (string.IsNullOrEmpty(txtStatus.Text.Trim())) + if (string.IsNullOrEmpty(txtStatus.Text.Trim()) || txtStatus.SelectedIndex == 0) { Gs.DevApp.ToolBox.MsgHelper.Warning("鑿滃崟鐘舵�佷笉鑳戒负绌猴紒"); txtStatus.Focus(); @@ -83,7 +85,10 @@ strJson = UtilityHelper.HttpPost("", "MenuAction/EditModel", JsonConvert.SerializeObject(_obj)); ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.GetDataByJson(strJson); ToolBox.MsgHelper.Warning("鎻愮ず锛�" + _rtn.rtnMsg); - if (_rtn.rtnCode > 0) { getTree(); } + if (_rtn.rtnCode > 0) + { + UpdateParent?.Invoke(this, new UpdateParentEventArgs { Data = "" }); + } } catch (Exception ex) { @@ -143,5 +148,22 @@ ToolBox.MsgHelper.Warning("鎻愮ず锛�" + ex.Message); } } + + private void cleanTxt() + { + //guid = lbGuid.Text.Trim(),//涓诲缓 + // upGuid = _upGuid,//涓婄骇鐨勪富寤� + // name = txtMenuName.Text.Trim(),//鍚嶇О + // icon = txtMenuIco.Text,//鑿滃崟鍥炬爣 + // status = txtStatus.SelectedIndex,//鐘舵�� + // formPath = txtFormNamespace.Text.Trim(),//绐椾綋璺緞 + // idx = int.Parse(txtIdx.Value.ToString()),//鎺掑簭 + // category = txtMenuType.SelectedIndex,//绫诲瀷 + + //if(lbGuid.Text) + } + + + } } \ No newline at end of file diff --git a/DevApp/Gs.DevApp/Gs.DevApp.csproj b/DevApp/Gs.DevApp/Gs.DevApp.csproj index 4f0a4db..83b7f0b 100644 --- a/DevApp/Gs.DevApp/Gs.DevApp.csproj +++ b/DevApp/Gs.DevApp/Gs.DevApp.csproj @@ -136,6 +136,7 @@ </Compile> <Compile Include="ToolBox\LogHelper.cs" /> <Compile Include="ToolBox\MsgHelper.cs" /> + <Compile Include="ToolBox\UpdateParentEventArgs.cs" /> <Compile Include="ToolBox\UtilityHelper.cs" /> <Compile Include="UserControl\PageBar.cs"> <SubType>UserControl</SubType> diff --git a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs index 3c91c68..2b078be 100644 --- a/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs +++ b/DevApp/Gs.DevApp/ToolBox/UtilityHelper.cs @@ -98,12 +98,14 @@ return image2; } /// <summary> - /// 璇诲彇token + /// 鐢熸垚token /// </summary> /// <returns></returns> public static string GetBasicAuthTicket() { - string token = Guid.NewGuid().ToString(); + string userGuid = string.IsNullOrEmpty(LoginInfoModel.CurrentUser.LoginUserGuid) ? Guid.NewGuid().ToString() : LoginInfoModel.CurrentUser.LoginUserGuid; + string orgGuid = string.IsNullOrEmpty(LoginInfoModel.CurrentUser.LoginOrgGuid) ? Guid.NewGuid().ToString() : LoginInfoModel.CurrentUser.LoginOrgGuid; + string token = (userGuid + "~" + orgGuid); return token; } /// <summary> @@ -115,7 +117,7 @@ { ReturnModel<PageListModel> rto = new ReturnModel<PageListModel>(); JObject json = JObject.Parse(strReturn); - rto.rtnCode =int.Parse( json["rtnCode"].ToString()); + rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = new PageListModel(); rto.rtnData.pages = int.Parse(json["rtnData"]["pages"].ToString()); @@ -131,10 +133,6 @@ rto.rtnData.list = dt; return rto; } - - - - /// <summary> /// 鏍囧噯json涓茶繑鍥濺eturnModel->瀛楃涓诧紝 /// </summary> @@ -144,17 +142,17 @@ { ReturnModel<dynamic> rto = new ReturnModel<dynamic>(); JObject json = JObject.Parse(strReturn); - rto.rtnCode =int.Parse( json["rtnCode"].ToString()); + rto.rtnCode = int.Parse(json["rtnCode"].ToString()); rto.rtnMsg = json["rtnMsg"].ToString(); rto.rtnData = json["rtnData"]; return rto; } - /// <summary> /// 璁剧疆绯荤粺瀛椾綋澶у皬锛岀洰鍓嶅苟涓嶉�氱敤 /// </summary> - public static float GetFontSize =10; - public static void SetFont(Control control) { + public static float GetFontSize = 10; + public static void SetFont(Control control) + { float size = GetFontSize; foreach (Control childControl in control.Controls) { diff --git a/WebApi/.vs/GsMesSolution/DesignTimeBuild/.dtbcache.v2 b/WebApi/.vs/GsMesSolution/DesignTimeBuild/.dtbcache.v2 index 3b30e0e..8e753a7 100644 --- a/WebApi/.vs/GsMesSolution/DesignTimeBuild/.dtbcache.v2 +++ b/WebApi/.vs/GsMesSolution/DesignTimeBuild/.dtbcache.v2 Binary files differ diff --git a/WebApi/.vs/GsMesSolution/v17/.futdcache.v2 b/WebApi/.vs/GsMesSolution/v17/.futdcache.v2 index ae7a62d..c9dd098 100644 --- a/WebApi/.vs/GsMesSolution/v17/.futdcache.v2 +++ b/WebApi/.vs/GsMesSolution/v17/.futdcache.v2 Binary files differ diff --git a/WebApi/.vs/GsMesSolution/v17/DocumentLayout.json b/WebApi/.vs/GsMesSolution/v17/DocumentLayout.json index 93e5d24..d1bdd3d 100644 --- a/WebApi/.vs/GsMesSolution/v17/DocumentLayout.json +++ b/WebApi/.vs/GsMesSolution/v17/DocumentLayout.json @@ -1,49 +1,12 @@ { "Version": 1, "WorkspaceRootPath": "D:\\GsMesV2\\WebApi\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{C77F6A1D-0CEA-40DE-9B03-C59B581531E8}|Gs.User\\Gs.User.csproj|d:\\gsmesv2\\webapi\\gs.user\\service\\organizationcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{C77F6A1D-0CEA-40DE-9B03-C59B581531E8}|Gs.User\\Gs.User.csproj|solutionrelative:gs.user\\service\\organizationcontroller.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - } - ], + "Documents": [], "DocumentGroupContainers": [ { "Orientation": 0, "VerticalTabListWidth": 256, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 3, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" - }, - { - "$type": "Bookmark", - "Name": "ST:129:0:{116d2292-e37d-41cd-a077-ebacac4c8cc4}" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "OrganizationController.cs", - "DocumentMoniker": "D:\\GsMesV2\\WebApi\\Gs.User\\Service\\OrganizationController.cs", - "RelativeDocumentMoniker": "Gs.User\\Service\\OrganizationController.cs", - "ToolTip": "D:\\GsMesV2\\WebApi\\Gs.User\\Service\\OrganizationController.cs", - "RelativeToolTip": "Gs.User\\Service\\OrganizationController.cs", - "ViewState": "AQIAABcAAAAAAAAAAAAYwB0AAAArAAAA", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2024-08-28T00:45:55.543Z", - "EditorCaption": "" - } - ] - } - ] + "DocumentGroups": [] } ] } \ No newline at end of file diff --git a/WebApi/.vs/ProjectEvaluation/gsmessolution.metadata.v8.bin b/WebApi/.vs/ProjectEvaluation/gsmessolution.metadata.v8.bin index 4795a59..6d8531c 100644 --- a/WebApi/.vs/ProjectEvaluation/gsmessolution.metadata.v8.bin +++ b/WebApi/.vs/ProjectEvaluation/gsmessolution.metadata.v8.bin Binary files differ diff --git a/WebApi/.vs/ProjectEvaluation/gsmessolution.projects.v8.bin b/WebApi/.vs/ProjectEvaluation/gsmessolution.projects.v8.bin index fb015b9..b76d66d 100644 --- a/WebApi/.vs/ProjectEvaluation/gsmessolution.projects.v8.bin +++ b/WebApi/.vs/ProjectEvaluation/gsmessolution.projects.v8.bin Binary files differ diff --git a/WebApi/.vs/ProjectEvaluation/gsmessolution.strings.v8.bin b/WebApi/.vs/ProjectEvaluation/gsmessolution.strings.v8.bin index f42330b..060c7a6 100644 --- a/WebApi/.vs/ProjectEvaluation/gsmessolution.strings.v8.bin +++ b/WebApi/.vs/ProjectEvaluation/gsmessolution.strings.v8.bin Binary files differ diff --git a/WebApi/Gs.HostIIS/Program.cs b/WebApi/Gs.HostIIS/Program.cs index 102eea5..b47c391 100644 --- a/WebApi/Gs.HostIIS/Program.cs +++ b/WebApi/Gs.HostIIS/Program.cs @@ -23,6 +23,7 @@ builder.Services.AddCustomConvention(); builder.AddCustomInject(); builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddHttpContextAccessor(); builder.Services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "GS-MES Api开发文档", Version = "v1" }); diff --git a/WebApi/Gs.Toolbox/UtilityHelper.cs b/WebApi/Gs.Toolbox/UtilityHelper.cs index a0198de..e7b2271 100644 --- a/WebApi/Gs.Toolbox/UtilityHelper.cs +++ b/WebApi/Gs.Toolbox/UtilityHelper.cs @@ -1,17 +1,46 @@ -锘縰sing System; +锘縰sing Microsoft.AspNetCore.Http; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using static System.Net.WebRequestMethods; namespace Gs.Toolbox { public static class UtilityHelper { - public static Guid? GetGuid(string? str) { + /// <summary> + /// string 杞琯uid + /// </summary> + /// <param name="str"></param> + /// <returns></returns> + public static Guid? GetGuid(string? str) + { if (string.IsNullOrEmpty(str)) return null; return Guid.Parse(str); } + /// <summary> + /// 璇诲彇userGuid,orgGuid + /// </summary> + /// <param name="_http"></param> + /// <returns></returns> + public static (string?, string?) GetUserGuidAndOrgGuid(IHttpContextAccessor _http) + { + try + { + string _token = _http.HttpContext.Request.Headers["token"]; + string[] _ary = _token.Split("~"); + return (_ary[0], _ary[1]); + } + catch (Exception ex) + { + Gs.Toolbox.LogHelper.Debug("GetUserGuidAndOrgGuid:", ex.Message); + return (null, null); + } + + } } } diff --git a/WebApi/Gs.User/Service/MenuActionController.cs b/WebApi/Gs.User/Service/MenuActionController.cs index 035b1e4..7318af5 100644 --- a/WebApi/Gs.User/Service/MenuActionController.cs +++ b/WebApi/Gs.User/Service/MenuActionController.cs @@ -10,13 +10,19 @@ using System.Threading.Tasks; using Gs.User.Modes; using Microsoft.Extensions.Primitives; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Http.Connections.Features; namespace Gs.User.Service { [ApiGroup(ApiGroupNames.Auth)] public class MenuActionController : IRomteService { - + private readonly IHttpContextAccessor _http; + public MenuActionController(IHttpContextAccessor httpContextAccessor) + { + _http = httpContextAccessor; + } /// <summary> /// 璇诲彇鍔熻兘鑿滃崟鍒楄〃锛屾敮鎸佸垎椤� /// </summary> @@ -25,6 +31,8 @@ [RequestMethod(RequestMethods.POST)] public ReturnDto<PageList<MenuAction>> GetListPage([FromBody] PageQuery model) { + (string userGuid, string orgGuid) = Gs.Toolbox.UtilityHelper.GetUserGuidAndOrgGuid(_http); + Gs.Toolbox.LogHelper.Debug(this.ToString(), "userGuid:" + userGuid + "锛宱rgGuid:" + orgGuid); int currentPage = model.currentPage; int everyPageSize = model.everyPageSize; string sortName = string.IsNullOrEmpty(model.sortName) ? "a.idx" : model.sortName; @@ -234,9 +242,9 @@ { if (sbSql.Length > 0) sbSql.Append(" union all"); - sbSql.Append(" select org.guid,null as upGuid,org.name,org.status,'"+ row["guid"].ToString() + "' as orgGuid from [dbo].[sys_Organization] org where org.guid ='" + row["guid"].ToString() + "'"); + sbSql.Append(" select org.guid,null as upGuid,org.name,org.status,'" + row["guid"].ToString() + "' as orgGuid from [dbo].[sys_Organization] org where org.guid ='" + row["guid"].ToString() + "'"); sbSql.Append(" union all"); - sbSql.Append(" select ma.guid,isnull(ma.upGuid,'" + row["guid"].ToString() + "') as upGuid,ma.name,ma.status,'"+ row["guid"].ToString() + "' as orgGuid from sys_MenuAction ma"); + sbSql.Append(" select ma.guid,isnull(ma.upGuid,'" + row["guid"].ToString() + "') as upGuid,ma.name,ma.status,'" + row["guid"].ToString() + "' as orgGuid from sys_MenuAction ma"); } } catch (Exception ex) diff --git a/WebApi/Gs.User/Service/UserController.cs b/WebApi/Gs.User/Service/UserController.cs index bb6b364..9ef7e53 100644 --- a/WebApi/Gs.User/Service/UserController.cs +++ b/WebApi/Gs.User/Service/UserController.cs @@ -84,6 +84,7 @@ public ReturnDto<System.Dynamic.ExpandoObject> GetUserLoginInfo([FromBody] UserLogin model) { Guid userGuid = model.userGuid; + Guid orgGuid= model.orgGuid; DataSet dset = new DataSet(); dynamic m = new System.Dynamic.ExpandoObject(); using (SqlConnection conn = new SqlConnection(DbHelperSQL.strConn)) @@ -96,6 +97,7 @@ cmd.CommandType = CommandType.StoredProcedure; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@userGuid",userGuid), + new SqlParameter("@orgGuid",orgGuid), }; foreach (SqlParameter parameter in parameters) { -- Gitblit v1.9.3