初始化
This commit is contained in:
13
WebAPIServer/.config/dotnet-tools.json
Normal file
13
WebAPIServer/.config/dotnet-tools.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "9.0.3",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
13
WebAPIServer/Common/MyMemoryCache.cs
Normal file
13
WebAPIServer/Common/MyMemoryCache.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace WebAPIServer.Common
|
||||
{
|
||||
public class MyMemoryCache
|
||||
{
|
||||
public MemoryCache Cache { get; } = new MemoryCache(
|
||||
new MemoryCacheOptions
|
||||
{
|
||||
SizeLimit = 4096
|
||||
});
|
||||
}
|
||||
}
|
||||
16
WebAPIServer/Common/StaticData.cs
Normal file
16
WebAPIServer/Common/StaticData.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.Scripting.Hosting;
|
||||
|
||||
namespace WebAPIServer.Common
|
||||
{
|
||||
public class StaticData
|
||||
{
|
||||
public static ScriptEngine eng = Python.CreateEngine();
|
||||
public static ScriptScope scope = eng.CreateScope();
|
||||
|
||||
public static void GetWebAPIMethod()
|
||||
{
|
||||
eng.ExecuteFile("ScriptConfig\\webapi.py", scope);
|
||||
}
|
||||
}
|
||||
}
|
||||
48
WebAPIServer/Controllers/CompanyController.cs
Normal file
48
WebAPIServer/Controllers/CompanyController.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Models;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class CompanyController : ControllerBase
|
||||
{
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetCompanyInfo([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q=new UtsManageContext())
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = q.TblUtsManageCompanies.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var a = q.TblUtsManageUsers.SingleOrDefault(A => A.Id == S.ID);
|
||||
if (a != null)
|
||||
{
|
||||
returnInfo.response = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
275
WebAPIServer/Controllers/DataHandleController.cs
Normal file
275
WebAPIServer/Controllers/DataHandleController.cs
Normal file
@@ -0,0 +1,275 @@
|
||||
using ClosedXML.Excel;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using MySqlConnector;
|
||||
using NLog;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Common;
|
||||
using WebAPIServer.Models;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class DataHandleController : ControllerBase
|
||||
{
|
||||
|
||||
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
public readonly IMemoryCache _memoryCache;
|
||||
|
||||
public DataHandleController(IMemoryCache memoryCache)
|
||||
{
|
||||
this._memoryCache = memoryCache;
|
||||
}
|
||||
[HttpPost()]
|
||||
public string NNN()
|
||||
{
|
||||
return "hello";
|
||||
}
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo R_InfoCommon([FromBody] PageQueryData S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
List<Dictionary<string, object>> list = new List<Dictionary<string, object>>();
|
||||
|
||||
string KKK = "";
|
||||
if (S.DBQueryData.Count > 0)
|
||||
{
|
||||
KKK = string.Join('_', S.DBQueryData);
|
||||
}
|
||||
string NK = S.Key + S.CmdType??"" + KKK;
|
||||
var ooo = _memoryCache.Get<List<Dictionary<string, object>>>(NK);
|
||||
if (ooo != null)
|
||||
{
|
||||
list = ooo;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
using IDbConnection conn = q.Database.GetDbConnection();
|
||||
|
||||
if (conn.State != ConnectionState.Open)
|
||||
{
|
||||
conn.Open();
|
||||
}
|
||||
IDbCommand cmd = conn.CreateCommand();
|
||||
string VariableName = S.Key;
|
||||
string result = "";
|
||||
if (S.isFunction)
|
||||
{
|
||||
if (S.FunParameters.Count == 1)
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters[0]);
|
||||
}
|
||||
if (S.FunParameters.Count == 2)
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters[0], S.FunParameters[1]);
|
||||
}
|
||||
if (S.FunParameters.Count == 3)
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters[0], S.FunParameters[1], S.FunParameters[2]);
|
||||
}
|
||||
if (S.FunParameters.Count == 4)
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters[0], S.FunParameters[1], S.FunParameters[2], S.FunParameters[3]);
|
||||
}
|
||||
if (S.FunParameters.Count == 5)
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters[0], S.FunParameters[1], S.FunParameters[2], S.FunParameters[3], S.FunParameters[4]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName);
|
||||
}
|
||||
var Q = S.DBQueryData;
|
||||
if (S.CmdType.Equals("sys"))
|
||||
{
|
||||
foreach (var item in Q)
|
||||
{
|
||||
result = result.Replace(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (QueryString item in Q)
|
||||
{
|
||||
if (item.ValueType.Equals("string"))
|
||||
{
|
||||
MySqlParameter mmm = new MySqlParameter(item.Key, item.Value);
|
||||
cmd.Parameters.Add(mmm);
|
||||
}
|
||||
else if (item.ValueType.Equals("number"))
|
||||
{
|
||||
decimal a = 0;
|
||||
decimal.TryParse(item.Value, out a);
|
||||
MySqlParameter mmm = new MySqlParameter(item.Key, a);
|
||||
cmd.Parameters.Add(mmm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd.CommandText = result;
|
||||
|
||||
|
||||
cmd.CommandType = CommandType.Text;
|
||||
|
||||
MySqlCommand command = cmd as MySqlCommand;
|
||||
MySqlDataAdapter adapter = new MySqlDataAdapter(command);
|
||||
DataSet ds = new DataSet();
|
||||
adapter.Fill(ds);
|
||||
|
||||
DataTable dt = ds.Tables[0];
|
||||
|
||||
//string str= System.Text.Json.JsonSerializer.Serialize(dt);
|
||||
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
Dictionary<string, object> dic = new Dictionary<string, object>();
|
||||
foreach (DataColumn item1 in dt.Columns)
|
||||
{
|
||||
string CName = item1.ColumnName;
|
||||
dic.Add(CName, item[CName]);
|
||||
}
|
||||
list.Add(dic);
|
||||
}
|
||||
}
|
||||
}
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = list;
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo CUD_InfoCommon([FromBody] PageQueryData S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
using IDbConnection conn = q.Database.GetDbConnection();
|
||||
|
||||
if (conn.State != ConnectionState.Open)
|
||||
{
|
||||
conn.Open();
|
||||
}
|
||||
IDbCommand cmd = conn.CreateCommand();
|
||||
string VariableName = S.Key;
|
||||
string result = "";
|
||||
if (S.isFunction)
|
||||
{
|
||||
var LG = S.FunParameters;
|
||||
result = StaticData.scope.GetVariable(VariableName)(S.FunParameters);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = StaticData.scope.GetVariable(VariableName);
|
||||
}
|
||||
var Q = S.DBQueryData;
|
||||
if (S.CmdType.Equals("sys"))
|
||||
{
|
||||
foreach (var item in Q)
|
||||
{
|
||||
result = result.Replace(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (QueryString item in Q)
|
||||
{
|
||||
if (item.ValueType.Equals("string"))
|
||||
{
|
||||
MySqlParameter mmm = new MySqlParameter(item.Key, item.Value);
|
||||
cmd.Parameters.Add(mmm);
|
||||
}
|
||||
else if (item.ValueType.Equals("number"))
|
||||
{
|
||||
decimal a = 0;
|
||||
decimal.TryParse(item.Value, out a);
|
||||
MySqlParameter mmm = new MySqlParameter(item.Key, a);
|
||||
cmd.Parameters.Add(mmm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cmd.CommandText = result;
|
||||
cmd.CommandType = CommandType.Text;
|
||||
|
||||
object ooo = cmd.ExecuteNonQuery();
|
||||
returnInfo.response = ooo;
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
public ReturnInfo III([FromBody] PageQueryData S)
|
||||
{
|
||||
var NNN = S.FunParameters;
|
||||
var result = StaticData.scope.GetVariable("a")(NNN);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public record PageQueryData
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public bool isFunction { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 参数,最多直接5个参数
|
||||
/// </summary>
|
||||
public List<string>? FunParameters { get; set; }
|
||||
//sys
|
||||
//customer
|
||||
public string? CmdType { get; set; }
|
||||
public List<QueryString>? DBQueryData { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class FunParameter
|
||||
{
|
||||
public string PKey { get; set; }
|
||||
public string PValue { get; set; }
|
||||
}
|
||||
public record QueryString
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public string ValueType { get; set; }
|
||||
}
|
||||
}
|
||||
395
WebAPIServer/Controllers/LoginController.cs
Normal file
395
WebAPIServer/Controllers/LoginController.cs
Normal file
@@ -0,0 +1,395 @@
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using System.Security.Claims;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.IdentityModel.Logging;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Text;
|
||||
using ViewModels;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ViewModels.RequestData;
|
||||
using ViewModels.ResponseData;
|
||||
using WebAPIServer.Extensions;
|
||||
using WebAPIServer.Models;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using UAParser;
|
||||
using UAParser.Objects;
|
||||
using NLog;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class LoginController : ControllerBase
|
||||
{
|
||||
|
||||
|
||||
public IConfiguration? configuration { get; set; }
|
||||
public LoginController(IConfiguration _configuration)
|
||||
{
|
||||
configuration = _configuration;
|
||||
}
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public ReturnInfo TokenXuQi()
|
||||
{
|
||||
ReturnInfo r = new ReturnInfo();
|
||||
r.isok = false;
|
||||
try
|
||||
{
|
||||
var claims = HttpContext.AuthenticateAsync().Result?.Principal?.Claims;
|
||||
if (claims != null && claims.Any())
|
||||
{
|
||||
var Name = claims.SingleOrDefault(A => A.Type == ClaimTypes.Name)?.Value;
|
||||
var UUU = claims.SingleOrDefault(A => A.Type == ClaimTypes.Role)?.Value;
|
||||
var TTT = claims.SingleOrDefault(A => A.Type == ClaimTypes.NameIdentifier)?.Value;
|
||||
|
||||
TblUtsManageUser? HH = new TblUtsManageUser();
|
||||
int a = 0;
|
||||
int.TryParse(TTT, out a);
|
||||
HH.Id = a;
|
||||
bool bl = false;
|
||||
bool.TryParse(UUU, out bl);
|
||||
HH.IsAdmin = bl;
|
||||
HH.UserName = Name;
|
||||
string TokenStr = GetToken(HH);
|
||||
r.isok = true;
|
||||
r.response = TokenStr;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
r.isok = false;
|
||||
r.message = ex.Message;
|
||||
}
|
||||
return r;
|
||||
|
||||
//var identity = HttpContext.User.Identity as ClaimsIdentity;
|
||||
//if (identity != null)
|
||||
//{
|
||||
// var userClaims = identity.Claims;
|
||||
//}
|
||||
//return "hello world";
|
||||
}
|
||||
|
||||
|
||||
[HttpGet()] // 例如,一个获取验证码的API端点
|
||||
public IActionResult GetCaptcha()
|
||||
{
|
||||
string captchaText; // 这里使用上面任一版本的GenerateCaptchaImage方法生成的文本。例如:captchaText = CaptchaHelperSkiaSharp.GenerateCaptchaImage(out captchaText); 或 captchaText = CaptchaHelper.GenerateCaptchaImage(out captchaText); 根据你的选择。
|
||||
byte[] imageBytes = CaptchaHelperSkiaSharp.GenerateCaptchaImage(); // 或者使用System.Drawing的方法。确保你选择了
|
||||
return Ok(new { CaptchaText = "1111", Image = Convert.ToBase64String(imageBytes) });
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="username">用户名</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ReturnInfo Login([FromBody] LoginData data)
|
||||
{
|
||||
|
||||
ReturnInfo res = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
string password = data.password;
|
||||
string username = data.username;
|
||||
TblUtsManageUser? entity = null;
|
||||
string TokenString = "";
|
||||
string pwd = password.ToMD5().ToMD5();
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
entity = q.TblUtsManageUsers.SingleOrDefault(A => A.UserName.Equals(username) && A.Password.Equals(pwd));
|
||||
if (entity != null)
|
||||
{
|
||||
TokenString = GetToken(entity);
|
||||
res.isok = true;
|
||||
|
||||
|
||||
|
||||
ResLoginData r = new ResLoginData();
|
||||
r.AccessToken = TokenString;
|
||||
r.IsAdmin = entity.IsAdmin;
|
||||
r.ID = entity.Id;
|
||||
r.UserName = entity.UserName;
|
||||
res.response = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
res.isok = false;
|
||||
res.message = "用户名或密码错误";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.message = ex.Message;
|
||||
res.isok = false;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
private string GetToken(TblUtsManageUser? entity)
|
||||
{
|
||||
string TokenString;
|
||||
var claims = new Claim[]
|
||||
{
|
||||
new Claim(ClaimTypes.NameIdentifier, entity.Id.ToString()),
|
||||
new Claim(ClaimTypes.Role, entity.IsAdmin.ToString()),
|
||||
new Claim(ClaimTypes.Name, entity.UserName)
|
||||
};
|
||||
|
||||
var secretByte = Encoding.UTF8.GetBytes(configuration["JwT:SecretKey"]);
|
||||
var signingKey = new SymmetricSecurityKey(secretByte);
|
||||
var a = SecurityAlgorithms.HmacSha256;
|
||||
|
||||
var signingCredentials = new SigningCredentials(signingKey, a);
|
||||
|
||||
var token = new JwtSecurityToken(
|
||||
issuer: configuration["JwT:Issuer"],
|
||||
audience: configuration["JwT:Audience"],//接收
|
||||
claims: claims,//存放的用户信息
|
||||
notBefore: DateTime.UtcNow,//发布时间
|
||||
expires: DateTime.UtcNow.AddDays(3),//过期时间
|
||||
signingCredentials: signingCredentials
|
||||
//有效期设置为1天signingCredentials //数字名
|
||||
);
|
||||
TokenString = new JwtSecurityTokenHandler().WriteToken(token);
|
||||
return TokenString;
|
||||
}
|
||||
|
||||
public class LLLG
|
||||
{
|
||||
public string UserName { get; set; }
|
||||
public string Database { get; set; }
|
||||
}
|
||||
private readonly Logger _logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Authorize()]
|
||||
[HttpPost()]
|
||||
public ReturnInfo LogRecord([FromBody] LLLG data)
|
||||
{
|
||||
|
||||
ReturnInfo res = new ReturnInfo();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
string Device = "Unknown";
|
||||
#region 记录登录信息
|
||||
var userAgent = Request.Headers["User-Agent"].ToString();
|
||||
bool
|
||||
_windows = userAgent.Contains("Windows NT"),
|
||||
_mac = userAgent.Contains("Macintosh"),
|
||||
_iphone = userAgent.Contains("iPhone"),
|
||||
_android = userAgent.Contains("Android")
|
||||
;
|
||||
if (_windows)
|
||||
{
|
||||
Device = "windows";
|
||||
}
|
||||
else if (_mac)
|
||||
{
|
||||
Device = "Mac";
|
||||
}
|
||||
else if (_iphone)
|
||||
{
|
||||
Device = "ios";
|
||||
}
|
||||
else if (_android)
|
||||
{
|
||||
Device = "Android";
|
||||
}
|
||||
else
|
||||
{
|
||||
Device = "未知";
|
||||
}
|
||||
#endregion
|
||||
|
||||
//获得IP
|
||||
string? ip = string.Empty;
|
||||
string? NNN = HttpContext?.Request?.HttpContext?.Connection?.RemoteIpAddress?.ToString();
|
||||
if (string.IsNullOrEmpty(NNN))
|
||||
{
|
||||
ip = HttpContext?.Request.Headers["HTTP_X_FORWARDED_FOR"];
|
||||
}
|
||||
else
|
||||
{
|
||||
ip = NNN;
|
||||
}
|
||||
|
||||
var uaParser = Parser.GetDefault();
|
||||
|
||||
ClientInfo c = uaParser.Parse(userAgent);
|
||||
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
TblUtsUseroperation t = new TblUtsUseroperation();
|
||||
t.CreationTime = DateTime.Now;
|
||||
t.UserName = data.UserName;
|
||||
t.Ip = ip;
|
||||
t.Browser = c.Browser.Family + " " + c.Browser.Major + "." + c.Browser.Minor;
|
||||
t.Operation = "登录";
|
||||
t.Database = data.Database;
|
||||
t.Device = Device;
|
||||
|
||||
if (ip.Equals("::1"))
|
||||
{
|
||||
t.Location = "本地";
|
||||
}
|
||||
else
|
||||
{
|
||||
t.Location = GetBaiduIp(ip);
|
||||
}
|
||||
q.TblUtsUseroperations.Add(t);
|
||||
q.SaveChanges();
|
||||
|
||||
res.isok = true;
|
||||
res.response = "sucess";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex.Message);
|
||||
res.isok = false;
|
||||
res.response = ex.Message;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void UserLog(string Openration, string Device)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public string Helloooo()
|
||||
{
|
||||
return "hello";
|
||||
}
|
||||
|
||||
[HttpGet()]
|
||||
public string AccessDenied()
|
||||
{
|
||||
return "aaaa";
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 百度api
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetBaiduIp(string ip)
|
||||
{
|
||||
string location = "";
|
||||
try
|
||||
{
|
||||
string url = $"https://sp0.baidu.com";
|
||||
//WebClient client = new WebClient();
|
||||
RestSharp.RestClient client1 = new RestSharp.RestClient(url);
|
||||
RestSharp.RestRequest request = new RestSharp.RestRequest($"/8aQDcjqpAAV3otqbppnN2DJv/api.php?query={ip}&co=&resource_id=6006&oe=utf8", Method.Get);
|
||||
var buffer = client1.DownloadData(request);
|
||||
//var buffer = client.DownloadData(url);
|
||||
string jsonText = Encoding.UTF8.GetString(buffer);
|
||||
JObject jo = JObject.Parse(jsonText);
|
||||
|
||||
Root root = JsonConvert.DeserializeObject<Root>(jo.ToString());
|
||||
foreach (var item in root.data)
|
||||
{
|
||||
location = item.location;
|
||||
}
|
||||
return location;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//Console.WriteLine(ex);
|
||||
return location;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class Root
|
||||
{
|
||||
public List<DataItem> data { get; set; }
|
||||
}
|
||||
public class DataItem
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ExtendedLocation { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string OriginQuery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string appinfo { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int disp_type { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string fetchkey { get; set; }
|
||||
/// <summary>
|
||||
/// 本地局域网
|
||||
/// </summary>
|
||||
public string location { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origip { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origipquery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string resourceid { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int role_id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int shareImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int showLikeShare { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string showlamp { get; set; }
|
||||
/// <summary>
|
||||
/// IP地址查询
|
||||
/// </summary>
|
||||
public string titlecont { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string tplt { get; set; }
|
||||
}
|
||||
}
|
||||
515
WebAPIServer/Controllers/TestLogsController.cs
Normal file
515
WebAPIServer/Controllers/TestLogsController.cs
Normal file
@@ -0,0 +1,515 @@
|
||||
using ClosedXML.Excel;
|
||||
using IronPython.Hosting;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using MySqlConnector;
|
||||
using NLog;
|
||||
using System.Data;
|
||||
using System.Text;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Common;
|
||||
using WebAPIServer.Models;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class TestLogsController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 每个步骤返回多条测试记录
|
||||
/// </summary>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetLogListBySN([FromBody] TestLogsQueryModel T)
|
||||
{
|
||||
ReturnInfo returnInfo = new();
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
using IDbConnection conn = q.Database.GetDbConnection();
|
||||
conn.Open();
|
||||
|
||||
List<ReturnTestLogs> tl = [];
|
||||
foreach (var item in T.DbList)
|
||||
{
|
||||
string tableName = $"{T.DBName}.tbl_{item.ProId}_{item.Step}_testlog";
|
||||
// 修改点1:移除了MAX聚合函数,查询所有匹配记录
|
||||
string sql = $"SELECT * FROM {tableName} WHERE DUT_SN = '{T.SnCode}'";
|
||||
|
||||
using MySqlCommand command = new(sql, (MySqlConnection)conn);
|
||||
using MySqlDataAdapter adapter = new(command);
|
||||
DataSet ds = new();
|
||||
adapter.Fill(ds);
|
||||
|
||||
if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
|
||||
{
|
||||
// 没有数据时仍创建空对象(保持原有结构)
|
||||
tl.Add(new ReturnTestLogs
|
||||
{
|
||||
Step = item.Step,
|
||||
ID = "",
|
||||
StartTime = "",
|
||||
UsedTime = "",
|
||||
FailSteps = "",
|
||||
FailMsg = "",
|
||||
TestResult = "",
|
||||
RObj = new List<Dictionary<string, string>>()
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// 修改点2:处理所有行数据
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
var log = new ReturnTestLogs
|
||||
{
|
||||
Step = item.Step,
|
||||
ID = row["ID"]?.ToString() ?? "",
|
||||
StartTime = row["StartTime"]?.ToString() ?? "",
|
||||
UsedTime = row["UsedTime"]?.ToString() ?? "",
|
||||
FailSteps = row["FailSteps"]?.ToString() ?? "",
|
||||
FailMsg = row["FailMsg"]?.ToString() ?? "",
|
||||
TestResult = row["TestResult"]?.ToString() ?? "",
|
||||
RObj = []
|
||||
};
|
||||
|
||||
// 修改点3:每行数据单独创建字典
|
||||
var rowData = new Dictionary<string, string>();
|
||||
foreach (DataColumn col in ds.Tables[0].Columns)
|
||||
{
|
||||
rowData[col.ColumnName] = row[col]?.ToString() ?? "";
|
||||
}
|
||||
log.RObj.Add(rowData);
|
||||
|
||||
tl.Add(log);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = tl;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试总表Excel
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public IActionResult GetTestSummaryTableExcel([FromBody] TestLogExportRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
string? dbName = request.dbName;
|
||||
string? tbName = request.tbName;
|
||||
string? startDate = request.StartTime;
|
||||
string? endDate = request.EndTime;
|
||||
string? testResult = request.TestResult;
|
||||
List<string>? failSteps = request.FailSteps;
|
||||
string? columnList = request.ColumnList;
|
||||
string distinctType = request.DistinctType ?? "None"; // 获取去重类型
|
||||
|
||||
if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate))
|
||||
{
|
||||
return BadRequest("开始时间或结束时间不能为空");
|
||||
}
|
||||
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
using IDbConnection conn = q.Database.GetDbConnection();
|
||||
|
||||
if (conn.State != ConnectionState.Open)
|
||||
{
|
||||
conn.Open();
|
||||
}
|
||||
|
||||
// 构建查询
|
||||
StringBuilder dataQuery = new StringBuilder();
|
||||
|
||||
if (distinctType == "None")
|
||||
{
|
||||
// 不去重的情况
|
||||
dataQuery.Append("SELECT ID, ServiceID AS SID, StartTime, DUT_SN, TestResult, Failsteps");
|
||||
|
||||
if (!string.IsNullOrEmpty(columnList))
|
||||
{
|
||||
dataQuery.Append(columnList);
|
||||
}
|
||||
|
||||
dataQuery.Append($" FROM {dbName}.{tbName} ");
|
||||
dataQuery.Append($"WHERE StartTime BETWEEN '{startDate} 00:00:00' AND '{endDate} 23:59:59' ");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 去重的情况
|
||||
string orderDirection = distinctType == "Latest" ? "DESC" : "ASC";
|
||||
|
||||
dataQuery.Append("SELECT ID, ServiceID AS SID, StartTime, DUT_SN, TestResult, Failsteps");
|
||||
|
||||
if (!string.IsNullOrEmpty(columnList))
|
||||
{
|
||||
dataQuery.Append(columnList);
|
||||
}
|
||||
|
||||
dataQuery.Append(" FROM (");
|
||||
dataQuery.Append("SELECT *, ROW_NUMBER() OVER (PARTITION BY DUT_SN ORDER BY StartTime ");
|
||||
dataQuery.Append(orderDirection);
|
||||
dataQuery.Append($") AS rn FROM {dbName}.{tbName} ");
|
||||
dataQuery.Append($"WHERE StartTime BETWEEN '{startDate} 00:00:00' AND '{endDate} 23:59:59' ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(testResult))
|
||||
{
|
||||
dataQuery.Append($"AND TestResult = '{testResult}' ");
|
||||
}
|
||||
|
||||
if (failSteps != null && failSteps.Count > 0)
|
||||
{
|
||||
string failStepsCondition = string.Join(",", failSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
dataQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
|
||||
if (distinctType != "None")
|
||||
{
|
||||
dataQuery.Append(") t WHERE rn = 1 ");
|
||||
}
|
||||
|
||||
dataQuery.Append("ORDER BY StartTime DESC");
|
||||
|
||||
// 执行数据查询
|
||||
IDbCommand dataCmd = conn.CreateCommand();
|
||||
dataCmd.CommandText = dataQuery.ToString();
|
||||
|
||||
MySqlCommand command = dataCmd as MySqlCommand;
|
||||
MySqlDataAdapter adapter = new(command);
|
||||
DataSet ds = new();
|
||||
adapter.Fill(ds);
|
||||
|
||||
DataTable dt = ds.Tables[0];
|
||||
|
||||
// 使用ClosedXML创建Excel
|
||||
using (var workbook = new XLWorkbook())
|
||||
{
|
||||
var worksheet = workbook.Worksheets.Add(dt, "Sheet");
|
||||
|
||||
// 设置标题行样式
|
||||
var headerRow = worksheet.Row(1);
|
||||
headerRow.Style.Font.Bold = true;
|
||||
// 自动调整列宽
|
||||
worksheet.Columns().AdjustToContents();
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
workbook.SaveAs(stream);
|
||||
var content = stream.ToArray();
|
||||
return File(content, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", $"{tbName}_Export.xlsx");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return StatusCode(500, $"导出失败: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ReturnInfoPage GetTestSummaryTable([FromBody] TestLog T)
|
||||
{
|
||||
ReturnInfoPage returnInfo = new();
|
||||
string? dbName = T.dbName;
|
||||
string? tbName = T.tbName;
|
||||
string? StartTime = T.StartTime;
|
||||
string? EndTime = T.EndTime;
|
||||
string? TestResult = T.TestResult;
|
||||
List<string>? FailSteps = T.FailSteps;
|
||||
string? ColumnList = T.ColumnList;
|
||||
int page = T.Page;
|
||||
int pageSize = T.PageSize;
|
||||
string distinctType = T.DistinctType ?? "None"; // 获取去重类型,默认为不去重
|
||||
|
||||
if (string.IsNullOrEmpty(StartTime) || string.IsNullOrEmpty(EndTime))
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = "开始时间或结束时间不能为空";
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
using IDbConnection conn = q.Database.GetDbConnection();
|
||||
|
||||
if (conn.State != ConnectionState.Open)
|
||||
{
|
||||
conn.Open();
|
||||
}
|
||||
|
||||
// 1. 构建基础查询(总数查询)
|
||||
StringBuilder baseQuery = new StringBuilder();
|
||||
|
||||
if (distinctType == "None")
|
||||
{
|
||||
// 不去重的情况
|
||||
baseQuery.Append($"SELECT COUNT(*) AS Total FROM {dbName}.{tbName} ");
|
||||
baseQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 去重的情况,需要计算去重后的总数
|
||||
baseQuery.Append($"SELECT COUNT(DISTINCT DUT_SN) AS Total FROM {dbName}.{tbName} ");
|
||||
baseQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(TestResult))
|
||||
{
|
||||
baseQuery.Append($"AND TestResult = '{TestResult}' ");
|
||||
}
|
||||
|
||||
if (FailSteps != null && FailSteps.Count > 0)
|
||||
{
|
||||
// 使用IN语句查询多个失败步骤
|
||||
string failStepsCondition = string.Join(",", FailSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
baseQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
|
||||
// 执行总数查询
|
||||
IDbCommand countCmd = conn.CreateCommand();
|
||||
countCmd.CommandText = baseQuery.ToString();
|
||||
long totalCount = Convert.ToInt64(countCmd.ExecuteScalar());
|
||||
|
||||
// 2. 计算总通过数
|
||||
long totalPassCount = 0;
|
||||
StringBuilder totalPassQuery = new StringBuilder();
|
||||
|
||||
if (distinctType == "None")
|
||||
{
|
||||
// 不去重的情况:统计所有通过的记录
|
||||
totalPassQuery.Append($"SELECT COUNT(*) FROM {dbName}.{tbName} ");
|
||||
totalPassQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
totalPassQuery.Append($"AND TestResult = '1'");
|
||||
|
||||
if (!string.IsNullOrEmpty(TestResult))
|
||||
{
|
||||
totalPassQuery.Append($"AND TestResult = '{TestResult}' ");
|
||||
}
|
||||
|
||||
if (FailSteps != null && FailSteps.Count > 0)
|
||||
{
|
||||
// 使用IN语句查询多个失败步骤
|
||||
string failStepsCondition = string.Join(",", FailSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
totalPassQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 去重的情况:统计去重后记录中通过的数量
|
||||
string orderDirection = distinctType == "Latest" ? "DESC" : "ASC";
|
||||
|
||||
totalPassQuery.Append($"SELECT COUNT(*) FROM (");
|
||||
totalPassQuery.Append($"SELECT *, ROW_NUMBER() OVER (PARTITION BY DUT_SN ORDER BY StartTime {orderDirection}) AS rn ");
|
||||
totalPassQuery.Append($"FROM {dbName}.{tbName} ");
|
||||
totalPassQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
|
||||
if (!string.IsNullOrEmpty(TestResult))
|
||||
{
|
||||
totalPassQuery.Append($"AND TestResult = '{TestResult}' ");
|
||||
}
|
||||
|
||||
if (FailSteps != null && FailSteps.Count > 0)
|
||||
{
|
||||
// 使用IN语句查询多个失败步骤
|
||||
string failStepsCondition = string.Join(",", FailSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
totalPassQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
|
||||
totalPassQuery.Append($") as t WHERE rn = 1 AND TestResult = '1'");
|
||||
}
|
||||
|
||||
IDbCommand totalPassCmd = conn.CreateCommand();
|
||||
totalPassCmd.CommandText = totalPassQuery.ToString();
|
||||
totalPassCount = Convert.ToInt64(totalPassCmd.ExecuteScalar());
|
||||
|
||||
// 3. 计算通过率
|
||||
double passRate = totalCount > 0 ? Math.Round((double)totalPassCount / totalCount * 100, 2) : 0;
|
||||
// 4. 构建数据查询
|
||||
StringBuilder dataQuery = new StringBuilder();
|
||||
|
||||
if (distinctType == "None")
|
||||
{
|
||||
// 不去重的情况
|
||||
dataQuery.Append("SELECT ID, ServiceID AS SID, StartTime, DUT_SN, TestResult, Failsteps");
|
||||
|
||||
if (!string.IsNullOrEmpty(ColumnList))
|
||||
{
|
||||
dataQuery.Append(ColumnList);
|
||||
}
|
||||
|
||||
dataQuery.Append($" FROM {dbName}.{tbName} ");
|
||||
dataQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 去重的情况
|
||||
string orderDirection = distinctType == "Latest" ? "DESC" : "ASC";
|
||||
|
||||
dataQuery.Append("SELECT ID, ServiceID AS SID, StartTime, DUT_SN, TestResult, Failsteps");
|
||||
|
||||
if (!string.IsNullOrEmpty(ColumnList))
|
||||
{
|
||||
dataQuery.Append(ColumnList);
|
||||
}
|
||||
|
||||
dataQuery.Append(" FROM (");
|
||||
dataQuery.Append("SELECT *, ROW_NUMBER() OVER (PARTITION BY DUT_SN ORDER BY StartTime ");
|
||||
dataQuery.Append(orderDirection);
|
||||
dataQuery.Append($") AS rn FROM {dbName}.{tbName} ");
|
||||
dataQuery.Append($"WHERE StartTime BETWEEN '{StartTime} 00:00:00' AND '{EndTime} 23:59:59' ");
|
||||
|
||||
if (!string.IsNullOrEmpty(TestResult))
|
||||
{
|
||||
dataQuery.Append($"AND TestResult = '{TestResult}' ");
|
||||
}
|
||||
|
||||
if (FailSteps != null && FailSteps.Count > 0)
|
||||
{
|
||||
// 使用IN语句查询多个失败步骤
|
||||
string failStepsCondition = string.Join(",", FailSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
dataQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
|
||||
dataQuery.Append(") t WHERE rn = 1 ");
|
||||
}
|
||||
|
||||
if (distinctType == "None")
|
||||
{
|
||||
// 不去重的情况下添加条件
|
||||
if (!string.IsNullOrEmpty(TestResult))
|
||||
{
|
||||
dataQuery.Append($"AND TestResult = '{TestResult}' ");
|
||||
}
|
||||
|
||||
if (FailSteps != null && FailSteps.Count > 0)
|
||||
{
|
||||
// 使用IN语句查询多个失败步骤
|
||||
string failStepsCondition = string.Join(",", FailSteps.Select(f => $"'{MySqlHelper.EscapeString(f)}'"));
|
||||
dataQuery.Append($"AND Failsteps IN ({failStepsCondition}) ");
|
||||
}
|
||||
}
|
||||
|
||||
// 添加排序和分页
|
||||
dataQuery.Append($"ORDER BY StartTime DESC LIMIT {pageSize} OFFSET {(page - 1) * pageSize}");
|
||||
|
||||
// 执行数据查询
|
||||
IDbCommand dataCmd = conn.CreateCommand();
|
||||
dataCmd.CommandText = dataQuery.ToString();
|
||||
|
||||
MySqlCommand command = dataCmd as MySqlCommand;
|
||||
MySqlDataAdapter adapter = new(command);
|
||||
DataSet ds = new();
|
||||
adapter.Fill(ds);
|
||||
|
||||
DataTable dt = ds.Tables[0];
|
||||
|
||||
// 处理结果
|
||||
List<Dictionary<string, string>> list = new List<Dictionary<string, string>>();
|
||||
foreach (DataRow item in dt.Rows)
|
||||
{
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
foreach (DataColumn col in dt.Columns)
|
||||
{
|
||||
dic.Add(col.ColumnName, item[col]?.ToString() ?? "");
|
||||
}
|
||||
list.Add(dic);
|
||||
}
|
||||
|
||||
returnInfo.isok = true;
|
||||
returnInfo.total = totalCount;
|
||||
returnInfo.response = list;
|
||||
returnInfo.passCount = totalPassCount; // 修改字段名
|
||||
returnInfo.passRate = passRate;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class TestLogExportRequest
|
||||
{
|
||||
public string? dbName { get; set; }
|
||||
public string? tbName { get; set; }
|
||||
public string StartTime { get; set; }
|
||||
public string EndTime { get; set; }
|
||||
public string? TestResult { get; set; }
|
||||
public List<string>? FailSteps { get; set; }
|
||||
public string? ColumnList { get; set; }
|
||||
public string DistinctType { get; set; } = "None"; // 新增字段:None-不去重, Latest-保留最新, Earliest-保留最早
|
||||
}
|
||||
|
||||
public class ReturnTestLogs
|
||||
{
|
||||
|
||||
public string Step { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string StartTime { get; set; }
|
||||
public string UsedTime { get; set; }
|
||||
public string FailSteps { get; set; }
|
||||
public string FailMsg { get; set; }
|
||||
public string TestResult { get; set; }
|
||||
public List<Dictionary<string, string>> RObj { get; set; }
|
||||
}
|
||||
|
||||
public class TestLogsQueryModel
|
||||
{
|
||||
public string DBName { get; set; }
|
||||
public string SnCode { get; set; }
|
||||
|
||||
public List<DBL> DbList { get; set; }
|
||||
}
|
||||
public class DBL
|
||||
{
|
||||
public string ProId { get; set; }
|
||||
public string Step { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class TestLog : TestLogExportRequest
|
||||
{
|
||||
public int Page { get; set; }
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
|
||||
// 扩展ReturnInfoPage类以包含一次通过数和通过率
|
||||
public class ReturnInfoPage
|
||||
{
|
||||
public bool isok { get; set; }
|
||||
public string message { get; set; }
|
||||
public long total { get; set; }
|
||||
public object response { get; set; }
|
||||
public long passCount { get; set; }
|
||||
public double passRate { get; set; }
|
||||
}
|
||||
}
|
||||
298
WebAPIServer/Controllers/UsersController.cs
Normal file
298
WebAPIServer/Controllers/UsersController.cs
Normal file
@@ -0,0 +1,298 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Extensions;
|
||||
using WebAPIServer.Models;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class UsersController : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo DelUser([FromBody] TblUtsManageUser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
var FFF = q.TblUtsManageUsers.FirstOrDefault(A => A.Id == LLL.Id);
|
||||
if (FFF != null)
|
||||
{
|
||||
FFF.IsValid = false;
|
||||
q.TblUtsManageUsers.Update(FFF);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo EditUser([FromBody] ReturnUser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
var lll = q.TblUtsManageUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (lll != null)
|
||||
{
|
||||
|
||||
string username = LLL.UserName;
|
||||
int companyId = LLL.CompanyId;
|
||||
string mobile = LLL.Mobile;
|
||||
string weiXin = LLL.WeiXin;
|
||||
string email = LLL.Email;
|
||||
|
||||
lll.UserName = username;
|
||||
lll.CompanyId = companyId;
|
||||
lll.Mobile = mobile;
|
||||
lll.WeiXin = weiXin;
|
||||
lll.Email = email;
|
||||
lll.UpdateTime = DateTime.Now;
|
||||
|
||||
q.TblUtsManageUsers.Update(lll);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo ResetPassWord([FromBody] PWD_Reset LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
var QQQ = q.TblUtsManageUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (QQQ != null)
|
||||
{
|
||||
QQQ.Password = LLL.PlaintextPwd.ToMD5().ToMD5();
|
||||
QQQ.PlaintextPwd = LLL.PlaintextPwd;
|
||||
q.TblUtsManageUsers.Update(QQQ);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增密码为123456
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo NewPassWord([FromBody] PWD_Reset LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
var Q = q.TblUtsManageUsers.SingleOrDefault(A => A.Id == LLL.Id);
|
||||
if (Q != null)
|
||||
{
|
||||
Q.Password = "123456".ToMD5().ToMD5();
|
||||
Q.PlaintextPwd = "123456";
|
||||
q.TblUtsManageUsers.Update(Q);
|
||||
q.SaveChanges();
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <param name="S"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo GetUserInfo([FromBody] QueryAll_Or_Single S)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
if (S.IsAll)
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
returnInfo.response = q.TblUtsManageUsers.Where(A => A.IsValid).Select(F => new ReturnUser
|
||||
{
|
||||
Id = F.Id,
|
||||
UserName = F.UserName,
|
||||
CompanyId = F.CompanyId,
|
||||
Mobile = F.Mobile,
|
||||
WeiXin = F.WeiXin,
|
||||
Email = F.Email,
|
||||
}).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
returnInfo.isok = true;
|
||||
var a = q.TblUtsManageUsers.SingleOrDefault(A => A.Id == S.ID);
|
||||
if (a != null)
|
||||
{
|
||||
ReturnUser u = new ReturnUser();
|
||||
u.Id = a.Id;
|
||||
u.UserName = a.UserName;
|
||||
u.CompanyId = a.CompanyId;
|
||||
u.Mobile = a.Mobile;
|
||||
u.WeiXin = a.WeiXin;
|
||||
u.Email = a.Email;
|
||||
returnInfo.response = u;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新增用户
|
||||
/// </summary>
|
||||
/// <param name="LLL"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost()]
|
||||
[Authorize()]
|
||||
public ReturnInfo AddUser([FromBody] ReturnUser LLL)
|
||||
{
|
||||
ReturnInfo returnInfo = new ReturnInfo();
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
// {
|
||||
//"id": 0,
|
||||
//"userName": "test6",
|
||||
//"companyId": "",
|
||||
//"companyName": "",
|
||||
//"mobile": "",
|
||||
//"weiXin": "",
|
||||
//"email": "",
|
||||
//"resetpsw": true,
|
||||
//"permissions": [],
|
||||
//"company": ""
|
||||
//}
|
||||
string username = LLL.UserName;
|
||||
int companyId = LLL.CompanyId;
|
||||
string mobile = LLL.Mobile;
|
||||
string weiXin = LLL.WeiXin;
|
||||
string email = LLL.Email;
|
||||
|
||||
TblUtsManageUser lll = new TblUtsManageUser();
|
||||
lll.UserName = username;
|
||||
lll.CompanyId = companyId;
|
||||
lll.Mobile = mobile;
|
||||
lll.WeiXin = weiXin;
|
||||
lll.Email = email;
|
||||
lll.IsValid = true;
|
||||
lll.CreateTime = DateTime.Now;
|
||||
lll.UpdateTime = DateTime.Now;
|
||||
|
||||
using (var q = new UtsManageContext())
|
||||
{
|
||||
var Q = q.TblUtsManageUsers.Where(A => A.UserName.Equals(username));
|
||||
if (Q.Count() > 0)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = "此用户名已经存在";
|
||||
}
|
||||
else
|
||||
{
|
||||
lll.PlaintextPwd = "123456";
|
||||
lll.Password = "123456".ToMD5().ToMD5(); ;
|
||||
q.TblUtsManageUsers.Add(lll);
|
||||
returnInfo.isok = true;
|
||||
}
|
||||
q.SaveChanges();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
returnInfo.isok = false;
|
||||
returnInfo.message = ex.Message;
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 返回用户信息
|
||||
/// </summary>
|
||||
public class ReturnUser
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public int CompanyId { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string WeiXin { get; set; }
|
||||
public string Email { get; set; }
|
||||
}
|
||||
public class PWD_Reset
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string PlaintextPwd { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
47
WebAPIServer/Controllers/ValuesController.cs
Normal file
47
WebAPIServer/Controllers/ValuesController.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ViewModels;
|
||||
using WebAPIServer.Common;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class ValuesController : ControllerBase
|
||||
{
|
||||
[HttpGet()]
|
||||
public ReturnInfo GetAll_WebApiMethod(string VariableName)
|
||||
{
|
||||
ReturnInfo i = new ReturnInfo();
|
||||
i.isok = true;
|
||||
try
|
||||
{
|
||||
var result = StaticData.scope.GetVariable(VariableName);
|
||||
i.response = result;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
i.isok = false;
|
||||
i.message = ex.Message;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
[HttpPost()]
|
||||
public ReturnInfo UpdateData()
|
||||
{
|
||||
ReturnInfo i = new ReturnInfo();
|
||||
i.isok = true;
|
||||
try
|
||||
{
|
||||
StaticData.GetWebAPIMethod();
|
||||
i.response = "sucess";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
i.isok = false;
|
||||
i.message = ex.Message;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
33
WebAPIServer/Controllers/WeatherForecastController.cs
Normal file
33
WebAPIServer/Controllers/WeatherForecastController.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace WebAPIServer.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class WeatherForecastController : ControllerBase
|
||||
{
|
||||
private static readonly string[] Summaries = new[]
|
||||
{
|
||||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
|
||||
};
|
||||
|
||||
private readonly ILogger<WeatherForecastController> _logger;
|
||||
|
||||
public WeatherForecastController(ILogger<WeatherForecastController> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public IEnumerable<WeatherForecast> Get()
|
||||
{
|
||||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
|
||||
{
|
||||
Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
|
||||
TemperatureC = Random.Shared.Next(-20, 55),
|
||||
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
85
WebAPIServer/Extensions/CaptchaHelperSkiaSharp.cs
Normal file
85
WebAPIServer/Extensions/CaptchaHelperSkiaSharp.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System.Text;
|
||||
using SkiaSharp;
|
||||
using static IronPython.Modules._ast;
|
||||
|
||||
namespace WebAPIServer.Extensions
|
||||
{
|
||||
public class CaptchaHelperSkiaSharp
|
||||
{
|
||||
private static string GenerateRandomText(int length)
|
||||
{
|
||||
const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
StringBuilder res = new StringBuilder();
|
||||
Random rnd = new Random();
|
||||
while (0 < length--)
|
||||
res.Append(valid[rnd.Next(valid.Length)]);
|
||||
return res.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取图像数字验证码
|
||||
/// </summary>
|
||||
/// <param name="text">验证码内容,如4为数字</param>
|
||||
/// <returns></returns>
|
||||
public static byte[] GetVerifyCode(string text)
|
||||
{
|
||||
|
||||
int width = 128;
|
||||
int height = 45;
|
||||
|
||||
Random random = new();
|
||||
|
||||
//创建bitmap位图
|
||||
using SKBitmap image = new(width, height, SKColorType.Bgra8888, SKAlphaType.Premul);
|
||||
//创建画笔
|
||||
using SKCanvas canvas = new(image);
|
||||
//填充背景颜色为白色
|
||||
canvas.DrawColor(SKColors.White);
|
||||
|
||||
//画图片的背景噪音线
|
||||
for (int i = 0; i < (width * height * 0.015); i++)
|
||||
{
|
||||
using SKPaint drawStyle = new();
|
||||
drawStyle.Color = new(Convert.ToUInt32(random.Next(Int32.MaxValue)));
|
||||
|
||||
canvas.DrawLine(random.Next(0, width), random.Next(0, height), random.Next(0, width), random.Next(0, height), drawStyle);
|
||||
}
|
||||
|
||||
//将文字写到画布上
|
||||
using (SKPaint drawStyle = new())
|
||||
{
|
||||
drawStyle.Color = SKColors.Red;
|
||||
drawStyle.TextSize = height;
|
||||
drawStyle.StrokeWidth = 1;
|
||||
|
||||
float emHeight = height - (float)height * (float)0.14;
|
||||
float emWidth = ((float)width / text.Length) - ((float)width * (float)0.13);
|
||||
|
||||
canvas.DrawText(text, emWidth, emHeight, drawStyle);
|
||||
}
|
||||
|
||||
//画图片的前景噪音点
|
||||
for (int i = 0; i < (width * height * 0.6); i++)
|
||||
{
|
||||
image.SetPixel(random.Next(0, width), random.Next(0, height), new SKColor(Convert.ToUInt32(random.Next(Int32.MaxValue))));
|
||||
}
|
||||
|
||||
using var img = SKImage.FromBitmap(image);
|
||||
using SKData p = img.Encode(SKEncodedImageFormat.Png, 100);
|
||||
return p.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] GenerateCaptchaImage(int width = 100, int height = 40)
|
||||
{
|
||||
var random = new Random();
|
||||
string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
string captchaText = "";
|
||||
for (int i = 0; i < 4; i++) // 生成6个字符的验证码
|
||||
{
|
||||
captchaText += chars[random.Next(chars.Length)];
|
||||
}
|
||||
return GetVerifyCode(captchaText);
|
||||
}
|
||||
}
|
||||
}
|
||||
346
WebAPIServer/Extensions/StringExtensions.cs
Normal file
346
WebAPIServer/Extensions/StringExtensions.cs
Normal file
@@ -0,0 +1,346 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebAPIServer.Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 字符串扩展函数工具类
|
||||
/// </summary>
|
||||
public static class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 将\r\n替换成BR
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToSafeBR(this string str)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str))
|
||||
{
|
||||
return str.Replace("\r\n", "<br>").Replace("\r", "<br>").Replace("\n", "<br>");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 得到父部门的ID
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetDepartmentFatherID(this string str)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str) && str.Length > 2)
|
||||
{
|
||||
str = str.Substring(0, str.Length - 3);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 截取字符串,超过部分用...代替
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="len"></param>
|
||||
/// <returns></returns>
|
||||
public static string Substr(this string source, int len)
|
||||
{
|
||||
return source.Substr(len, "...");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 截取字符串,超过部分用自定义代替
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <param name="len"></param>
|
||||
/// <param name="att"></param>
|
||||
/// <returns></returns>
|
||||
public static string Substr(this string source, int len, string att)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
att = (att ?? string.Empty);
|
||||
Regex regex = new Regex("[\\u4e00-\\u9fa5]");
|
||||
Regex regex2 = new Regex("^[A-Za-z0-9]+$");
|
||||
if (regex.IsMatch(source))
|
||||
{
|
||||
if (source.Length <= len)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len) + att;
|
||||
}
|
||||
else if (regex2.IsMatch(source))
|
||||
{
|
||||
if (source.Length <= len * 2)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len * 2) + att;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (source.Length <= len)
|
||||
{
|
||||
return source;
|
||||
}
|
||||
return source.Substring(0, len) + att;
|
||||
}
|
||||
}
|
||||
|
||||
public static string InputStr(this string source)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(source))
|
||||
{
|
||||
Regex regex = new Regex("[\\u4e00-\\u9fa5]");
|
||||
Regex regex2 = new Regex("^[A-Za-z0-9]+$");
|
||||
if (regex.IsMatch(source))
|
||||
{
|
||||
if (source.Length < 3)
|
||||
{
|
||||
return string.Format("{0}**", source[0]);
|
||||
}
|
||||
if (source.Length == 3)
|
||||
{
|
||||
return string.Format("{0}*{1}", source[0], source[source.Length - 1]);
|
||||
}
|
||||
if (source.Length > 3)
|
||||
{
|
||||
return string.Format("{0}**{1}", source[0], source[source.Length - 1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!regex2.IsMatch(source))
|
||||
{
|
||||
return string.Format("{0}**", source.Substring(0, 2));
|
||||
}
|
||||
if (source.Length < 6)
|
||||
{
|
||||
return string.Format("{0}**", source.Substring(0, 2));
|
||||
}
|
||||
return string.Format("{0}****{1}", source.Substring(0, 2), source.Substring(source.Length - 3, 2));
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除掉所有的Html代码
|
||||
/// </summary>
|
||||
/// <param name="strHtml"></param>
|
||||
/// <returns></returns>
|
||||
public static string RemoveHtml(this string strHtml)
|
||||
{
|
||||
Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
|
||||
strHtml = regex.Replace(strHtml, "");
|
||||
strHtml = strHtml.Replace(" ", "");
|
||||
return strHtml;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成0-9随机数
|
||||
/// </summary>
|
||||
/// <param name="VcodeNum">生成长度</param>
|
||||
/// <returns></returns>
|
||||
public static string RndNum(int VcodeNum)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(VcodeNum);
|
||||
Random random = new Random();
|
||||
for (int i = 1; i < VcodeNum + 1; i++)
|
||||
{
|
||||
int num = random.Next(9);
|
||||
stringBuilder.AppendFormat("{0}", num);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回星号的加密
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="mask"></param>
|
||||
/// <returns></returns>
|
||||
public static string MaskStar(Dictionary<string, string> items, bool mask)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (mask)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> keyValuePair in items)
|
||||
{
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair.Key,
|
||||
"').attr('name', '",
|
||||
keyValuePair.Key,
|
||||
"mask');"
|
||||
}));
|
||||
}
|
||||
stringBuilder.Append("$('.maskstar').attr('disabled', true);");
|
||||
stringBuilder.Append("$('.maskstar').val('***');");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (KeyValuePair<string, string> keyValuePair2 in items)
|
||||
{
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair2.Key,
|
||||
"').attr('name', '",
|
||||
keyValuePair2.Key,
|
||||
"');"
|
||||
}));
|
||||
stringBuilder.Append(string.Concat(new string[]
|
||||
{
|
||||
"$('#",
|
||||
keyValuePair2.Key,
|
||||
"').val('",
|
||||
keyValuePair2.Value,
|
||||
"');"
|
||||
}));
|
||||
}
|
||||
stringBuilder.Append("$('.maskstar').attr('disabled', false);");
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给自动填充使用
|
||||
/// </summary>
|
||||
/// <param name="str1"></param>
|
||||
/// <param name="str2"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToAutoComplate(this string str1, string str2)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(str1) && !string.IsNullOrEmpty(str2))
|
||||
{
|
||||
return str1 + "," + str2;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回红色字体
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToRedColor(this int value)
|
||||
{
|
||||
if (value != 0)
|
||||
{
|
||||
return "<font color='red'>" + value.ToString() + "</font>";
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回安全的字符串类型如果为NULL则返回空
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToSafeString(this object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return value.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将中文转换成Unicode编码,主要用在URL传递中文
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string GB2Unicode(this string str)
|
||||
{
|
||||
string text = "";
|
||||
Encoding encoding = Encoding.GetEncoding("GB2312");
|
||||
Encoding unicode = Encoding.Unicode;
|
||||
byte[] bytes = encoding.GetBytes(str);
|
||||
for (int i = 0; i < bytes.Length; i++)
|
||||
{
|
||||
string str2 = "%" + bytes[i].ToString("x");
|
||||
text += str2;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将字符串转换成为大写的MD5
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToMD5(this string str)
|
||||
{
|
||||
MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider();
|
||||
byte[] array = md5CryptoServiceProvider.ComputeHash(Encoding.Default.GetBytes(str));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (byte b in array)
|
||||
{
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
return stringBuilder.ToString().ToUpper();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字节码长度转可读字符串 00000000 bytes 0.0GB
|
||||
/// </summary>
|
||||
/// <param name="KSize"></param>
|
||||
/// <returns></returns>
|
||||
public static string ByteSizeToString(this long KSize)
|
||||
{
|
||||
if (KSize > 0L)
|
||||
{
|
||||
string[] array = new string[]
|
||||
{
|
||||
"B",
|
||||
"KB",
|
||||
"MB",
|
||||
"GB",
|
||||
"TB"
|
||||
};
|
||||
double num = 0.0;
|
||||
int num2 = array.Length - 1;
|
||||
while (num2 >= 0 && (num = Math.Round((double)KSize / Math.Pow(1024.0, (double)num2), 2)) < 1.0)
|
||||
{
|
||||
num2--;
|
||||
}
|
||||
return string.Format("{0}{1}", num, array[num2]);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 将字符串转换成为大写的MD5
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
private static string GetMD5Code(this string str)
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
using (MD5CryptoServiceProvider md5CryptoServiceProvider = new MD5CryptoServiceProvider())
|
||||
{
|
||||
byte[] array = md5CryptoServiceProvider.ComputeHash(Encoding.Default.GetBytes(str));
|
||||
foreach (byte b in array)
|
||||
{
|
||||
stringBuilder.Append(b.ToString("x2"));
|
||||
}
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
29
WebAPIServer/Extensions/TimeExtensions.cs
Normal file
29
WebAPIServer/Extensions/TimeExtensions.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace WebAPIServer.Extensions
|
||||
{
|
||||
public static class TimeExtensions
|
||||
{
|
||||
public static DateTime? ToDateTime(this string timeStamp)
|
||||
{
|
||||
long ticks = 0L;
|
||||
if (long.TryParse(timeStamp, out ticks))
|
||||
{
|
||||
DateTime dateTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
|
||||
TimeSpan value = new TimeSpan(ticks);
|
||||
return new DateTime?(dateTime.Add(value));
|
||||
}
|
||||
DateTime now = DateTime.Now;
|
||||
if (DateTime.TryParse(timeStamp, out now))
|
||||
{
|
||||
return new DateTime?(now);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
49
WebAPIServer/Models/TblUtsManageApplist.cs
Normal file
49
WebAPIServer/Models/TblUtsManageApplist.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageApplist
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引,无作用
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务索引
|
||||
/// </summary>
|
||||
public int? ServiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP索引
|
||||
/// </summary>
|
||||
public int? AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP名称
|
||||
/// </summary>
|
||||
public string? AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP版本
|
||||
/// </summary>
|
||||
public string? AppVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP注册时间
|
||||
/// </summary>
|
||||
public DateTime? RegisterDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP最后活动时间
|
||||
/// </summary>
|
||||
public DateTime? LastActiveDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App最新信息
|
||||
/// </summary>
|
||||
public string? LastInfomation { get; set; }
|
||||
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
57
WebAPIServer/Models/TblUtsManageApplog.cs
Normal file
57
WebAPIServer/Models/TblUtsManageApplog.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageApplog
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引,无作用
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务索引
|
||||
/// </summary>
|
||||
public int? ServiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP名字
|
||||
/// </summary>
|
||||
public string? AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// App版本
|
||||
/// </summary>
|
||||
public string? AppVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试项目名
|
||||
/// </summary>
|
||||
public string? ProjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试站名
|
||||
/// </summary>
|
||||
public string? StationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试流程名
|
||||
/// </summary>
|
||||
public string? TestPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产生日期
|
||||
/// </summary>
|
||||
public DateTime? DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志类型
|
||||
/// </summary>
|
||||
public string? LogType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志内容
|
||||
/// </summary>
|
||||
public string? LogText { get; set; }
|
||||
}
|
||||
24
WebAPIServer/Models/TblUtsManageAuthlog.cs
Normal file
24
WebAPIServer/Models/TblUtsManageAuthlog.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageAuthlog
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? UserId { get; set; }
|
||||
|
||||
public int? AuthId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限(0禁止,1只读,2读写)
|
||||
/// </summary>
|
||||
public int? Auth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存在
|
||||
///
|
||||
/// </summary>
|
||||
public ulong Exist { get; set; }
|
||||
}
|
||||
19
WebAPIServer/Models/TblUtsManageAuthmanage.cs
Normal file
19
WebAPIServer/Models/TblUtsManageAuthmanage.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageAuthmanage
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部分权限
|
||||
/// </summary>
|
||||
public string? ModuleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string? Describe { get; set; }
|
||||
}
|
||||
27
WebAPIServer/Models/TblUtsManageCompany.cs
Normal file
27
WebAPIServer/Models/TblUtsManageCompany.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 客户列表
|
||||
/// </summary>
|
||||
public partial class TblUtsManageCompany
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户名称
|
||||
/// </summary>
|
||||
public string CustomerName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
139
WebAPIServer/Models/TblUtsManageDataservicelist.cs
Normal file
139
WebAPIServer/Models/TblUtsManageDataservicelist.cs
Normal file
@@ -0,0 +1,139 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageDataservicelist
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务索引唯一值
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴权文件索引
|
||||
/// </summary>
|
||||
public int? LicenseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴权文件有效日期
|
||||
/// </summary>
|
||||
public string? LicenseValidDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司名
|
||||
/// </summary>
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务操作系统
|
||||
/// </summary>
|
||||
public string? TerminalOs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务终端类型
|
||||
/// </summary>
|
||||
public string? TerminalType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务终端名称
|
||||
/// </summary>
|
||||
public string? TerminalName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务自定义标识名
|
||||
/// </summary>
|
||||
public string? TerminalAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务MAC地址
|
||||
/// </summary>
|
||||
public string? TerminalMac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// CUP序列号
|
||||
/// </summary>
|
||||
public string? ProcessorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务版本
|
||||
/// </summary>
|
||||
public string? ServiceVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务注册日期
|
||||
/// </summary>
|
||||
public DateTime? ServiceRegisterDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务最后活动日期
|
||||
/// </summary>
|
||||
public DateTime? ServiceLastActiveDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务是否有效,注册默认有效
|
||||
/// </summary>
|
||||
public sbyte? ServiceValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否在线
|
||||
/// </summary>
|
||||
public bool IsOnline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务上线时间
|
||||
/// </summary>
|
||||
public DateTime? ServiceOnlineDateTime { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障信息
|
||||
/// </summary>
|
||||
public string? ErrMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务版本
|
||||
/// </summary>
|
||||
public string? Usver { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务连接状态
|
||||
/// </summary>
|
||||
public bool? UsisOnline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务的错误
|
||||
/// </summary>
|
||||
public string? UserrMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子网名称
|
||||
/// </summary>
|
||||
public string? BarnchNet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备角色
|
||||
/// </summary>
|
||||
public int? Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内网连接状态
|
||||
/// </summary>
|
||||
public int? IsDbproxyConn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 本机缓存数量
|
||||
/// </summary>
|
||||
public int? CacheCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 网上邻居
|
||||
/// </summary>
|
||||
public string? NetworkNeiborhood { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务当前状态,1有效,0无效
|
||||
/// </summary>
|
||||
public int? ManageStatus { get; set; }
|
||||
}
|
||||
62
WebAPIServer/Models/TblUtsManageDataservicelog.cs
Normal file
62
WebAPIServer/Models/TblUtsManageDataservicelog.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageDataservicelog
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据服务索引
|
||||
/// </summary>
|
||||
public int? ServiceId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据服务版本
|
||||
/// </summary>
|
||||
public string? ServiceVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新服务版本
|
||||
/// </summary>
|
||||
public string? UpdateServiceVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂商名称
|
||||
/// </summary>
|
||||
public string? VendorName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成日期与时间
|
||||
/// </summary>
|
||||
public DateTime? DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公网IP地址
|
||||
/// </summary>
|
||||
public string? PublicIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内网IP地址
|
||||
/// </summary>
|
||||
public string? PrivateIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Mac地址
|
||||
/// </summary>
|
||||
public string? Mac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志类型
|
||||
/// </summary>
|
||||
public string? LogType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志内容
|
||||
/// </summary>
|
||||
public string? LogText { get; set; }
|
||||
}
|
||||
39
WebAPIServer/Models/TblUtsManageDblist.cs
Normal file
39
WebAPIServer/Models/TblUtsManageDblist.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageDblist
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库ID
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库关联公司的索引
|
||||
/// </summary>
|
||||
public int? CompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库名
|
||||
/// </summary>
|
||||
public string? DatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接名
|
||||
/// </summary>
|
||||
public string? DatabaseUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接密码
|
||||
/// </summary>
|
||||
public string? DatabasePassword { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库详细说明
|
||||
/// </summary>
|
||||
public string? DatabaseDesc { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
49
WebAPIServer/Models/TblUtsManageDevlist.cs
Normal file
49
WebAPIServer/Models/TblUtsManageDevlist.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageDevlist
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备ID,唯一索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
public string? DevName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备类型
|
||||
/// </summary>
|
||||
public string? DevType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备MAC地址
|
||||
/// </summary>
|
||||
public string? Mac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 第一次登陆时间
|
||||
/// </summary>
|
||||
public DateTime? FirstLoginDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后一次在线时间
|
||||
/// </summary>
|
||||
public DateTime? LastOnlineDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在线状态
|
||||
/// </summary>
|
||||
public int? OnlineStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备是有有效
|
||||
/// </summary>
|
||||
public int? Valid { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
56
WebAPIServer/Models/TblUtsManageDevlog.cs
Normal file
56
WebAPIServer/Models/TblUtsManageDevlog.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageDevlog
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int? DevId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
public DateTime? DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备公网IP
|
||||
/// </summary>
|
||||
public string? PublicIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备内网IP
|
||||
/// </summary>
|
||||
public string? PrivateIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Licence文件名
|
||||
/// </summary>
|
||||
public string? LicFileName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产生日志的App名
|
||||
/// </summary>
|
||||
public string? AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// APP版本号
|
||||
/// </summary>
|
||||
public string? AppVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 测试配置名称
|
||||
/// </summary>
|
||||
public string? TestPlan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登陆用户账号索引
|
||||
/// </summary>
|
||||
public int? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作内容
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
}
|
||||
29
WebAPIServer/Models/TblUtsManageErrcode.cs
Normal file
29
WebAPIServer/Models/TblUtsManageErrcode.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageErrcode
|
||||
{
|
||||
/// <summary>
|
||||
/// 错误类型
|
||||
/// </summary>
|
||||
public string? ErrType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误ID,唯一值
|
||||
/// </summary>
|
||||
public string ErrCode { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 错误提示
|
||||
/// </summary>
|
||||
public string? ErrMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 统计图表中对应的颜色
|
||||
/// </summary>
|
||||
public string ErrColor { get; set; } = null!;
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
34
WebAPIServer/Models/TblUtsManageLicenselist.cs
Normal file
34
WebAPIServer/Models/TblUtsManageLicenselist.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageLicenselist
|
||||
{
|
||||
/// <summary>
|
||||
/// 鉴权文件索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 鉴权文件所属公司
|
||||
/// </summary>
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布日期
|
||||
/// </summary>
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 有效日期
|
||||
/// </summary>
|
||||
public DateTime? ValidDateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
}
|
||||
30
WebAPIServer/Models/TblUtsManageLog.cs
Normal file
30
WebAPIServer/Models/TblUtsManageLog.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志
|
||||
/// </summary>
|
||||
public partial class TblUtsManageLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引,无作用
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户索引
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志产生时间
|
||||
/// </summary>
|
||||
public DateTime DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作内容
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
}
|
||||
34
WebAPIServer/Models/TblUtsManageModule.cs
Normal file
34
WebAPIServer/Models/TblUtsManageModule.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageModule
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能描述
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制器
|
||||
/// </summary>
|
||||
public string? Controller { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法名
|
||||
/// </summary>
|
||||
public string? Method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1代表已录入
|
||||
/// </summary>
|
||||
public ulong? Exist { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能备注
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
32
WebAPIServer/Models/TblUtsManageOperationlist.cs
Normal file
32
WebAPIServer/Models/TblUtsManageOperationlist.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 操作权限列表
|
||||
/// </summary>
|
||||
public partial class TblUtsManageOperationlist
|
||||
{
|
||||
/// <summary>
|
||||
/// 功能索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能模块名
|
||||
/// </summary>
|
||||
public string? OperationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 功能模块详细说明
|
||||
/// </summary>
|
||||
public string? OperationDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作级别
|
||||
/// </summary>
|
||||
public int OperationLevel { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
15
WebAPIServer/Models/TblUtsManageOrderstatus.cs
Normal file
15
WebAPIServer/Models/TblUtsManageOrderstatus.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageOrderstatus
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string StatusName { get; set; } = null!;
|
||||
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
}
|
||||
19
WebAPIServer/Models/TblUtsManageSearchkey.cs
Normal file
19
WebAPIServer/Models/TblUtsManageSearchkey.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageSearchkey
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库ID
|
||||
/// </summary>
|
||||
public int DataBaseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件
|
||||
/// </summary>
|
||||
public string SearchVarKey { get; set; } = null!;
|
||||
}
|
||||
77
WebAPIServer/Models/TblUtsManageServicelog.cs
Normal file
77
WebAPIServer/Models/TblUtsManageServicelog.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageServicelog
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司名称
|
||||
/// </summary>
|
||||
public string? CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用名称
|
||||
/// </summary>
|
||||
public string? AppName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用版本
|
||||
/// </summary>
|
||||
public string? AppVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志生成日期与时间
|
||||
/// </summary>
|
||||
public DateTime? DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备公网IP
|
||||
/// </summary>
|
||||
public string? DevPublicIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备内网IP地址
|
||||
/// </summary>
|
||||
public string? DevPrivateIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备MAC
|
||||
/// </summary>
|
||||
public string? DevMac { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备系统版本
|
||||
/// </summary>
|
||||
public string? DevOs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备名称
|
||||
/// </summary>
|
||||
public string? DevName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备用户名
|
||||
/// </summary>
|
||||
public string? DevUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备网络状态
|
||||
/// </summary>
|
||||
public string? DevOnline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志类型
|
||||
/// </summary>
|
||||
public string? LogType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志内容
|
||||
/// </summary>
|
||||
public string? LogText { get; set; }
|
||||
}
|
||||
37
WebAPIServer/Models/TblUtsManageSwreleaselog.cs
Normal file
37
WebAPIServer/Models/TblUtsManageSwreleaselog.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageSwreleaselog
|
||||
{
|
||||
/// <summary>
|
||||
/// 软件发布索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软件名称
|
||||
/// </summary>
|
||||
public string SoftwareName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 发布日期与时间
|
||||
/// </summary>
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布版本号
|
||||
/// </summary>
|
||||
public string? ReleaseVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布用户索引
|
||||
/// </summary>
|
||||
public int? UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布说明
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
44
WebAPIServer/Models/TblUtsManageSwupdate.cs
Normal file
44
WebAPIServer/Models/TblUtsManageSwupdate.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageSwupdate
|
||||
{
|
||||
/// <summary>
|
||||
/// 软件索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软件名称
|
||||
/// </summary>
|
||||
public string? SoftwareName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最新版本号
|
||||
/// </summary>
|
||||
public string? LastVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布日期
|
||||
/// </summary>
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 升级的二进制文件
|
||||
/// </summary>
|
||||
public byte[]? BinPackage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MD5校验码
|
||||
/// </summary>
|
||||
public string? BinPackageMd5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软件包名
|
||||
/// </summary>
|
||||
public string? PackageName { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
}
|
||||
24
WebAPIServer/Models/TblUtsManageSynclist.cs
Normal file
24
WebAPIServer/Models/TblUtsManageSynclist.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageSynclist
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 需要同步的表名
|
||||
/// </summary>
|
||||
public string TableName { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// 表版本编号
|
||||
/// </summary>
|
||||
public int RevisionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 同步类型
|
||||
/// </summary>
|
||||
public string? SyncType { get; set; }
|
||||
}
|
||||
31
WebAPIServer/Models/TblUtsManageTestplantip.cs
Normal file
31
WebAPIServer/Models/TblUtsManageTestplantip.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageTestplantip
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列名
|
||||
/// </summary>
|
||||
public string? ColName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列类型
|
||||
/// </summary>
|
||||
public string? ColType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列描述
|
||||
/// </summary>
|
||||
public string? ColDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认值
|
||||
/// </summary>
|
||||
public string? ColValue { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
82
WebAPIServer/Models/TblUtsManageUser.cs
Normal file
82
WebAPIServer/Models/TblUtsManageUser.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 用户列表
|
||||
/// </summary>
|
||||
public partial class TblUtsManageUser
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属公司ID
|
||||
/// </summary>
|
||||
public int CompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信账号
|
||||
/// </summary>
|
||||
public string? WeiXin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
public bool IsValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为管理员 默认是0 管理员为1
|
||||
/// </summary>
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码登陆
|
||||
/// </summary>
|
||||
public string? BarCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置条码权限
|
||||
/// </summary>
|
||||
public bool SetBarCode { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置结单权限
|
||||
/// </summary>
|
||||
public bool AccountBill { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码明文
|
||||
/// </summary>
|
||||
public string? PlaintextPwd { get; set; }
|
||||
}
|
||||
82
WebAPIServer/Models/TblUtsManageUser20230712.cs
Normal file
82
WebAPIServer/Models/TblUtsManageUser20230712.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 用户列表
|
||||
/// </summary>
|
||||
public partial class TblUtsManageUser20230712
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所属公司ID
|
||||
/// </summary>
|
||||
public int CompanyId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码
|
||||
/// </summary>
|
||||
public string? Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号码
|
||||
/// </summary>
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 微信账号
|
||||
/// </summary>
|
||||
public string? WeiXin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否有效
|
||||
/// </summary>
|
||||
public bool IsValid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否为管理员 默认是0 管理员为1
|
||||
/// </summary>
|
||||
public bool IsAdmin { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 条码登陆
|
||||
/// </summary>
|
||||
public string? BarCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置条码权限
|
||||
/// </summary>
|
||||
public bool SetBarCode { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设置结单权限
|
||||
/// </summary>
|
||||
public bool AccountBill { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码明文
|
||||
/// </summary>
|
||||
public string? PlaintextPwd { get; set; }
|
||||
}
|
||||
55
WebAPIServer/Models/TblUtsManageUserauthOperation.cs
Normal file
55
WebAPIServer/Models/TblUtsManageUserauthOperation.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
/// <summary>
|
||||
/// 用户厂家权限
|
||||
/// </summary>
|
||||
public partial class TblUtsManageUserauthOperation
|
||||
{
|
||||
/// <summary>
|
||||
/// 索引,无作用
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户索引
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库索引
|
||||
/// </summary>
|
||||
public int DatabaseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库名称
|
||||
/// </summary>
|
||||
public string? DatabaseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有完整权限功能索引,用逗号分隔
|
||||
/// </summary>
|
||||
public string? FullAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有读写权限功能索引,用逗号分隔
|
||||
/// </summary>
|
||||
public string? ReadWriteAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有只读权限功能索引,用逗号分隔
|
||||
/// </summary>
|
||||
public string? ReadOnlyAccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有机型权限索引,用逗号分隔
|
||||
/// </summary>
|
||||
public string? ReadProject { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 拥有管理权限索引,用逗号分隔
|
||||
/// </summary>
|
||||
public string? ManagerAccess { get; set; }
|
||||
}
|
||||
234
WebAPIServer/Models/TblUtsManageUtscmdlist.cs
Normal file
234
WebAPIServer/Models/TblUtsManageUtscmdlist.cs
Normal file
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManageUtscmdlist
|
||||
{
|
||||
/// <summary>
|
||||
/// 命令索引
|
||||
/// </summary>
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命令类型
|
||||
/// </summary>
|
||||
public string? CmdType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命令名称
|
||||
/// </summary>
|
||||
public string? CmdName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命令说明
|
||||
/// </summary>
|
||||
public string? CmdDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命令参数总数
|
||||
/// </summary>
|
||||
public string? ParamCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明1
|
||||
/// </summary>
|
||||
public string? ParamDesc1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明2
|
||||
/// </summary>
|
||||
public string? ParamDesc2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明3
|
||||
/// </summary>
|
||||
public string? ParamDesc3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明4
|
||||
/// </summary>
|
||||
public string? ParamDesc4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明5
|
||||
/// </summary>
|
||||
public string? ParamDesc5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明6
|
||||
/// </summary>
|
||||
public string? ParamDesc6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明7
|
||||
/// </summary>
|
||||
public string? ParamDesc7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数说明8
|
||||
/// </summary>
|
||||
public string? ParamDesc8 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型1
|
||||
/// </summary>
|
||||
public string? ParamType1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型2
|
||||
/// </summary>
|
||||
public string? ParamType2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型3
|
||||
/// </summary>
|
||||
public string? ParamType3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型4
|
||||
/// </summary>
|
||||
public string? ParamType4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型5
|
||||
/// </summary>
|
||||
public string? ParamType5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型6
|
||||
/// </summary>
|
||||
public string? ParamType6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型7
|
||||
/// </summary>
|
||||
public string? ParamType7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数类型8
|
||||
/// </summary>
|
||||
public string? ParamType8 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限1
|
||||
/// </summary>
|
||||
public string? ParamLower1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限2
|
||||
/// </summary>
|
||||
public string? ParamLower2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限3
|
||||
/// </summary>
|
||||
public string? ParamLower3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限4
|
||||
/// </summary>
|
||||
public string? ParamLower4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限5
|
||||
/// </summary>
|
||||
public string? ParamLower5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限6
|
||||
/// </summary>
|
||||
public string? ParamLower6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限7
|
||||
/// </summary>
|
||||
public string? ParamLower7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数下限8
|
||||
/// </summary>
|
||||
public string? ParamLower8 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限1
|
||||
/// </summary>
|
||||
public string? ParamUpper1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限2
|
||||
/// </summary>
|
||||
public string? ParamUpper2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限3
|
||||
/// </summary>
|
||||
public string? ParamUpper3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限4
|
||||
/// </summary>
|
||||
public string? ParamUpper4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限5
|
||||
/// </summary>
|
||||
public string? ParamUpper5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限6
|
||||
/// </summary>
|
||||
public string? ParamUpper6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限7
|
||||
/// </summary>
|
||||
public string? ParamUpper7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数上限8
|
||||
/// </summary>
|
||||
public string? ParamUpper8 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值1
|
||||
/// </summary>
|
||||
public string? ParamValue1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值2
|
||||
/// </summary>
|
||||
public string? ParamValue2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值3
|
||||
/// </summary>
|
||||
public string? ParamValue3 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值4
|
||||
/// </summary>
|
||||
public string? ParamValue4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值5
|
||||
/// </summary>
|
||||
public string? ParamValue5 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值6
|
||||
/// </summary>
|
||||
public string? ParamValue6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值7
|
||||
/// </summary>
|
||||
public string? ParamValue7 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数默认值8
|
||||
/// </summary>
|
||||
public string? ParamValue8 { get; set; }
|
||||
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
}
|
||||
26
WebAPIServer/Models/TblUtsManangeUseronlinelog.cs
Normal file
26
WebAPIServer/Models/TblUtsManangeUseronlinelog.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsManangeUseronlinelog
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名字
|
||||
/// </summary>
|
||||
public string? UserNames { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ip地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 1是在线 0不在线
|
||||
/// </summary>
|
||||
public int? State { get; set; }
|
||||
|
||||
public DateTime? CreationTime { get; set; }
|
||||
}
|
||||
49
WebAPIServer/Models/TblUtsUseroperation.cs
Normal file
49
WebAPIServer/Models/TblUtsUseroperation.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace WebAPIServer.Models;
|
||||
|
||||
public partial class TblUtsUseroperation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名字
|
||||
/// </summary>
|
||||
public string? UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ip地址
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器版本
|
||||
/// </summary>
|
||||
public string? Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
/// </summary>
|
||||
public string? Operation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 选择的数据库
|
||||
/// </summary>
|
||||
public string? Database { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 设备型号
|
||||
/// </summary>
|
||||
public string? Device { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地理位置
|
||||
/// </summary>
|
||||
public string? Location { get; set; }
|
||||
}
|
||||
1220
WebAPIServer/Models/UtsManageContext.cs
Normal file
1220
WebAPIServer/Models/UtsManageContext.cs
Normal file
File diff suppressed because it is too large
Load Diff
89
WebAPIServer/Program.cs
Normal file
89
WebAPIServer/Program.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
using System.Text;
|
||||
using WebAPIServer.Common;
|
||||
|
||||
namespace WebAPIServer
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public record STU(string nnn, string bbb);
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddMemoryCache();
|
||||
builder.Services.AddControllers();
|
||||
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: "Vue3",
|
||||
policy =>
|
||||
{
|
||||
//policy.WithOrigins("http://localhost:5180",
|
||||
// "http://localhost:8809/",
|
||||
// "http://www.contoso.com",
|
||||
// "http://new.uts-data.com:6688/", "http://new.uts-data.com")
|
||||
policy
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyHeader()
|
||||
.AllowAnyMethod();
|
||||
});
|
||||
});
|
||||
|
||||
builder.Services.AddAuthorization();
|
||||
builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
|
||||
.AddJwtBearer(option =>
|
||||
{
|
||||
var sec = Encoding.UTF8.GetBytes(builder.Configuration["JWT:SecretKey"]);
|
||||
|
||||
option.TokenValidationParameters = new Microsoft.IdentityModel.Tokens.TokenValidationParameters()
|
||||
{
|
||||
ValidateIssuer = true,
|
||||
ValidateAudience = true,
|
||||
ValidateLifetime = true,
|
||||
|
||||
ValidateIssuerSigningKey = true,
|
||||
ValidIssuer = builder.Configuration["JwT:Issuer"],
|
||||
ValidAudience = builder.Configuration["JwT:Audience"],
|
||||
IssuerSigningKey = new SymmetricSecurityKey(sec)
|
||||
};
|
||||
|
||||
//option.Events = new JwtBearerEvents
|
||||
//{
|
||||
// OnMessageReceived = context =>
|
||||
// {
|
||||
// var token = context.Request.Headers["token"].FirstOrDefault();
|
||||
// if (string.IsNullOrEmpty(token))
|
||||
// {
|
||||
// // <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD> token ͷ<><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Authorization ͷ<><CDB7>
|
||||
// token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();
|
||||
// }
|
||||
// // <20><><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD> token<65><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> HttpContext <20><>
|
||||
// if (!string.IsNullOrEmpty(token))
|
||||
// {
|
||||
// context.Token = token;
|
||||
// }
|
||||
// return Task.CompletedTask;
|
||||
// }
|
||||
//};
|
||||
});
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
app.UseCors("Vue3");
|
||||
|
||||
app.UseAuthentication(); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||||
app.UseAuthorization(); // ʹ<><CAB9><EFBFBD><EFBFBD>Ȩ<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
StaticData.GetWebAPIMethod();
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
22
WebAPIServer/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
22
WebAPIServer/Properties/PublishProfiles/FolderProfile.pubxml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>true</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>false</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net8.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<_TargetId>Folder</_TargetId>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||
<ProjectGuid>a9d49d8f-14c1-413e-ab94-87cf21f0b3b8</ProjectGuid>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\Project\AUTS_New\WebAPIServer\bin\Release\net8.0\publish\</_PublishTargetUrl>
|
||||
<History>True|2025-08-28T09:10:06.0215159Z||;True|2025-08-27T20:08:53.7448405+08:00||;True|2025-08-27T09:30:37.1012354+08:00||;True|2025-08-19T18:15:37.7913274+08:00||;True|2025-08-19T17:20:58.7412452+08:00||;True|2025-08-19T15:55:20.9527200+08:00||;True|2025-04-07T19:28:10.1279229+08:00||;True|2025-03-31T11:42:19.8860538+08:00||;True|2025-03-29T17:38:19.1679458+08:00||;True|2025-03-28T19:10:51.5374819+08:00||;True|2025-03-28T17:57:42.2820238+08:00||;True|2025-03-21T17:12:53.2430355+08:00||;False|2025-03-21T17:12:26.4177469+08:00||;True|2025-03-18T15:58:56.0927860+08:00||;True|2025-03-18T15:57:00.4917451+08:00||;True|2025-03-18T15:55:00.3530973+08:00||;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
31
WebAPIServer/Properties/launchSettings.json
Normal file
31
WebAPIServer/Properties/launchSettings.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "http://json.schemastore.org/launchsettings.json",
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:23553",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"http": {
|
||||
"commandName": "Project",
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"applicationUrl": "http://localhost:5135",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "weatherforecast",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
76
WebAPIServer/ScriptConfig/webapi.py
Normal file
76
WebAPIServer/ScriptConfig/webapi.py
Normal file
@@ -0,0 +1,76 @@
|
||||
## 查询公司名称
|
||||
methodlists="SELECT * FROM `tbl_uts_manage_company` where ID=@ID;"
|
||||
## 获取数据库表
|
||||
getDbName="SHOW DATABASES;"
|
||||
getCompany = "SELECT CustomerName FROM `tbl_uts_manage_company`;"
|
||||
## 获取@TBName数据库表结构
|
||||
getTable = '''
|
||||
USE @DBName ;
|
||||
SELECT
|
||||
COLUMN_NAME AS 'name',
|
||||
DATA_TYPE AS 'type',
|
||||
COLUMN_COMMENT AS 'notes',
|
||||
CHARACTER_MAXIMUM_LENGTH AS 'long'
|
||||
FROM
|
||||
INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE
|
||||
TABLE_SCHEMA = '@DBName'
|
||||
AND TABLE_NAME = '@TBName'
|
||||
ORDER BY
|
||||
TABLE_NAME,
|
||||
ORDINAL_POSITION;
|
||||
'''
|
||||
## 添加@TBName数据库表字段
|
||||
addTable = '''
|
||||
USE @dbName;
|
||||
ALTER TABLE @TBName
|
||||
ADD COLUMN @name @type@long COMMENT '@notes';
|
||||
'''
|
||||
## 修改@TBName数据库表字段
|
||||
updateTable = '''
|
||||
USE @dbName;
|
||||
ALTER TABLE @TBName
|
||||
CHANGE COLUMN @oldName @name @type@long COMMENT '@notes';
|
||||
'''
|
||||
## 删除@TBName数据库表字段
|
||||
deleteTable = '''
|
||||
USE @dbName;
|
||||
ALTER TABLE @TBName DROP COLUMN @name;
|
||||
'''
|
||||
|
||||
## 查询tbl_uts_useroperation表数据
|
||||
getLoginLogCount = "SELECT MAX(ID) AS LogCount FROM uts_manage.tbl_uts_useroperation;"
|
||||
def getLoginLog(last_id = ""):
|
||||
# 如果没有提供last_id,则查询最新的25条记录
|
||||
if last_id == "":
|
||||
SQL1 = f"SELECT * FROM uts_manage.tbl_uts_useroperation ORDER BY ID DESC LIMIT 25;"
|
||||
return SQL1
|
||||
else:
|
||||
# 如果提供了last_id,则从该ID之后查询最新的25条记录
|
||||
SQL2 = f"SELECT * FROM uts_manage.tbl_uts_useroperation WHERE ID < {last_id} ORDER BY ID DESC LIMIT 25;"
|
||||
return SQL2
|
||||
|
||||
|
||||
## 查询utsTestLog数据
|
||||
## 查询机型列表
|
||||
getModelList = '''
|
||||
SELECT * FROM @dbName.tbl_project WHERE IsValid = TRUE;
|
||||
'''
|
||||
## 查询站位列表
|
||||
getStationList = '''
|
||||
SELECT * FROM @dbName.tbl_stationlist WHERE ProjectID = @ProjectID AND IsValid = TRUE ORDER BY ArtworkOrder;
|
||||
'''
|
||||
## 查询测试机台列表
|
||||
getTestDeviceList = '''
|
||||
SELECT * FROM uts_manage.tbl_uts_manage_dataservicelist AS ser
|
||||
WHERE ID IN (SELECT log.ServiceID FROM @dbName.@tbName AS log GROUP BY log.ServiceID) AND ser.ServiceValid = TRUE;
|
||||
'''
|
||||
## 查询错误步骤列表
|
||||
getFailStepsList = '''
|
||||
SELECT FailSteps FROM @dbName.@tbName WHERE FailSteps IS NOT NULL AND FailSteps != '' GROUP BY FailSteps;
|
||||
'''
|
||||
##查询筛选字段列表
|
||||
getColumnNameList = '''
|
||||
SHOW COLUMNS FROM @dbName.@tbName
|
||||
WHERE Field NOT IN ('ID', 'ServiceID', 'StartTime', 'DUT_SN', 'TestResult', 'Failsteps');
|
||||
'''
|
||||
13
WebAPIServer/WeatherForecast.cs
Normal file
13
WebAPIServer/WeatherForecast.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
namespace WebAPIServer
|
||||
{
|
||||
public class WeatherForecast
|
||||
{
|
||||
public DateOnly Date { get; set; }
|
||||
|
||||
public int TemperatureC { get; set; }
|
||||
|
||||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
|
||||
|
||||
public string? Summary { get; set; }
|
||||
}
|
||||
}
|
||||
51
WebAPIServer/WebAPIServer.csproj
Normal file
51
WebAPIServer/WebAPIServer.csproj
Normal file
@@ -0,0 +1,51 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||
<PackageReference Include="IronPython" Version="3.4.2" />
|
||||
<PackageReference Include="IronPython.StdLib" Version="3.4.2" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.14" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.14">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.14" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.14">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
|
||||
<PackageReference Include="NLog" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Extensions.Logging" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Schema" Version="5.4.0" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="5.4.0" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
|
||||
<PackageReference Include="RestSharp" Version="112.1.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.116.1" />
|
||||
<PackageReference Include="UAParser.Core" Version="4.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ViewModels\ViewModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="ScriptConfig\webapi.py">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
6
WebAPIServer/WebAPIServer.http
Normal file
6
WebAPIServer/WebAPIServer.http
Normal file
@@ -0,0 +1,6 @@
|
||||
@WebAPIServer_HostAddress = http://localhost:5135
|
||||
|
||||
GET {{WebAPIServer_HostAddress}}/weatherforecast/
|
||||
Accept: application/json
|
||||
|
||||
###
|
||||
12
WebAPIServer/app.json
Normal file
12
WebAPIServer/app.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
//redis
|
||||
"session_expire_minutes": "5",
|
||||
"redis_server_session": "127.0.0.1:6379",
|
||||
"redis_max_read_pool": "1000",
|
||||
"redis_max_write_pool": "1000",
|
||||
|
||||
"MQTT_ServerIP": "120.24.73.62",
|
||||
"MQTT_ServerPort": 1883,
|
||||
"MQTT_User": "blw",
|
||||
"MQTT_PWD": "blw@1234"
|
||||
}
|
||||
8
WebAPIServer/appsettings.Development.json
Normal file
8
WebAPIServer/appsettings.Development.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
14
WebAPIServer/appsettings.json
Normal file
14
WebAPIServer/appsettings.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"JwT": {
|
||||
"SecretKey": "abcdefereworu3294378472386^&^$RT#GHJFGJEUIHGFJKDFGHKDJSFSDKg",
|
||||
"Issuer": "AD>706,&L?$38oO#3N#E8@,742vyyd",
|
||||
"Audience": "W*u93xxp*08DnW@%6}5Tjh6bE?;hW"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
35
WebAPIServer/nlog.config
Normal file
35
WebAPIServer/nlog.config
Normal file
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<!-- enable asp.net core layout renderers -->
|
||||
<targets>
|
||||
<!--项目日志保存文件路径说明fileName="${basedir}/保存目录,以年月日的格式创建/${shortdate}/${记录器名称}-${单级记录}-${shortdate}.txt"-->
|
||||
<target name="info_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/info_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/info_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
<target name="error_file" xsi:type="File"
|
||||
fileName="${basedir}/Logs/${shortdate}/error_${shortdate}.txt"
|
||||
layout="${longdate}|${level:uppercase=true}|${logger}|${message}|${exception:format=ToString} ${newline} ${stacktrace} ${newline}"
|
||||
archiveFileName="${basedir}/archives/error_${shortdate}-{#####}.txt"
|
||||
archiveAboveSize="102400"
|
||||
archiveNumbering="Sequence"
|
||||
concurrentWrites="true"
|
||||
keepFileOpen="false" />
|
||||
</targets>
|
||||
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--规则配置,final - 最终规则匹配后不处理任何规则-->
|
||||
<!--定义使用哪个target输出-->
|
||||
<rules>
|
||||
<!-- 优先级从高到低依次为:OFF、FATAL、ERROR、WARN、INFO、DEBUG、TRACE、 ALL -->
|
||||
<!-- 将所有日志输出到文件 -->
|
||||
<logger name="*" minlevel="FATAL" maxlevel="FATAL" writeTo="info_file" />
|
||||
<logger name="*" minlevel="ERROR" maxlevel="ERROR" writeTo="error_file" />
|
||||
</rules>
|
||||
</nlog>
|
||||
Reference in New Issue
Block a user