From 0cff826ea489a1faa5cbb320cad52d102530a9e0 Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期四, 13 三月 2025 10:53:42 +0800
Subject: [PATCH] 代码提交

---
 StandardPda/MESApplication/Controllers/Base/LoginController.cs |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/StandardPda/MESApplication/Controllers/Base/LoginController.cs b/StandardPda/MESApplication/Controllers/Base/LoginController.cs
new file mode 100644
index 0000000..aede14c
--- /dev/null
+++ b/StandardPda/MESApplication/Controllers/Base/LoginController.cs
@@ -0,0 +1,108 @@
+锘縰sing System.Dynamic;
+using MES.Service.Dto.@base;
+using MES.Service.service;
+using MES.Service.util;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json.Linq;
+
+namespace MESApplication.Controllers.Base;
+
+/// <summary>
+///     鐢ㄦ埛
+/// </summary>
+[Route("api/[controller]")]
+[ApiController]
+public class LoginController : ControllerBase
+{
+    /// <summary>
+    ///     鐧诲綍
+    /// </summary>
+    /// <param name="model"></param>
+    /// <returns></returns>
+    [HttpPost("login")]
+    public ResponseResult login([FromBody] LoginModel model)
+    {
+        //鐧诲綍
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new LoginService().login(model.userID, model.userPass);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     閲嶈瀵嗙爜
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("resetPassword")]
+    public ResponseResult resetPassword([FromBody] JObject data)
+    {
+        var name = data["name"].ToString();
+        var pwd = data["pwd"].ToString();
+        var newPwd = data["newPwd"].ToString();
+        //鐧诲綍
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList =
+                new LoginService().resetPassword(newPwd, name, pwd);
+            if (tbBillList > 0)
+                return new ResponseResult
+                {
+                    status = 0,
+                    message = "淇敼鎴愬姛",
+                    data = resultInfos
+                };
+            return new ResponseResult
+            {
+                status = 1,
+                message = "淇敼澶辫触",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+
+    /// <summary>
+    ///     鐢ㄦ埛鑿滃崟
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("getUserMenu")]
+    public ResponseResult getUserMenu([FromBody] JObject data)
+    {
+        var name = data["name"].ToString();
+        try
+        {
+            dynamic resultInfos = new ExpandoObject();
+            var tbBillList = new LoginService().getUserMenu(name);
+            resultInfos.tbBillList = tbBillList;
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = resultInfos
+            };
+        }
+        catch (Exception ex)
+        {
+            return ResponseResult.ResponseError(ex);
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3