From f8187896eeafc43457b81f4d08a1f0821bf51f1c Mon Sep 17 00:00:00 2001
From: zjh <2207896513@qq.com>
Date: 星期六, 26 四月 2025 16:32:54 +0800
Subject: [PATCH] 代码提交

---
 StandardPda/MESApplication/Controllers/Base/LoginController.cs |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 151 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..04794f5
--- /dev/null
+++ b/StandardPda/MESApplication/Controllers/Base/LoginController.cs
@@ -0,0 +1,151 @@
+锘縰sing Masuit.Tools;
+using Masuit.Tools.Database;
+using MES.Service.Dto.@base;
+using MES.Service.service;
+using MES.Service.util;
+using Microsoft.AspNetCore.Mvc;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Dynamic;
+using static MES.Service.service.QC.LljService;
+using Newtonsoft.Json;
+
+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);
+        }
+    }
+    public class Root
+    { 
+        public string version { get; set; }
+      
+        public string apkUrl { get; set; }
+    }
+
+    /// <summary>
+    ///    鑾峰彇App鏈�鏂扮増鏈俊鎭�
+    /// </summary>
+    /// <param name="data"></param>
+    /// <returns></returns>
+    [HttpPost("getAppUpgradeInfo")]
+    public async Task<ResponseResult> getAppUpgradeInfo()
+    {
+        
+        try
+        {  
+            HttpClient client = new();
+    var requestUrl = $"http://192.168.1.104:8081/UpgradeInformation.json";
+            var response = await client.GetAsync(requestUrl);
+            response.EnsureSuccessStatusCode(); // 妫�鏌TTP鐘舵�佺爜
+            var responseContent = await response.Content.ReadAsStringAsync();
+            var a= JsonConvert.DeserializeObject<Root>(responseContent);
+            return new ResponseResult
+            {
+                status = 0,
+                message = "OK",
+                data = a
+            };
+
+        }
+        catch (Exception ex)
+        {
+            return null;
+        }
+    }
+
+}
\ No newline at end of file

--
Gitblit v1.9.3