初始化项目

This commit is contained in:
2025-11-20 09:50:21 +08:00
commit 94b24e1a5d
4209 changed files with 1570805 additions and 0 deletions

View File

@@ -0,0 +1,117 @@
using System;
using System.Web.Mvc;
using Services.Cache;
using Services.Manager;
using UI.Controllers;
using System.Linq;
using Services.Extensions;
using Newtonsoft.Json;
using Services.Tool;
using Models.ModelItems;
using Models;
using UH_CENTER;
public class HomeController : BaseController
{
public HomeController()
{
base.ViewBag.Select = 0;
}
#region <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD>Ϣ
public ActionResult Index()
{
try
{
return View();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
HttpContext.Response.StatusCode = 500;
return null;
}
}
#endregion
#region <EFBFBD>û<EFBFBD>Ȩ<EFBFBD>޹<EFBFBD><EFBFBD><EFBFBD>
public ActionResult UAuthority(string id)
{
try
{
ViewBag.Appversions = CacheHelp.cacheAppversions;
//<2F>û<EFBFBD>Ȩ<EFBFBD><C8A8>
var info = CacheHelp.cacheSysUserInfo.FirstOrDefault(x => x.Uid.TrimEnd().ToLower() == id.TrimEnd().ToLower());
if (info == null)
throw new CustomException("<22><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>~");
ViewBag.info = info;
ViewBag.HotelList = JsonConvert.SerializeObject(
UH_CENTER_Help.Sel_Hotel(info).Select(X=>X.id)
);
return View();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
HttpContext.Response.StatusCode = 500;
return null;
}
}
#endregion
#region <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>
public ActionResult AddUser()
{
try
{
ViewBag.publicYS = (Session["ras"] as Services.Tool.RSA).ToPEM().ToPEM_PKCS8(convertToPublic: true).Replace("\r\n", "")
.Replace(Convert.ToChar(10).ToString(), "")
.Replace(Convert.ToChar(13).ToString(), "") ?? throw new Exception();
return View();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
return Content(ex.Message);
}
}
#endregion
#region <EFBFBD>޸<EFBFBD><EFBFBD>û<EFBFBD>
public ActionResult EditUser(int id)
{
try
{
var userinfo = CacheHelp.cacheSysUserInfo.FirstOrDefault(x => x.Id == id);
if (userinfo == null || (Umodel.IsValid <= userinfo.IsValid && Umodel.Id != 1 && Umodel.Uid != userinfo.Uid))
throw new CustomException("<22><>Ȩ<EFBFBD><C8A8><EFBFBD>ʣ<EFBFBD>");
ViewBag.Uinfo = userinfo;
RSA rSA = new RSA(512);
base.Session["ras"] = rSA;
ViewBag.publicYS = (Session["ras"] as Services.Tool.RSA).ToPEM().ToPEM_PKCS8(convertToPublic: true).Replace("\r\n", "")
.Replace(Convert. ToChar(10).ToString(), "")
.Replace(Convert.ToChar(13).ToString(), "") ?? throw new Exception();
return View();
}
catch (Exception ex)
{
LogHelp.WriteExceptionLog(ex);
HttpContext.Response.StatusCode = 500;
return null;
}
}
#endregion
public ActionResult IndexInfo(string Token = "")
{
if (!string.IsNullOrEmpty(Token))
{
string Ip = IPHelper.GetIP();
var userinfo = RedisHelper.StringGet<UserInfo>(Token + Ip);
RedisHelper.RemoveKey(Token + Ip);
}
base.ViewBag.Select = -1;
base.ViewBag.LogData = SqlSugarBase.Db.Ado.SqlQuery<DbLog>("SELECT * FROM DbLog ORDER BY ID DESC limit 1, 50").ToList();
//CacheHelp.Removesys(CacheHelp.syskey.sysDbLogListKey);
//ViewBag.LogData =
//CacheHelp.cacheDbLogs.OrderByDescending(x => x.Id).Take(50).ToList();
return View();
}
}