初始化
This commit is contained in:
174
Face.Web/Areas/App/Controllers/BaseController.cs
Normal file
174
Face.Web/Areas/App/Controllers/BaseController.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using Face.Domain.Entities;
|
||||
using Face.Services;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Services.Enums;
|
||||
using Face.Services.Extensions;
|
||||
using Face.Services.Manager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using Face.Web.Areas.App.Models;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class BaseController : Controller
|
||||
{
|
||||
public Accountentity Umodel { get; set; }
|
||||
public object ActPacket { get; set; }
|
||||
public string ActMessage { get; set; }
|
||||
|
||||
public string ActType { get; set; }
|
||||
|
||||
public int ActLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 在Action方法调用前使用,使用场景:如何验证登录等。
|
||||
/// </summary>
|
||||
/// <param name="filterContext"></param>
|
||||
protected override void OnActionExecuting(ActionExecutingContext filterContext)
|
||||
{
|
||||
practical practical = new practical();
|
||||
try
|
||||
{
|
||||
base.OnActionExecuting(filterContext);
|
||||
if (Session["username"] == null)
|
||||
{
|
||||
Logs.WriteLog("Sessionkeys:" + JsonConvert.SerializeObject(Session.Keys));
|
||||
filterContext.Result = new RedirectResult("/App/Login/Index");
|
||||
}
|
||||
else
|
||||
{
|
||||
Logs.WriteLog("username:" + JsonConvert.SerializeObject(Session["username"]));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
//throw;
|
||||
}
|
||||
|
||||
|
||||
//校验用户是否已经登录
|
||||
//var model = UserLoginHelper.CurrentUser();
|
||||
//if (model != null)
|
||||
//{
|
||||
// //var db = new Uts_ManageEntities();
|
||||
// //Umodel = db.TBL_UTS_Manage_UserList.SingleOrDefault(x => x.ID == model.ID);
|
||||
// Umodel = model;
|
||||
|
||||
// if ((Umodel.IsValid)==1)
|
||||
// //if (Umodel.IsActivation!=true)
|
||||
// {
|
||||
// Response.Redirect("/App/Login/Index");
|
||||
// filterContext.Result = new EmptyResult();
|
||||
// }
|
||||
|
||||
// if (!string.IsNullOrEmpty(ActType))
|
||||
// {
|
||||
// }
|
||||
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// ContentResult Cr = new ContentResult
|
||||
// {
|
||||
// Content = string.Format("<script type='text/javascript'>top.location.hre f='{0}';</script>", "/App/Login/Index")
|
||||
// };
|
||||
// filterContext.Result = Cr;
|
||||
|
||||
// //Response.Redirect("/App/Login/Index");
|
||||
// //filterContext.Result = new EmptyResult();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在Action方法调用后,result方法调用前执行,使用场景:异常处理。
|
||||
/// </summary>
|
||||
/// <param name="filterContext"></param>
|
||||
//protected override void OnActionExecuted(ActionExecutedContext filterContext)
|
||||
//{
|
||||
// base.OnActionExecuted(filterContext);
|
||||
// ViewBag.Title = ActMessage;
|
||||
|
||||
|
||||
// var model = UserLoginHelper.CurrentUser();
|
||||
// if (model != null)
|
||||
// {
|
||||
// Umodel = model;
|
||||
// if (!string.IsNullOrEmpty(ActMessage))
|
||||
// {
|
||||
// string controllerName = filterContext.RouteData.Values["controller"].ToString().ToLower();
|
||||
// string actionName = filterContext.RouteData.Values["action"].ToString().ToLower();
|
||||
|
||||
// if (ViewBag.mFormUrl != null)
|
||||
// ViewBag.FormUrl = ViewBag.mFormUrl;
|
||||
// else
|
||||
// {
|
||||
// if (Request.UrlReferrer != null)
|
||||
// ViewBag.FormUrl = Request.UrlReferrer.ToString();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Response.Redirect("/App/Login/Index");
|
||||
// filterContext.Result = new EmptyResult();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
//protected NameValueCollection FormatQueryString(NameValueCollection nameValues)
|
||||
//{
|
||||
// NameValueCollection nvcollection = new NameValueCollection();
|
||||
// foreach (var item in nameValues.AllKeys)
|
||||
// {
|
||||
// if (item.Equals("datefiled"))
|
||||
// {
|
||||
// if (!String.IsNullOrEmpty(nameValues["dateform"]) && !String.IsNullOrEmpty(nameValues["dateto"]))
|
||||
// {
|
||||
// string[] sd = nameValues["dateform"].Split('/');
|
||||
// string[] ed = nameValues["dateto"].Split('/');
|
||||
// string sd2 = sd[2] + "-" + sd[0] + "-" + sd[1];
|
||||
// string ed2 = ed[2] + "-" + ed[0] + "-" + ed[1];
|
||||
|
||||
// //DateTime startDate = DateTime.Parse(sd2).AddSeconds(-1);
|
||||
// //DateTime endDate = DateTime.Parse(ed2).ToDateTime();
|
||||
// //nvcollection.Add(nameValues[item] + ">", startDate.ToString());
|
||||
// //nvcollection.Add(nameValues[item] + "<", endDate.ToString());
|
||||
// DateTime startDate = DateTime.Parse(sd2).ToDateTime();
|
||||
// DateTime endDate = DateTime.Parse(ed2).ToDateTime();
|
||||
// nvcollection.Add(nameValues[item] + ">=", startDate.ToString());
|
||||
// nvcollection.Add(nameValues[item] + "<=", endDate.ToString());
|
||||
// }
|
||||
// }
|
||||
// else if (item.Equals("numberfiled"))
|
||||
// {
|
||||
// if (!String.IsNullOrEmpty(nameValues["numberform"]) && !String.IsNullOrEmpty(nameValues["numberto"]))
|
||||
// {
|
||||
// //double startNumber = nameValues["numberform"].ToDouble() - 0.0001;
|
||||
// //double endNumber = nameValues["numberto"].ToDouble() + 0.0001;
|
||||
// //nvcollection.Add(nameValues[item] + ">", startNumber.ToString());
|
||||
// //nvcollection.Add(nameValues[item] + "<", endNumber.ToString());
|
||||
// double startNumber = nameValues["numberform"].ToDouble();
|
||||
// double endNumber = nameValues["numberto"].ToDouble();
|
||||
// nvcollection.Add(nameValues[item] + ">=", startNumber.ToString());
|
||||
// nvcollection.Add(nameValues[item] + "<=", endNumber.ToString());
|
||||
// }
|
||||
// }
|
||||
// else if (item.Equals("keyfiled"))
|
||||
// {
|
||||
// if (!string.IsNullOrEmpty(nameValues["keyword"]))
|
||||
// nvcollection.Add(nameValues[item], nameValues["keyword"]);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return nvcollection;
|
||||
//}
|
||||
}
|
||||
}
|
||||
120
Face.Web/Areas/App/Controllers/CheckinPmsController.cs
Normal file
120
Face.Web/Areas/App/Controllers/CheckinPmsController.cs
Normal file
@@ -0,0 +1,120 @@
|
||||
using Antlr.Runtime.Tree;
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using ImageMagick;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
using WebServer;
|
||||
using AUTS.Services.Manager;
|
||||
using Face.Domain.Application.FaceAll;
|
||||
using System.Collections;
|
||||
using static Face.Web.Areas.App.Controllers.InterfaceController;
|
||||
using CheckinTest = Face.Domain.Entities.CheckinTest;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class CheckinPmsController : Controller
|
||||
{
|
||||
// GET: App/CheckinPms
|
||||
public ActionResult Checkin()
|
||||
{
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
int id = 1;
|
||||
var roomlist= ZongRoominfo.Where(j => j.HOTEL_OLD_ID == id).ToList();
|
||||
return View(roomlist);
|
||||
}
|
||||
public ActionResult CheckinRoom(string Roomane)
|
||||
{
|
||||
ViewData["Roomane"]=Roomane;
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult Save(HttpPostedFileBase video)
|
||||
{
|
||||
// 处理上传的视频文件,保存到指定位置或进行其他处理
|
||||
if (video != null && video.ContentLength > 0)
|
||||
{
|
||||
var fileName = Path.GetFileName(video.FileName);
|
||||
var path = Path.Combine(Server.MapPath("~//Upload/Image/"), fileName);
|
||||
video.SaveAs(path);
|
||||
// 这里可以根据需要进行相应的处理,例如将视频文件保存到指定位置
|
||||
|
||||
if (video != null && video.ContentLength > 0)
|
||||
{
|
||||
byte[] fileBytes;
|
||||
using (var binaryReader = new BinaryReader(video.InputStream))
|
||||
{
|
||||
fileBytes = binaryReader.ReadBytes(video.ContentLength);
|
||||
}
|
||||
|
||||
string base64String = Convert.ToBase64String(fileBytes);
|
||||
|
||||
// 将 base64String 发送到前端或进行其他操作
|
||||
return Json(new { success = true, imgbase64String = base64String , imgpath = path });
|
||||
}
|
||||
}
|
||||
|
||||
return Json(new { success = false, imgbase64String = "", imgpath = "" });
|
||||
}
|
||||
|
||||
public ActionResult OpeningOperation(string roomid, string idNumber, string phoneNumber,string name,int sex,string phone,string picture)
|
||||
{
|
||||
string ftpURL = "auth.blv-oa.com:50/uts_Manager/oyl_FTP/Image";
|
||||
ImgServerController imgServerController = new ImgServerController();
|
||||
picture= imgServerController.FtpUploadsyn(picture, ftpURL);
|
||||
List<Result> relist = null;
|
||||
string HoteId = "1001";//测试酒店Code
|
||||
var code = int.Parse(HoteId);
|
||||
var hotellist = SqlSugarBase.authoriydb.Queryable<Hotels>().First(s => s.Code == code.ToString());
|
||||
if (hotellist == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
GetRoomInterface.test test = new GetRoomInterface.test
|
||||
{
|
||||
code = hotellist.Code.ToString(),
|
||||
creatDate = hotellist.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
Roominfo.Root asd = GetRoomInterface.Roomport(test);
|
||||
if (asd == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
if (asd.IsSuccess != true)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
relist = asd.Result;
|
||||
var sc = relist.FirstOrDefault(j => j.RoomNumber == roomid);
|
||||
if (sc == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
int state = 0;
|
||||
CheckinTest user = new CheckinTest() { testState = state, creationTime = DateTime.Now, predictCheckIn = DateTime.Now, checkInduration = 0, hotelid = hotellist.Id, Roomid = sc.ID };
|
||||
var Staty = SqlSugarBase.Db.Insertable(user).ExecuteReturnIdentity();
|
||||
bool isok = false;
|
||||
List<WebServer.UserInfo> users = new List<WebServer.UserInfo>();
|
||||
WebServer.UserInfo fo = new WebServer.UserInfo()
|
||||
{
|
||||
idcard = idNumber,
|
||||
customer = name,
|
||||
sex = sex == 1 ? "男" : "女",
|
||||
photoUrl = "http://face.blv-oa.com/ImgServer/FileImage?url=" + picture
|
||||
};
|
||||
users.Add(fo);
|
||||
isok = WebHelp.Send(new SendInfo { code = HoteId, roomNumber = roomid, idNumber = idNumber, phoneNumber = phoneNumber }, users.ToArray());
|
||||
|
||||
return Json(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
131
Face.Web/Areas/App/Controllers/ExpandController.cs
Normal file
131
Face.Web/Areas/App/Controllers/ExpandController.cs
Normal file
@@ -0,0 +1,131 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Application.FaceAll;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.DBUtility.Custom;
|
||||
using Face.Services.Manager;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class ExpandController : Controller
|
||||
{
|
||||
// GET: App/Expand
|
||||
public ActionResult ExpandIndex()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
private string connectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=Face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;";
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Expandinsert(string name, int id_no,string idcode)
|
||||
{
|
||||
tb_HotelCode face = new tb_HotelCode();
|
||||
face.UserWX = true;
|
||||
face.Code = idcode;
|
||||
face.Remark = name;
|
||||
face.HotelID = id_no;
|
||||
if (SqlSugarBase.WuDb.Insertable(face).ExecuteCommand()>0)
|
||||
{
|
||||
return Json("200");
|
||||
}
|
||||
return Json("100");
|
||||
}
|
||||
|
||||
|
||||
public ActionResult UploadingAll()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult conditionFile()
|
||||
{
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Dropdownlist(int Hoteid)
|
||||
{
|
||||
List<Result> relist = null;
|
||||
var ho = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == Hoteid);
|
||||
GetRoomInterface.test test = new GetRoomInterface.test
|
||||
{
|
||||
code = ho.Code.ToString(),
|
||||
creatDate = ho.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
Roominfo.Root asd = GetRoomInterface.Roomport(test);
|
||||
if (asd.IsSuccess == true)
|
||||
{
|
||||
|
||||
relist = asd.Result;
|
||||
return Json(new
|
||||
{
|
||||
Data = relist,
|
||||
Status=200
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(new
|
||||
{
|
||||
Data = "",
|
||||
Status = 50
|
||||
});
|
||||
}
|
||||
}
|
||||
public ActionResult Conditionfileawholelog(Condition data)
|
||||
{
|
||||
string strSql = "";
|
||||
using (MySql.Data.MySqlClient.MySqlConnection connection = new MySql.Data.MySqlClient.MySqlConnection(connectionString))
|
||||
{
|
||||
System.Data.DataSet dataSet = new System.Data.DataSet();
|
||||
strSql += "select * from fileawholelog where filetype=" + data.filetype;
|
||||
|
||||
if (data.HotelID != 0)
|
||||
{
|
||||
strSql += " and hotelid=" + data.HotelID;
|
||||
}
|
||||
if (data.roomid != 0)
|
||||
{
|
||||
strSql += " and roomid=" + data.HotelID;
|
||||
}
|
||||
string sqlnumber = strSql;
|
||||
var strCountSql = strSql.ToString();
|
||||
var countNum = new DALHelperCustom<fileawholelog>("TBL_ColorBoxList").SqlQueryGetList(strCountSql.ToString());
|
||||
if (countNum != null)
|
||||
{
|
||||
ViewBag.allpage = (countNum.Count / 20) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewBag.allpage = 0;
|
||||
}
|
||||
strSql += " ORDER BY `creationtime` DESC LIMIT " + (data.dataMin) + ",8;";
|
||||
|
||||
ViewData["tableData"] = null;
|
||||
//if (countNum[0].ID <= 0)
|
||||
// return PartialView("_NamedQueryData");
|
||||
//strSql.Append(" order by StartTime desc LIMIT " + data.Pages + ",20");
|
||||
|
||||
MySql.Data.MySqlClient.MySqlDataAdapter command = new MySql.Data.MySqlClient.MySqlDataAdapter(strSql.ToString(), connection);
|
||||
command.Fill(dataSet, "test");
|
||||
ViewData["tableDataimp"] = dataSet;
|
||||
return View();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
1803
Face.Web/Areas/App/Controllers/FaceController.cs
Normal file
1803
Face.Web/Areas/App/Controllers/FaceController.cs
Normal file
File diff suppressed because it is too large
Load Diff
45
Face.Web/Areas/App/Controllers/FaceRoomController.cs
Normal file
45
Face.Web/Areas/App/Controllers/FaceRoomController.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class FaceRoomController : Controller
|
||||
{
|
||||
[HttpPost]
|
||||
public ActionResult RoomIdbyRoom(string RoomNum, int HotelId)
|
||||
{
|
||||
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
|
||||
var HotelsList = db.Queryable<DeviceManage>().Where(x => x.HotelCode.Equals(HotelId)).ToList();
|
||||
|
||||
var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().Where(A=>A.ROOM_NUMBER.Equals(RoomNum)).ToList();
|
||||
var FaceResult = from s in tbl_room_basic_info
|
||||
join d in HotelsList on s.ROOM_OLD_ID equals d.RoomId
|
||||
select new
|
||||
{
|
||||
d.Facelid,
|
||||
d.SerialNo,
|
||||
d.CreatedDate,
|
||||
d.RoomId,
|
||||
d.Status,
|
||||
d.bindingStatus,
|
||||
//d.maintainStatus,
|
||||
maintainStatus = 0,
|
||||
s.ROOM_NUMBER
|
||||
};
|
||||
return Json(FaceResult);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
330
Face.Web/Areas/App/Controllers/GeneratePasswordController.cs
Normal file
330
Face.Web/Areas/App/Controllers/GeneratePasswordController.cs
Normal file
@@ -0,0 +1,330 @@
|
||||
using Face.Domain.Application.FaceAll;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing.Printing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.UI;
|
||||
using System.Xml.Linq;
|
||||
using static Face.Web.Areas.App.Controllers.GeneratePasswordController;
|
||||
using static Face.Web.Areas.App.Controllers.InterfaceController;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
using static System.Runtime.CompilerServices.RuntimeHelpers;
|
||||
using static WebSocketToolsConsole.Entity;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
|
||||
public class GeneratePasswordController : BaseController
|
||||
{
|
||||
|
||||
// GET: App/GeneratePassword
|
||||
public ActionResult GeneratePassword()
|
||||
{
|
||||
|
||||
return View();
|
||||
}
|
||||
public ActionResult Bing()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 页面查看人脸机key
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
public ActionResult selectSPassword(Condition data)
|
||||
{
|
||||
//List<tbl_face_key> tfk = SqlSugarBase.GesmartDb().Queryable<tbl_face_key>().ToList();
|
||||
int totalCount = 0;
|
||||
List<tbl_face_key> page = new List<tbl_face_key>();
|
||||
if (!string.IsNullOrEmpty(data.FaceName))
|
||||
{
|
||||
page = SqlSugarBase.GesmartDb().Queryable<tbl_face_key>().Where(x => x.SN == data.FaceName).ToPageList(data.Pages, 10, ref totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = SqlSugarBase.GesmartDb().Queryable<tbl_face_key>().ToPageList(data.Pages, 10, ref totalCount);
|
||||
}
|
||||
if (page.Count != 0)
|
||||
{
|
||||
ViewBag.count = page;
|
||||
ViewBag.allpage = (totalCount + 10 - 1) / 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
page = null;
|
||||
}
|
||||
return PartialView("selectSPassword");
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult AddPassword(string Sn)
|
||||
{
|
||||
tbl_face_key tfk = SqlSugarBase.GesmartDb().Queryable<tbl_face_key>().First(x => x.SN == Sn);
|
||||
tbl_face_key gettfk = new tbl_face_key();
|
||||
if (tfk != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(tfk.Key))
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
ErrCode = 3009,
|
||||
ErrMsg = "人脸机:" + Sn + "数据已经存在了,不要重复创建key,它的key是:" + tfk.Key
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
string key = AesEncryptionExample.Randomnumber();
|
||||
gettfk.Id = tfk.Id;
|
||||
gettfk.MsgID = tfk.MsgID;
|
||||
gettfk.Key = key;
|
||||
gettfk.RequstCnt = tfk.RequstCnt + 1;
|
||||
gettfk.CreateDateTime = DateTime.Now;
|
||||
gettfk.AppKey = "10001";
|
||||
gettfk.ReqType = 1;
|
||||
gettfk.SN = Sn;
|
||||
gettfk.Remark = "网页生成人脸机key";
|
||||
long unixTimestamp = (long)(DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||
gettfk.TimeStamp = unixTimestamp.ToString();
|
||||
int counts = SqlSugarBase.GesmartDb().Updateable(gettfk).Where(x => x.Id == tfk.Id).ExecuteCommand();
|
||||
if (counts > 0)
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
ErrCode = 200,
|
||||
ErrMsg = "修改成功"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
ErrCode = 3005,
|
||||
ErrMsg = "修改失败"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
}
|
||||
}
|
||||
//创建
|
||||
else
|
||||
{
|
||||
string key = AesEncryptionExample.Randomnumber();
|
||||
gettfk.Key = key;
|
||||
gettfk.RequstCnt = 1;
|
||||
gettfk.CreateDateTime = DateTime.Now;
|
||||
gettfk.AppKey = "10001";
|
||||
gettfk.ReqType = 1;
|
||||
gettfk.SN = Sn;
|
||||
gettfk.Remark = "网页生成人脸机key";
|
||||
long unixTimestamp = (long)(DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||
gettfk.TimeStamp = unixTimestamp.ToString();
|
||||
int counts = SqlSugarBase.GesmartDb().Insertable(gettfk).ExecuteCommand();
|
||||
if (counts > 0)
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
ErrCode = 200,
|
||||
ErrMsg = "添加成功"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
else
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
ErrCode = 3003,
|
||||
ErrMsg = "添加失败"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Getdata
|
||||
{
|
||||
public string MsgID { get; set; }
|
||||
public string AppKey { get; set; }
|
||||
public string Timestamp { get; set; }
|
||||
public GetContent Content { get; set; }
|
||||
}
|
||||
public class GetContent
|
||||
{
|
||||
public string HotelID { get; set; }
|
||||
public int RoomID { get; set; }
|
||||
}
|
||||
|
||||
public class returnminfo
|
||||
{
|
||||
public string MsgID { get; set; }
|
||||
public string ErrCode { get; set; }
|
||||
public string ErrMsg { get; set; }
|
||||
public maes Contents { get; set; }
|
||||
|
||||
public returnminfo()
|
||||
{
|
||||
Contents = new maes();
|
||||
}
|
||||
}
|
||||
public class maes
|
||||
{
|
||||
public string HotelID { set; get; }
|
||||
public int RoomID { set; get; }
|
||||
public string DeviceBrand { set; get; }
|
||||
public string DeviceSN { set; get; }
|
||||
public string Key { set; get; }
|
||||
}
|
||||
public class Returnmessage
|
||||
{
|
||||
|
||||
public string MsgID { get; set; }
|
||||
public string ErrCode { get; set; }
|
||||
public string ErrMsg { get; set; }
|
||||
public mages Contents { get; set; }
|
||||
|
||||
public Returnmessage()
|
||||
{
|
||||
Contents = new mages();
|
||||
}
|
||||
|
||||
}
|
||||
public class mages
|
||||
{
|
||||
public string SN { get; set; }
|
||||
public string Key { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class Alldata
|
||||
{
|
||||
public string MsgID { get; set; }
|
||||
public string AppKey { get; set; }
|
||||
public string Timestamp { get; set; }
|
||||
public Content Content { get; set; }
|
||||
|
||||
}
|
||||
public class Content
|
||||
{
|
||||
public string SN { get; set; }
|
||||
public int ReqType { get; set; }
|
||||
}
|
||||
public class AesEncryptionExample
|
||||
{
|
||||
|
||||
|
||||
public static string Getip()
|
||||
{
|
||||
string ip = "";
|
||||
|
||||
#region 获取网络ip地址
|
||||
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
|
||||
foreach (NetworkInterface networkInterface in interfaces)
|
||||
{
|
||||
IPInterfaceProperties ipProperties = networkInterface.GetIPProperties();
|
||||
UnicastIPAddressInformationCollection ipAddresses = ipProperties.UnicastAddresses;
|
||||
foreach (UnicastIPAddressInformation ipAddress in ipAddresses)
|
||||
{
|
||||
if (ipAddress.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
|
||||
if (ipAddress.Address.ToString() != "127.0.0.1")
|
||||
{
|
||||
ip = ipAddress.Address.ToString();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
return ip;
|
||||
}
|
||||
|
||||
|
||||
public static string Randomnumber()
|
||||
{
|
||||
#region 随机产生的key
|
||||
int seed = (int)DateTime.Now.Ticks;
|
||||
Random random = new Random(seed);
|
||||
long number1 = random.Next(); // 随机的第一个long类型数字
|
||||
long number2 = random.Next(); // 随机的第二个long类型数字
|
||||
byte[] bytes1 = BitConverter.GetBytes(number1);
|
||||
byte[] bytes2 = BitConverter.GetBytes(number2);
|
||||
byte[] resultBytes = new byte[8];
|
||||
Buffer.BlockCopy(bytes1, 0, resultBytes, 0, 4); // 将第一个long的4个字节复制到结果数组
|
||||
Buffer.BlockCopy(bytes2, 0, resultBytes, 4, 4); // 将第二个long的4个字节复制到结果数组
|
||||
string result = BitConverter.ToString(resultBytes).Replace("-", string.Empty);
|
||||
return result;
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// AES 加密
|
||||
/// </summary>
|
||||
/// <param name="str">明文(待加密)</param>
|
||||
/// <param name="key">密文</param>
|
||||
/// <returns></returns>
|
||||
public static string AesEncrypt(string str, string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return null;
|
||||
Byte[] toEncryptArray = Encoding.UTF8.GetBytes(str);
|
||||
|
||||
RijndaelManaged rm = new RijndaelManaged
|
||||
{
|
||||
Key = Encoding.UTF8.GetBytes(key),
|
||||
Mode = CipherMode.ECB,
|
||||
Padding = PaddingMode.PKCS7
|
||||
};
|
||||
|
||||
ICryptoTransform cTransform = rm.CreateEncryptor();
|
||||
Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
||||
return Convert.ToBase64String(resultArray);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AES 解密
|
||||
/// </summary>
|
||||
/// <param name="str">明文(待解密)</param>
|
||||
/// <param name="key">密文</param>
|
||||
/// <returns></returns>
|
||||
public static string AesDecrypt(string str, string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str)) return null;
|
||||
Byte[] toEncryptArray = Convert.FromBase64String(str);
|
||||
|
||||
RijndaelManaged rm = new RijndaelManaged
|
||||
{
|
||||
Key = Encoding.UTF8.GetBytes(key),
|
||||
Mode = CipherMode.ECB,
|
||||
Padding = PaddingMode.PKCS7
|
||||
};
|
||||
|
||||
ICryptoTransform cTransform = rm.CreateDecryptor();
|
||||
Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
|
||||
|
||||
return Encoding.UTF8.GetString(resultArray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
1059
Face.Web/Areas/App/Controllers/GroupController.cs
Normal file
1059
Face.Web/Areas/App/Controllers/GroupController.cs
Normal file
File diff suppressed because it is too large
Load Diff
205
Face.Web/Areas/App/Controllers/HomeController.cs
Normal file
205
Face.Web/Areas/App/Controllers/HomeController.cs
Normal file
@@ -0,0 +1,205 @@
|
||||
using AUTS.Services.Manager;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.Cache;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.Remoting.Lifetime;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class HomeController : BaseController
|
||||
{
|
||||
// GET: App/Home
|
||||
public ActionResult Index()
|
||||
{
|
||||
ViewBag.errorcout = GetErrorcount();
|
||||
|
||||
return View();
|
||||
}
|
||||
public ActionResult SetCustomerID(int customerID)
|
||||
{
|
||||
//返回实体
|
||||
ReturnResult result = new ReturnResult();
|
||||
|
||||
#region 变更缓存
|
||||
//System.Web.HttpContext.Current.Session[onUserOperationSessionName] = customerID;
|
||||
|
||||
//CacheHelp.GetUserOperation(Umodel.UserName, customerID);
|
||||
|
||||
#endregion
|
||||
|
||||
result.Status = 200;
|
||||
result.Message = "变更数据库成功";
|
||||
return Json(result);
|
||||
}
|
||||
|
||||
public int GetErrorcount()
|
||||
{
|
||||
List<errormessagehandling> pmsinfo = SqlSugarBase.Db.Queryable<errormessagehandling>().ToList();
|
||||
|
||||
return pmsinfo.Count();
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult closeProcess(Condition data)
|
||||
{
|
||||
//LogHelp.WriteExceptionLog("");
|
||||
Logs.WriteLog("重启服务");
|
||||
string art = process.GetProcessKill();
|
||||
return Json("closeProcess");
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult openProcess(Condition data)
|
||||
{
|
||||
process.GetProcess();
|
||||
return Json("openProcess");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
public static class process
|
||||
{
|
||||
//开启进程方法
|
||||
public static string GetProcess()
|
||||
{
|
||||
//找到所有进程
|
||||
Process[] ps = Process.GetProcesses();
|
||||
DataTable ProcessTable = new DataTable();
|
||||
ProcessTable.Columns.Add("Name", typeof(string));
|
||||
ProcessTable.Columns.Add("Start Time", typeof(DateTime));
|
||||
ProcessTable.Columns.Add("CPU %", typeof(TimeSpan));
|
||||
ProcessTable.Columns.Add("Threads", typeof(string));
|
||||
ProcessTable.Columns.Add("Session ID", typeof(int));
|
||||
ProcessTable.Columns.Add("Unique ID", typeof(int));
|
||||
ProcessTable.Columns.Add("RAM", typeof(float));
|
||||
ProcessTable.Columns.Add("Machine", typeof(string));
|
||||
ProcessTable.Columns.Add("Priority", typeof(int));
|
||||
foreach (Process Process in ps)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//找到具有指定名称的进程
|
||||
// 换成你的exe名字 去掉exe
|
||||
if (!Process.ProcessName.ToUpper().Contains("TESTWEBSOCKET"))
|
||||
continue;
|
||||
string pName = Process.ProcessName;
|
||||
DateTime pStartTime = Process.StartTime;
|
||||
TimeSpan pProcTime = Process.TotalProcessorTime;
|
||||
string pThreads = Process.Threads.ToString();
|
||||
int pSessionId = Process.SessionId;
|
||||
int pId = Process.Id;
|
||||
long pRam = Process.VirtualMemorySize64;
|
||||
string pMachineName = Process.MachineName;
|
||||
int pPriority = Process.BasePriority;
|
||||
//杀死进程
|
||||
Process.Kill();
|
||||
ProcessTable.Rows.Add(pName
|
||||
, pStartTime
|
||||
, pProcTime
|
||||
, pThreads
|
||||
, pSessionId
|
||||
, pId
|
||||
, pRam
|
||||
, pMachineName
|
||||
, pPriority);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
// 换成你的exe路径
|
||||
//Process.Start(@"C:\FaceConsole\bin6\Release\TestWebSocket.exe");
|
||||
Process.Start(@"D:\NewGitRepos\TestWebSocket\TestWebSocket\bin\Release\TestWebSocket.exe");
|
||||
return JsonConvert.SerializeObject(ProcessTable);
|
||||
}
|
||||
/// <summary>
|
||||
/// 关闭进程
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetProcessKill()
|
||||
{
|
||||
try
|
||||
{
|
||||
//找到所有进程
|
||||
Process[] ps = Process.GetProcesses();
|
||||
DataTable ProcessTable = new DataTable();
|
||||
ProcessTable.Columns.Add("Name", typeof(string));
|
||||
ProcessTable.Columns.Add("Start Time", typeof(DateTime));
|
||||
ProcessTable.Columns.Add("CPU %", typeof(TimeSpan));
|
||||
ProcessTable.Columns.Add("Threads", typeof(string));
|
||||
ProcessTable.Columns.Add("Session ID", typeof(int));
|
||||
ProcessTable.Columns.Add("Unique ID", typeof(int));
|
||||
ProcessTable.Columns.Add("RAM", typeof(float));
|
||||
ProcessTable.Columns.Add("Machine", typeof(string));
|
||||
ProcessTable.Columns.Add("Priority", typeof(int));
|
||||
foreach (Process Process in ps)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//找到具有指定名称的进程
|
||||
// 换成你的exe名字 去掉exe
|
||||
if (!Process.ProcessName.ToUpper().Contains("FACESTEST"))
|
||||
continue;
|
||||
string pName = Process.ProcessName;
|
||||
DateTime pStartTime = Process.StartTime;
|
||||
TimeSpan pProcTime = Process.TotalProcessorTime;
|
||||
string pThreads = Process.Threads.ToString();
|
||||
int pSessionId = Process.SessionId;
|
||||
int pId = Process.Id;
|
||||
long pRam = Process.VirtualMemorySize64;
|
||||
string pMachineName = Process.MachineName;
|
||||
int pPriority = Process.BasePriority;
|
||||
//杀死进程
|
||||
Process.Kill();
|
||||
ProcessTable.Rows.Add(pName
|
||||
, pStartTime
|
||||
, pProcTime
|
||||
, pThreads
|
||||
, pSessionId
|
||||
, pId
|
||||
, pRam
|
||||
, pMachineName
|
||||
, pPriority);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logs.WriteLog("重启服务错误" + e);
|
||||
}
|
||||
}
|
||||
// 换成你的exe路径
|
||||
|
||||
Process.Start(@"C:\FaceTest\bin\Release\FacesTest.exe");
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logs.WriteLog(e.ToString());
|
||||
}
|
||||
|
||||
|
||||
return JsonConvert.SerializeObject("ok");
|
||||
}
|
||||
|
||||
//Process.Start(@"D:\NewGitRepos\TestWebSocket\TestWebSocket\bin\Release\TestWebSocket.exe");
|
||||
}
|
||||
137
Face.Web/Areas/App/Controllers/HotelController.cs
Normal file
137
Face.Web/Areas/App/Controllers/HotelController.cs
Normal file
@@ -0,0 +1,137 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Services.Cache;
|
||||
using Face.Services.Manager;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Newtonsoft.Json;
|
||||
using PagedList;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Controllers.LoginController;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class HotelController : BaseController
|
||||
{
|
||||
private List<HotelGroups> GetHotelGroups//酒店项目缓存
|
||||
{
|
||||
get { return CacheHelp.GetHotelGroup(); }
|
||||
}
|
||||
// GET: App/Hotel
|
||||
|
||||
public ActionResult HotelInfo(int? page, string condition = null, string number = null)//酒店列表
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
//CacheHelp.ClearRoomGroup();
|
||||
List<HotelGroups> hotelGroups = new List<HotelGroups>();
|
||||
try
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var dm= db.Queryable<DeviceManage>().ToList();
|
||||
ViewData["dmstate"] = dm.ToList();
|
||||
}
|
||||
var userList = SqlSugarBase.authoriydb.Queryable<Hotels>().OrderBy(e => e.Id).ToList();
|
||||
List<Hotels> li = new List<Hotels>();
|
||||
//第几页
|
||||
int pageNumber = page ?? 1;
|
||||
|
||||
//每页显示多少条
|
||||
int pageSize = 10;
|
||||
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
var id = Convert.ToInt32(lit[i]);
|
||||
li.AddRange(userList.Where(x => x.Id == id).ToList());
|
||||
}
|
||||
|
||||
if (condition != "" && condition != null)
|
||||
{
|
||||
ViewData["condition"] = condition;
|
||||
li = li.Where(x => x.Name.Contains(condition)).ToList();
|
||||
}
|
||||
if (number != null && number != "")
|
||||
{
|
||||
li = li.Where(x => x.Id == int.Parse(number)).ToList();
|
||||
}
|
||||
IPagedList<Hotels> userPagedList = li.ToPagedList(pageNumber, pageSize);
|
||||
return View(userPagedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
public ActionResult RoomInf(int? page, int hotelCode, string condition = "", string rommstate = null)//房间信息
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
if (lit.IndexOf(hotelCode) < 0)
|
||||
{
|
||||
Response.Redirect("~/Html_Tools/Error_404.html", false);
|
||||
return null;
|
||||
}
|
||||
List<Result> relist = null;
|
||||
List<DeviceManage> dmlist = new List<DeviceManage>();
|
||||
int pageNumber = page ?? 1;
|
||||
int pageSize = 14;
|
||||
using (var data = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
DateTime ser = Convert.ToDateTime("2000-01-01");
|
||||
var show = data.Queryable<CheckInInfo>().Where(x => x.checkOutTime == ser).ToList();
|
||||
var facelist = data.Queryable<DeviceManage>().ToList();
|
||||
dmlist = facelist.Where(x => x.HotelCode == hotelCode.ToString()).ToList();
|
||||
Session["Rommface"] = dmlist;
|
||||
ViewData["shop"] = show;
|
||||
}
|
||||
try
|
||||
{
|
||||
var ho = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == hotelCode);
|
||||
GetRoomInterface.test test = new GetRoomInterface.test
|
||||
{
|
||||
code = ho.Code.ToString(),
|
||||
creatDate = ho.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
Roominfo.Root asd = GetRoomInterface.Roomport(test);
|
||||
if (asd.IsSuccess == true)
|
||||
{
|
||||
relist = asd.Result;
|
||||
ViewData["Roomsum"] = relist.Count();
|
||||
if (rommstate != "" && rommstate != null && rommstate != "-1")
|
||||
{
|
||||
ViewData["rommstate"] = rommstate;
|
||||
relist = relist.Where(s => s.RoomStatusID == int.Parse(rommstate)).ToList();
|
||||
|
||||
}
|
||||
ViewData["hotelCode"] = hotelCode;
|
||||
if (condition != null && condition != "")
|
||||
{
|
||||
ViewData["conditionShow"] = condition;
|
||||
relist = relist.Where(s => s.RoomNumber == condition).ToList();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
IPagedList<Result> userPagedList = relist.ToPagedList(pageNumber, pageSize);
|
||||
return View(userPagedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1198
Face.Web/Areas/App/Controllers/ImgServerController.cs
Normal file
1198
Face.Web/Areas/App/Controllers/ImgServerController.cs
Normal file
File diff suppressed because it is too large
Load Diff
3948
Face.Web/Areas/App/Controllers/InterfaceController.cs
Normal file
3948
Face.Web/Areas/App/Controllers/InterfaceController.cs
Normal file
File diff suppressed because it is too large
Load Diff
338
Face.Web/Areas/App/Controllers/LodgerController.cs
Normal file
338
Face.Web/Areas/App/Controllers/LodgerController.cs
Normal file
@@ -0,0 +1,338 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.Cache;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Services.Manager;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using PagedList;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Mvc;
|
||||
using System.Xml.Serialization;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class LodgerController : BaseController
|
||||
{
|
||||
|
||||
// GET: App/Lodger
|
||||
|
||||
public List<Hosts> GetRoomChecks//开房入住信息缓存
|
||||
{
|
||||
get { return CacheHelp.GetRoomCheck(); }
|
||||
}
|
||||
public List<Hosts> GetRoom//房间缓存
|
||||
{
|
||||
get { return CacheHelp.GetRoomGroup(); }
|
||||
}
|
||||
|
||||
public ActionResult LodgerInfo(int? page, string TiaoJian = null, string band = null)//住客信息
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
|
||||
var hotellist = lit;
|
||||
IPagedList<Lodger> userPagedList = null;
|
||||
List<Lodger> lodgers = new List<Lodger>();
|
||||
|
||||
List<CheckInInfo> storage = new List<CheckInInfo>();
|
||||
try
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
List<CheckInInfo> checkInInfos = new List<CheckInInfo>();
|
||||
var infoin =db.Queryable<CheckInInfo>().ToList();
|
||||
for (int i = 0; i < hotellist.Count; i++)
|
||||
{
|
||||
var id = hotellist[i];
|
||||
checkInInfos.AddRange(infoin.Where(x => x.HotelCode == id));
|
||||
}
|
||||
|
||||
ViewBag.inall = checkInInfos;
|
||||
var checkInInfo = db.Queryable<CheckInInfo>()
|
||||
.Where(it => hotellist.Contains(it.HotelCode.Value)).ToList()
|
||||
.GroupBy(x => x.IdNumber).ToList();
|
||||
for (var item = 0; item < checkInInfo.Count; item++)
|
||||
{
|
||||
storage.Add(checkInInfo[item].ToList()[0]);
|
||||
}
|
||||
ViewData["storage"] = storage;
|
||||
|
||||
|
||||
var lodge = db.Queryable<Lodger>().ToList();
|
||||
|
||||
for (int i = 0; i < storage.Count; i++)
|
||||
{
|
||||
List<Lodger> list = new List<Lodger>();
|
||||
var id = storage[i].IdNumber;
|
||||
list = lodge.Where(s => s.IDNumber == id).ToList();
|
||||
lodgers.AddRange(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
ViewData["storage"] = storage;
|
||||
//第几页
|
||||
int pageNumber = page ?? 1;
|
||||
|
||||
// //每页显示多少条
|
||||
int pageSize = 10;
|
||||
//根据ID升序排序
|
||||
lodgers = lodgers.OrderByDescending(x => x.LodgerId).ToList();
|
||||
|
||||
|
||||
if (TiaoJian != "" && TiaoJian != null)
|
||||
{
|
||||
ViewData["infose"] = TiaoJian;
|
||||
lodgers = lodgers.Where(x => x.LodgerNmae.Contains(TiaoJian)).ToList();
|
||||
}
|
||||
|
||||
// //通过ToPagedList扩展方法进行分页
|
||||
userPagedList = lodgers.ToPagedList(pageNumber, pageSize);
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex, Session["username"].ToString());
|
||||
throw;
|
||||
}
|
||||
// //将分页处理后的列表传给View
|
||||
return View(userPagedList);
|
||||
|
||||
}
|
||||
|
||||
public ActionResult Openhouse(int? page, string TiaoJian = null)//开房信息
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
|
||||
List<CheckInInfo> li = new List<CheckInInfo>();
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var userList = db.Queryable<CheckInInfo>().ToList();
|
||||
//第几页
|
||||
int pageNumber = page ?? 1;
|
||||
|
||||
//每页显示多少条
|
||||
int pageSize = 10;
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
var id = Convert.ToInt32(lit[i]);
|
||||
li.AddRange(userList.Where(x => x.HotelCode == id).ToList());
|
||||
}
|
||||
li = li.Where(x => x.checkOutTime.Value.ToString("yyyy-MM-dd") == "2000-01-01").ToList();
|
||||
//根据ID升序排序
|
||||
li = li.OrderByDescending(x => x.id).ToList();
|
||||
|
||||
if (TiaoJian != "" && TiaoJian != null)
|
||||
{
|
||||
ViewData["infose2"] = TiaoJian;
|
||||
li = li.Where(x => x.Name.Contains(TiaoJian)).ToList();
|
||||
}
|
||||
//通过ToPagedList扩展方法进行分页
|
||||
IPagedList<CheckInInfo> userPagedList = li.ToPagedList(pageNumber, pageSize);
|
||||
|
||||
//CheckInfo r = DESerializer<CheckInfo>();
|
||||
|
||||
//将分页处理后的列表传给View
|
||||
return View(userPagedList);
|
||||
//反序列化
|
||||
|
||||
}
|
||||
}
|
||||
//public ActionResult Addedpersonnel()//添加人员信息
|
||||
//{
|
||||
// return View();
|
||||
//}
|
||||
public ActionResult AddCheckinfo()//添加入住人员信息
|
||||
{
|
||||
return View();
|
||||
}
|
||||
public ActionResult Addpeople(Lodger lr)//添加客户信息操作
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
if (string.IsNullOrEmpty(lr.IDNumber) | string.IsNullOrEmpty(lr.LodgerNmae) | string.IsNullOrEmpty(lr.phonenumber) | string.IsNullOrEmpty(lr.Sex.ToString()))
|
||||
{
|
||||
result.Status = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
lr.Sourcedian = 0;
|
||||
lr.CheckInDate = DateTime.Now;
|
||||
// if (SqlOperationsData.addClient(lr) != 0)
|
||||
// {
|
||||
// result.Status = 200;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// result.Status = 500;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
return Json(result);
|
||||
}
|
||||
public ActionResult addcheckin(TestUser co)//添加入住信息操作
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
TestUser test= db.Queryable<TestUser>().First(it => it.phone == co.phone);
|
||||
if (test!=null)
|
||||
{
|
||||
result.Status = 700;
|
||||
return Json(result);
|
||||
}
|
||||
TestUser tests = db.Queryable<TestUser>().First(it => it.idNumber == co.idNumber);
|
||||
if (tests != null)
|
||||
{
|
||||
result.Status = 800;
|
||||
return Json(result);
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(co.picture))
|
||||
{
|
||||
result.Status = 300;
|
||||
}
|
||||
else if (string.IsNullOrEmpty(co.idNumber) | string.IsNullOrEmpty(co.name))
|
||||
{
|
||||
result.Status = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
co.establish = Session["id"].ToString();
|
||||
co.creationTime = DateTime.Now;
|
||||
co.state = 1;
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
db.Insertable(co).ExecuteCommand();
|
||||
}
|
||||
result.Status = 200;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
result.Status = 100;
|
||||
LogHelp.WriteExceptionLog(e, Session["username"].ToString());
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
return Json(result);
|
||||
}
|
||||
public ActionResult officialRoom(int hotelId)//房间下拉框
|
||||
{
|
||||
var geiRoomShow = GetRoom.Where(o => o.HotelID == hotelId).ToList();
|
||||
return Json(geiRoomShow);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 图像水平翻转
|
||||
/// </summary>
|
||||
/// <param name="bmp">原来图像</param>
|
||||
/// <returns></returns>
|
||||
//public bool HorizontalFlip(string orgimgsrc, string newimgsrc)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
|
||||
// using (Image originalImage = Image.FromFile(orgimgsrc))
|
||||
// {
|
||||
// using (Bitmap bitmap = new Bitmap(originalImage))
|
||||
// {
|
||||
|
||||
|
||||
|
||||
// var width = bitmap.Width;
|
||||
// var height = bitmap.Height;
|
||||
// Graphics g = Graphics.FromImage(bitmap);
|
||||
// Dictionary<string,Color> colorlist = new Dictionary<string, Color>();
|
||||
// for (int i = 0; i < width; i++)
|
||||
// {
|
||||
// for (int j = 0; j < height; j++)
|
||||
// {
|
||||
// colorlist.Add("_"+i+"_"+j,bitmap.GetPixel(i,j));
|
||||
// }
|
||||
// }
|
||||
// for (int i = 0; i < width; i++)
|
||||
// {
|
||||
// for (int j = 0; j < height; j++)
|
||||
// {
|
||||
// bitmap.SetPixel(i,j, colorlist["_" +(width-1- i) + "_" + (j)]);
|
||||
// }
|
||||
// }
|
||||
// //Rectangle rect = new Rectangle(0, 0, width, height);
|
||||
// //bitmap.RotateFlip(RotateFlipType.Rotate180FlipXY);
|
||||
// //g.DrawImage(bitmap, rect);
|
||||
// //if (System.IO.File.Exists(name))
|
||||
// //{
|
||||
// // System.IO.File.Delete(name);
|
||||
// //}
|
||||
// bitmap.Save(newimgsrc);
|
||||
// bitmap.Dispose();
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
//}
|
||||
//public string Base64StringToImage()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// string TimePath = HostingEnvironment.MapPath("~/Upload/Image/");//保存路径
|
||||
// TimePath += DateTime.Now.ToString("yyyy-MM-dd");
|
||||
// TimePath += "\\";
|
||||
// var oFile = Request.Files[0];//获得上传的文件
|
||||
// //获取后缀名
|
||||
// string ext = Path.GetExtension(Request.Files[0].FileName);
|
||||
// //string fullPath = Guid.NewGuid().ToString() + ext;
|
||||
// string fullPath = DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss fff") + ext;
|
||||
// if (!Directory.Exists(TimePath))//判断文件夹是否存在
|
||||
// {
|
||||
// Directory.CreateDirectory(TimePath);//不存在则创建文件夹
|
||||
// }
|
||||
// oFile.SaveAs(TimePath + fullPath);
|
||||
// if(HorizontalFlip(TimePath + fullPath, TimePath + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss fff") + ext))
|
||||
// {
|
||||
// return TimePath + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss fff") + ext;
|
||||
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// return "";
|
||||
// }
|
||||
|
||||
//}
|
||||
//public string ConvertImageToBase64(Image file)
|
||||
//{
|
||||
// using (MemoryStream memoryStream = new MemoryStream())
|
||||
// {
|
||||
// file.Save(memoryStream, file.RawFormat);
|
||||
// byte[] imageBytes = memoryStream.ToArray();
|
||||
// return Convert.ToBase64String(imageBytes);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
1092
Face.Web/Areas/App/Controllers/LogController.cs
Normal file
1092
Face.Web/Areas/App/Controllers/LogController.cs
Normal file
File diff suppressed because it is too large
Load Diff
264
Face.Web/Areas/App/Controllers/LoginController.cs
Normal file
264
Face.Web/Areas/App/Controllers/LoginController.cs
Normal file
@@ -0,0 +1,264 @@
|
||||
using Face.Domain.Application;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.Cache;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Services.Enums;
|
||||
using Face.Services.Extensions;
|
||||
using Face.Services.Manager;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.ServiceModel.Channels;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Security;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class LoginController : Controller
|
||||
{
|
||||
[HttpPost]
|
||||
public ActionResult test(string data = "")
|
||||
{
|
||||
string z = data[115].ToString();
|
||||
portinfo ci = JsonConvert.DeserializeObject<portinfo>(data);
|
||||
return View();
|
||||
}
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
/// <summary>
|
||||
/// 计算密码 Hash值
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
private string ComputePasswordHash(string password, Accountentity ay)
|
||||
{
|
||||
return StringExtensions.ToMD5(ay.Uid.ToUpper() + password + ay.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="username">用户名</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult Login(string username, string password)
|
||||
{
|
||||
//记录数量
|
||||
Session["ullist"] = 0;
|
||||
Session["dp"] = 0;
|
||||
Session["fbcount"] = 0;
|
||||
Session["lodgeinfo"] = 0;
|
||||
Session["sum"] = 0;
|
||||
Session["li"] = 0;
|
||||
Session["quantity"] = 0;
|
||||
Session["pmslist"] = 0;
|
||||
Session["lasttimehotelID"] = "";
|
||||
|
||||
int sum = 0;
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo=new List<TBL_ROOM_BASIC_INFO>();
|
||||
using (SqlSugarClient rcu = SqlSugarBase.Gesmartblv_rcu_db())
|
||||
{
|
||||
ZongRoominfo = rcu.Queryable<TBL_ROOM_BASIC_INFO>().ToList();
|
||||
}
|
||||
string ip = Services.Tool.IPHelper.GetIP();
|
||||
var result = new ReturnResult();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(username) | string.IsNullOrEmpty(password))
|
||||
throw new CustomException("用户名或密码不能为空");
|
||||
Models.Root judgedate = Denglv(username, password,ip);
|
||||
List<AuthItem> authItems=new List<AuthItem>();
|
||||
List<HotelsItem> Hotelslist =new List<HotelsItem>();
|
||||
List<int> lit = new List<int>();
|
||||
if (judgedate.Status == 200)
|
||||
{
|
||||
Session["judeg"] = judgedate.Data.Userinfo.HeadImg;
|
||||
Session["username"] = username;
|
||||
Session["id"] = judgedate.Data.Userinfo.Uid;
|
||||
|
||||
foreach (var item in judgedate.Data.HotelData)
|
||||
{
|
||||
foreach (var iten in item.Hotels)
|
||||
{
|
||||
int s = int.Parse(iten.HotelId.ToString());
|
||||
Hotelslist.Add(iten);
|
||||
lit.Add(s);//添加酒店权限id
|
||||
foreach (var ite in iten.Auth)
|
||||
{
|
||||
authItems.Add(ite);//添加操作权限
|
||||
}
|
||||
}
|
||||
}
|
||||
var HotelList = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
Session["HotelList"] = HotelList;
|
||||
Session["authItems"] = authItems;
|
||||
Task.Run(() =>
|
||||
{
|
||||
List<CheckInInfo> li = new List<CheckInInfo>();//获取在店住客总数
|
||||
List<DeviceManage> dm = new List<DeviceManage>();//获取人脸机总数
|
||||
List<Lodger> lr = new List<Lodger>();//获取住客总数
|
||||
List<FaceBinding> fb = new List<FaceBinding>();//获取绑定人脸机总数
|
||||
List<CheckInInfo> storage = new List<CheckInInfo>();
|
||||
List<Dailyoperation> dp = new List<Dailyoperation>();//获取住客总数
|
||||
List<pmsInterface> pms = new List<pmsInterface>();//获取住客总数
|
||||
List<ULog> ul = new List<ULog>();//获取总数
|
||||
SqlSugarBase.Db.Queryable<FaceBinding>().ToList();
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var dmlist = db.Queryable<DeviceManage>().ToList();//查询所有
|
||||
var userList = db.Queryable<CheckInInfo>().ToList();//查询所有
|
||||
var Loderlist = db.Queryable<Lodger>().ToList();//查询所有
|
||||
var facelog =db.Queryable<FaceBinding>().ToList();//查询所有
|
||||
var pmslist = db.Queryable<pmsInterface>().ToList();//查询所有
|
||||
var dplist = db.Queryable<Dailyoperation>().ToList();//查询所有
|
||||
var ullist = db.Queryable<ULog>().ToList();//查询所有
|
||||
var hotellist = lit;
|
||||
var checkInInfo = db.Queryable<CheckInInfo>()
|
||||
.Where(it => hotellist.Contains(it.HotelCode.Value)).ToList()//包含关键字 可能有问题
|
||||
.GroupBy(x => x.IdNumber).ToList();
|
||||
for (var item = 0; item < checkInInfo.Count; item++)
|
||||
{
|
||||
storage.Add(checkInInfo[item].ToList()[0]);
|
||||
}
|
||||
ViewData["storage"] = storage;
|
||||
for (int i = 0; i < storage.Count; i++)
|
||||
{
|
||||
var id = storage[i].IdNumber;
|
||||
var lodge = db.Queryable<Lodger>().Where(s => s.IDNumber == id).ToList();
|
||||
lr.AddRange(lodge);
|
||||
}
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
var id = Convert.ToInt32(lit[i]);
|
||||
dm.AddRange(dmlist.Where(x => x.HotelCode == id.ToString()).ToList());
|
||||
li.AddRange(userList.Where(x => x.HotelCode == id).ToList());
|
||||
fb.AddRange(facelog.Where(x => x.HotelCode == id).ToList());
|
||||
dp.AddRange(dplist.Where(x => x.hotelCode == id).ToList());
|
||||
ul.AddRange(ullist.Where(x => x.hotelcode == id).ToList());
|
||||
pms.AddRange(pmslist.Where(x => x.hotelid == id).ToList());
|
||||
}
|
||||
li = li.Where(x => x.checkOutTime.Value.ToString("yyyy-MM-dd") == "2000-01-01").ToList();
|
||||
for (int i = 0; i < authItems.Count; i++)
|
||||
{
|
||||
if (authItems[i].AuthotypeId == 5)
|
||||
{
|
||||
CacheHelp.Geiface(username + "pmslist", pms.Count());
|
||||
}
|
||||
if (authItems[i].AuthorityId == 3)
|
||||
{
|
||||
sum = 1;
|
||||
}
|
||||
}
|
||||
if (sum == 1)
|
||||
{
|
||||
dm.AddRange(dmlist.Where(x => x.HotelCode == null || x.HotelCode == "").ToList());
|
||||
}
|
||||
}
|
||||
CacheHelp.Geiface(username + "ullist", ul.Count());
|
||||
CacheHelp.Geiface(username + "dp", dp.Count());
|
||||
CacheHelp.Geiface(username + "fbcount", fb.Count());
|
||||
CacheHelp.Geiface(username + "lodgeinfo", lr.Count());
|
||||
CacheHelp.Geiface(username+"face", dm.Count());
|
||||
CacheHelp.Geiface(username + "li", li.Count());
|
||||
CacheHelp.Geiface(username + "quantity", lit.Count());
|
||||
});
|
||||
Session["list"] = lit;
|
||||
Session["qxHotels"] = Hotelslist;
|
||||
|
||||
string strlhID = "";
|
||||
int lastHotelID = 0;
|
||||
if (Request.Cookies["lastHotelId"] != null)
|
||||
{
|
||||
strlhID = Request.Cookies["lastHotelId"].Value;
|
||||
if (String.IsNullOrWhiteSpace(strlhID))
|
||||
lastHotelID = 0;
|
||||
else
|
||||
lastHotelID = Convert.ToInt32(strlhID);
|
||||
if (!lit.Contains(lastHotelID))
|
||||
lastHotelID = 0;
|
||||
}
|
||||
Session["defaultHotelId"] = lit.Count > 0 ? (lastHotelID!=0 ? lastHotelID : lit[0]) : 0;
|
||||
|
||||
Session["ZongRoominfo"] = ZongRoominfo;//总房间数
|
||||
result.Message = "/APP/Home/Index";
|
||||
result.Status = 200;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
throw new CustomException("用户名或密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
catch (CustomException ex)
|
||||
{
|
||||
result.Message = ex.Message;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var s = ex.Message;
|
||||
result.Message = "网络系统繁忙,请稍候再试!";
|
||||
LogHelp.WriteExceptionLog(ex, this.GetType().Name);
|
||||
//Logs.WriteErrorLog(HttpContext.Request.Url.ToString(), ex);
|
||||
}
|
||||
return Json(result, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// API访问登录
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="pwd"></param>
|
||||
/// <returns></returns>
|
||||
public Models.Root Denglv(string name, string pwd,string ip)
|
||||
{
|
||||
|
||||
string url = "http://auth.blv-oa.com/OTApi/Login";
|
||||
string postData = string.Format("Uid={0}&Pwd={1}&appid=2", name, pwd);
|
||||
WebRequest request = WebRequest.Create(url);
|
||||
request.Method = "Post";
|
||||
request.ContentType = "application/x-www-form-urlencoded";
|
||||
StreamWriter sw = new StreamWriter(request.GetRequestStream());
|
||||
sw.Write(postData);
|
||||
sw.Flush();
|
||||
|
||||
WebResponse response = request.GetResponse();
|
||||
Stream s = response.GetResponseStream();
|
||||
StreamReader sr = new StreamReader(s, Encoding.GetEncoding("UTF-8"));
|
||||
string Show = sr.ReadToEnd();
|
||||
Models.Root info = JsonConvert.DeserializeObject<Models.Root>(Show);//josn转换实体类
|
||||
sw.Dispose();
|
||||
sw.Close();
|
||||
sr.Dispose();
|
||||
sr.Close();
|
||||
s.Dispose();
|
||||
s.Close();
|
||||
return info;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新会话超时时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public ActionResult RefreshSessionTimeout()
|
||||
{
|
||||
// 设置会话超时时间为120分钟(2小时)
|
||||
Session.Timeout = 120;
|
||||
return Json(new { Session.Timeout });
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
77
Face.Web/Areas/App/Controllers/ProgramController.cs
Normal file
77
Face.Web/Areas/App/Controllers/ProgramController.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using AUTS.Services.Manager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Mvc;
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class ProgramController : Controller
|
||||
{
|
||||
// GET: App/Program
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult Start(string programPath)
|
||||
{
|
||||
ProcessStartInfo startInfo = new ProcessStartInfo();
|
||||
if (string.IsNullOrEmpty(programPath))
|
||||
{
|
||||
ViewBag.Message = "No program path provided";
|
||||
return View("Index");
|
||||
}
|
||||
try
|
||||
{
|
||||
startInfo.UseShellExecute = true;
|
||||
startInfo.Verb = "runas"; //这行代码将提升权限
|
||||
//startInfo.FileName = Assembly.GetEntryAssembly().Location;
|
||||
startInfo.WorkingDirectory = Environment.CurrentDirectory;
|
||||
Process.Start(programPath);
|
||||
Logs.WriteLog("重新启动进成功");
|
||||
ViewBag.Message = "Program started successfully";
|
||||
//Process.Start(programPath);
|
||||
Environment.Exit(0);
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
ViewBag.Message = $"Failed to start program: {ex.Message}";
|
||||
Logs.WriteLog("重新启动进成功"+ex);
|
||||
}
|
||||
|
||||
return View("Index");
|
||||
}
|
||||
[HttpPost]
|
||||
public ActionResult Stop(string programName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(programName))
|
||||
{
|
||||
ViewBag.Message = "No program name provided";
|
||||
return View("Index");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Process[] processes = Process.GetProcessesByName(programName);
|
||||
foreach (var process in processes)
|
||||
{
|
||||
process.Kill();
|
||||
Logs.WriteLog("关闭启动进成功");
|
||||
}
|
||||
ViewBag.Message = "Program stopped successfully";
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
ViewBag.Message = $"Failed to stop program: {ex.Message}";
|
||||
Logs.WriteLog("关闭启动进" + ex);
|
||||
}
|
||||
|
||||
return View("Index");
|
||||
}
|
||||
}
|
||||
}
|
||||
265
Face.Web/Areas/App/Controllers/PublicAreaSettingController.cs
Normal file
265
Face.Web/Areas/App/Controllers/PublicAreaSettingController.cs
Normal file
@@ -0,0 +1,265 @@
|
||||
using Face.Domain.Entities;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class PublicAreaSettingController : Controller
|
||||
{
|
||||
// GET: App/PublicAreaSetting
|
||||
public ActionResult AreaSetting()
|
||||
{
|
||||
ViewData["Hotelsp"] = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
return View();
|
||||
}
|
||||
public ActionResult officialHotel(int hotelId)//根据酒店id有人脸机的房间下拉框
|
||||
{
|
||||
List<Result> relist = null;
|
||||
Hotels hotel = new Hotels();
|
||||
|
||||
hotel = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == hotelId);
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var dm = db.Queryable<DeviceManage>().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList();
|
||||
GetRoomInterface.test te = new GetRoomInterface.test();
|
||||
if (hotel != null)
|
||||
{
|
||||
te = new GetRoomInterface.test
|
||||
{
|
||||
code = hotel.Code.ToString(),
|
||||
creatDate = hotel.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
}
|
||||
|
||||
var geiRoomShow = GetRoomInterface.Roomport(te);
|
||||
if (geiRoomShow.IsSuccess == true)
|
||||
{
|
||||
relist = geiRoomShow.Result;
|
||||
//relist = relist./*Where(s => s.RoomStatusID == 16).*/Where(j => dm.IndexOf(j.ID) < 0).ToList();
|
||||
}
|
||||
string[] arrlist = new string[relist.Count];
|
||||
for (int i = 0; i < relist.Count; i++)
|
||||
{
|
||||
arrlist[i] = relist[i].HotelID;
|
||||
|
||||
}
|
||||
var rljilistm = db.Queryable<DeviceManage>().Where(x => arrlist.Contains(x.HotelCode)).ToList();
|
||||
var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().Where(x => x.IsDel == 0 && arrlist.Contains(x.HOTEL_OLD_ID)).ToList();
|
||||
|
||||
return Json(tbl_room_basic_info);
|
||||
}
|
||||
}
|
||||
public ActionResult getPublicArea(int RoomId)
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
//DeviceManage rljilistm = db.Queryable<DeviceManage>().First(x => x.RoomId == RoomId);
|
||||
tbl_room_basic_info tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x=>x.ROOM_OLD_ID== RoomId);
|
||||
//rljilistm.isPublicArea = 1;
|
||||
tbl_room_basic_info.isPublicArea = 1;
|
||||
//int upint = db.Updateable(rljilistm).Where(x => x.RoomId == RoomId).ExecuteCommand();
|
||||
int uproom = SqlSugarBase.Gesmartblv_rcu_db().Updateable(tbl_room_basic_info).Where(x => x.ROOM_OLD_ID == RoomId).ExecuteCommand();
|
||||
bool folge = false;
|
||||
if (uproom > 0)
|
||||
{
|
||||
folge = true;
|
||||
return Json(folge);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(folge);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ActionResult CanclPublicArea(int RoomId)
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
//DeviceManage rljilistm = db.Queryable<DeviceManage>().First(x => x.RoomId == RoomId);
|
||||
tbl_room_basic_info tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x => x.ROOM_OLD_ID == RoomId);
|
||||
//rljilistm.isPublicArea = 0;
|
||||
tbl_room_basic_info.isPublicArea = 0;
|
||||
//int upint = db.Updateable(rljilistm).Where(x => x.RoomId == RoomId).ExecuteCommand();
|
||||
int uproom = SqlSugarBase.Gesmartblv_rcu_db().Updateable(tbl_room_basic_info).Where(x => x.ROOM_OLD_ID == RoomId).ExecuteCommand();
|
||||
bool folge = false;
|
||||
if (uproom > 0)
|
||||
{
|
||||
folge = true;
|
||||
return Json(folge);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(folge);
|
||||
}
|
||||
}
|
||||
}
|
||||
public ActionResult RelevancePublicArea()
|
||||
{
|
||||
ViewData["Hotelsp"] = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
return View();
|
||||
}
|
||||
public ActionResult getHotel(int hotelId)//根据酒店id有人脸机的房间下拉框
|
||||
{
|
||||
List<Result> relist = null;
|
||||
Hotels hotel = new Hotels();
|
||||
|
||||
hotel = SqlSugarBase.authoriydb.Queryable<Hotels>().First(x => x.Id == hotelId);
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var dm = db.Queryable<DeviceManage>().Where(x => x.RoomId != null).Select(x => x.RoomId).ToList();
|
||||
GetRoomInterface.test te = new GetRoomInterface.test();
|
||||
if (hotel != null)
|
||||
{
|
||||
te = new GetRoomInterface.test
|
||||
{
|
||||
code = hotel.Code.ToString(),
|
||||
creatDate = hotel.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
}
|
||||
|
||||
var geiRoomShow = GetRoomInterface.Roomport(te);
|
||||
if (geiRoomShow.IsSuccess == true)
|
||||
{
|
||||
relist = geiRoomShow.Result;
|
||||
//relist = relist./*Where(s => s.RoomStatusID == 16).*/Where(j => dm.IndexOf(j.ID) < 0).ToList();
|
||||
}
|
||||
string[] arrlist = new string[relist.Count];
|
||||
for (int i = 0; i < relist.Count; i++)
|
||||
{
|
||||
arrlist[i] = relist[i].HotelID;
|
||||
|
||||
}
|
||||
|
||||
var rljilistm = db.Queryable<DeviceManage>().Where(x => arrlist.Contains(x.HotelCode)).ToList();
|
||||
var tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().Where(x => x.IsDel == 0 && arrlist.Contains(x.HOTEL_OLD_ID)).ToList();
|
||||
var isok = tbl_room_basic_info.Where(x => x.isPublicArea == 1);
|
||||
var isno = tbl_room_basic_info.Where(x => x.isPublicArea != 1);
|
||||
var json = new
|
||||
{
|
||||
isokPublicArea = isok,
|
||||
isnoPublicArea = isno
|
||||
};
|
||||
return Json(json);
|
||||
//if (rljilistm.Count() > 0)
|
||||
//{
|
||||
// var isok = from s in tbl_room_basic_info
|
||||
// join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId
|
||||
// where d.isPublicArea == 1
|
||||
// select new roominfo
|
||||
// {
|
||||
// Facelid = d.Facelid,
|
||||
// SerialNo = d.SerialNo,
|
||||
// CreatedDate = d.CreatedDate,
|
||||
// HotelCode = d.HotelCode,
|
||||
// RoomId = d.RoomId,
|
||||
// Factory = d.Factory,
|
||||
// Status = d.Status,
|
||||
// bindingDate = d.bindingDate,
|
||||
// bindingStatus = d.bindingStatus,
|
||||
// faceIp = d.faceIp,
|
||||
// faceAddress = d.faceAddress,
|
||||
// maintainStatus = d.maintainStatus,
|
||||
// ROOM_NUMBER = s.ROOM_NUMBER,
|
||||
// isPublicArea = d.isPublicArea
|
||||
// };
|
||||
// var isno = from s in tbl_room_basic_info
|
||||
// join d in rljilistm on s.ROOM_OLD_ID equals d.RoomId
|
||||
// where d.isPublicArea != 1
|
||||
// select new roominfo
|
||||
// {
|
||||
// Facelid = d.Facelid,
|
||||
// SerialNo = d.SerialNo,
|
||||
// CreatedDate = d.CreatedDate,
|
||||
// HotelCode = d.HotelCode,
|
||||
// RoomId = d.RoomId,
|
||||
// Factory = d.Factory,
|
||||
// Status = d.Status,
|
||||
// bindingDate = d.bindingDate,
|
||||
// bindingStatus = d.bindingStatus,
|
||||
// faceIp = d.faceIp,
|
||||
// faceAddress = d.faceAddress,
|
||||
// maintainStatus = d.maintainStatus,
|
||||
// ROOM_NUMBER = s.ROOM_NUMBER,
|
||||
// isPublicArea = d.isPublicArea
|
||||
// };
|
||||
// var json = new
|
||||
// {
|
||||
// isokPublicArea = isok,
|
||||
// isnoPublicArea = isno
|
||||
// };
|
||||
// return Json(json);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// var isok = tbl_room_basic_info.Where(x => x.isPublicArea == 1);
|
||||
// var isno = tbl_room_basic_info.Where(x => x.isPublicArea != 1);
|
||||
// var json = new
|
||||
// {
|
||||
// isokPublicArea = isok,
|
||||
// isnoPublicArea = isno
|
||||
// };
|
||||
// return Json(json);
|
||||
//}
|
||||
}
|
||||
}
|
||||
public ActionResult setHotel(int RoomId, string RoomidList)
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
//DeviceManage rljilistm = db.Queryable<DeviceManage>().First(x => x.RoomId == RoomId);
|
||||
tbl_room_basic_info tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x => x.ROOM_OLD_ID == RoomId);
|
||||
//rljilistm.AssociatedPublicArea = RoomidList;
|
||||
tbl_room_basic_info.AssociatedPublicArea = RoomidList;
|
||||
//int upint = db.Updateable(rljilistm).Where(x => x.RoomId == RoomId).ExecuteCommand();
|
||||
int uproom = SqlSugarBase.Gesmartblv_rcu_db().Updateable(tbl_room_basic_info).Where(x => x.ROOM_OLD_ID == RoomId).ExecuteCommand();
|
||||
bool folge = false;
|
||||
if (uproom > 0)
|
||||
{
|
||||
folge = true;
|
||||
return Json(folge);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(folge);
|
||||
}
|
||||
}
|
||||
//return Json("ok");
|
||||
}
|
||||
|
||||
public ActionResult quxHotel(int RoomId)
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
//DeviceManage rljilistm = db.Queryable<DeviceManage>().First(x => x.RoomId == RoomId);
|
||||
tbl_room_basic_info tbl_room_basic_info = SqlSugarBase.Gesmartblv_rcu_db().Queryable<tbl_room_basic_info>().First(x => x.ROOM_OLD_ID == RoomId);
|
||||
//rljilistm.AssociatedPublicArea = RoomidList;
|
||||
tbl_room_basic_info.AssociatedPublicArea = "";
|
||||
//int upint = db.Updateable(rljilistm).Where(x => x.RoomId == RoomId).ExecuteCommand();
|
||||
int uproom = SqlSugarBase.Gesmartblv_rcu_db().Updateable(tbl_room_basic_info).Where(x => x.ROOM_OLD_ID == RoomId).ExecuteCommand();
|
||||
bool folge = false;
|
||||
if (uproom > 0)
|
||||
{
|
||||
folge = true;
|
||||
return Json(folge);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(folge);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Face.Web/Areas/App/Controllers/QueryFaceStatusController.cs
Normal file
48
Face.Web/Areas/App/Controllers/QueryFaceStatusController.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using Face.Domain.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class QueryFaceStatusController : Controller
|
||||
{
|
||||
// GET: App/QueryFaceStatus
|
||||
[HttpPost]
|
||||
public ActionResult QueryStatus(string HotelCode,string roomid,string key,string appid)
|
||||
{
|
||||
pmsLog list = new pmsLog();
|
||||
pmsLog listn = new pmsLog();
|
||||
//pmsLog pms= SqlSugarBase.Db.Insertable(log).ExecuteCommand();
|
||||
if (key== "blw_888")
|
||||
{
|
||||
list = SqlSugarBase.Db.Queryable<pmsLog>().OrderByDescending(x => x.Creationtime).First(x => x.HotelCode == HotelCode && x.roomid == roomid);
|
||||
if (list == null)
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
Status = 100,
|
||||
message = "提供的酒店code和roomid没有查询到信息,请查看传递的信息是否有误!"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
listn = SqlSugarBase.Db.Queryable<pmsLog>().OrderByDescending(x => x.Creationtime).First(x => x.pmsid == list.pmsid);
|
||||
}
|
||||
else
|
||||
{
|
||||
var json = new
|
||||
{
|
||||
Status = 200,
|
||||
message = "提供的Key值有误!"
|
||||
};
|
||||
return Json(json);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Json(listn);
|
||||
}
|
||||
}
|
||||
}
|
||||
226
Face.Web/Areas/App/Controllers/RoomController.cs
Normal file
226
Face.Web/Areas/App/Controllers/RoomController.cs
Normal file
@@ -0,0 +1,226 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Services.Cache;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using Face.Services.DBUtility.Custom;
|
||||
using Face.Domain.Application;
|
||||
using PagedList;
|
||||
using SqlSugar;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Services.Manager;
|
||||
using static Face.Web.Areas.App.Controllers.FaceController;
|
||||
using static Face.Web.Areas.App.Controllers.InterfaceController;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class RoomController : Controller
|
||||
{
|
||||
public ActionResult TestRoomall(string Sn)
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult InquireRoomall(Condition data)
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<AuthItem> authItem = (List<AuthItem>)Session["authItems"];
|
||||
|
||||
string strSql = "";
|
||||
string strCntSql = "";
|
||||
//string selectSql = "select r.ROOM_ID as InnerRoomId, h.Id as HotelId, h.Name as HotelName, h.Code as ExternalHotelCode, r.ROOM_NUMBER as RoomNumber,d.* ";//d.bindingStatus, d.SerialNo, d.Status, d.maintainStatus ";
|
||||
string selectSql = "select r.ROOM_OLD_ID as InnerRoomId, h.Id as HotelId, h.Name as HotelName, h.Code as ExternalHotelCode, r.ROOM_NUMBER as RoomNumber, r.RoomStatusID as RoomCheckInStatus, ";
|
||||
selectSql += "d.Facelid, d.SerialNo, d.CreatedDate, d.HotelCode, d.RoomId, d.Factory, d.Status, d.bindingDate, d.bindingStatus, d.faceIp, d.faceAddress, d.maintainStatus ";
|
||||
string fromSql = "";
|
||||
string orderSql = "";
|
||||
string limitSql = "";
|
||||
string cond1Sql = "";
|
||||
string cond2Sql = "";
|
||||
string cond3Sql = "";
|
||||
string tbl1Sql = "";
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
cond1Sql += (" Id=" + lit[i] + " or");
|
||||
}
|
||||
cond1Sql = cond1Sql.Substring(0, cond1Sql.Length - 2);
|
||||
if (authItem[0].AuthorityId == 3)
|
||||
{
|
||||
cond1Sql += " or Id=0 or Id is null ";
|
||||
}
|
||||
|
||||
//酒店id判断
|
||||
Session["defaultHotelId"] = data.HotelID;
|
||||
HttpCookie aCookie = new HttpCookie("lastHotelId");
|
||||
aCookie.Value = Convert.ToString(data.HotelID);
|
||||
aCookie.Expires = DateTime.Now.AddDays(7);
|
||||
Response.Cookies.Add(aCookie);
|
||||
|
||||
|
||||
if (data.HotelID == -1)
|
||||
{
|
||||
cond2Sql += " and (Id=0 or Id is null) ";
|
||||
}
|
||||
else if (data.HotelID != 0)
|
||||
{
|
||||
cond2Sql += " and Id=" + data.HotelID;
|
||||
}
|
||||
tbl1Sql = "(select * from authoritydb.hotels where 0=0 and (" + cond1Sql + ") " + cond2Sql + " ) h ";
|
||||
fromSql = "from " + tbl1Sql + "join blv_rcu_db.tbl_room_basic_info r on h.Id = r.HOTEL_OLD_ID ";
|
||||
fromSql += "left join face.devicemanage d on r.ROOM_OLD_ID=d.RoomId ";
|
||||
//-1代表全部房间
|
||||
if (data.Notbing != -1)
|
||||
{
|
||||
if(data.Notbing == 0)
|
||||
cond3Sql += "where d.bindingStatus=" + data.Notbing + " or d.bindingStatus is null "; //0 or null both means no binding
|
||||
else
|
||||
cond3Sql += "where d.bindingStatus=" + data.Notbing + " ";
|
||||
}
|
||||
if (data.FaceName != "" && data.FaceName != null)
|
||||
{
|
||||
if (cond3Sql.IndexOf("where") < 0)
|
||||
cond3Sql += "where ";
|
||||
else
|
||||
cond3Sql += "and ";
|
||||
cond3Sql += "d.SerialNo like '%" + data.FaceName + "%' ";
|
||||
}
|
||||
orderSql = "order by h.Name, r.ROOM_NUMBER ";
|
||||
limitSql = "LIMIT " + (data.dataMin) + ",8; ";
|
||||
|
||||
strSql = selectSql + fromSql + cond3Sql + orderSql + limitSql;
|
||||
List<InfoRoomall> allRooms = new DALHelperCustom<InfoRoomall>("DeviceManage").SqlQueryGetList(strSql);
|
||||
|
||||
strCntSql = "select COUNT(*) " + fromSql + cond3Sql + orderSql;
|
||||
DataSet dsCnt = Fasce.Services.DBUtility.Custom.DbHelperMySqlCustom.Query(strCntSql);
|
||||
int cnt = 0;
|
||||
int cntmode = 0;
|
||||
if (dsCnt != null && dsCnt.Tables.Count > 0)
|
||||
{
|
||||
DataRow dr = dsCnt.Tables[0].Rows[0];
|
||||
cnt = Convert.ToInt32(dr[0]);
|
||||
cntmode = cnt % 8;
|
||||
}
|
||||
if (allRooms != null && cnt != 0)
|
||||
{
|
||||
ViewBag.count = cnt;
|
||||
ViewBag.modcount = cntmode;
|
||||
ViewBag.curpagenum = data.Pages;
|
||||
ViewBag.allpage = cnt / 8 + (cntmode == 0 ? 0 : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
allRooms = null;
|
||||
}
|
||||
|
||||
DateTime dt = Convert.ToDateTime("2000-01-01");
|
||||
var stillcheckin = SqlSugarBase.GesmartDb().Queryable<CheckInInfo>().Where(s => s.checkOutTime == dt).ToList();
|
||||
ViewData["sungo"] = stillcheckin;
|
||||
|
||||
return PartialView("InquireRoomall", allRooms);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult BindFaceDeviceToRoom(obje obje)//房间绑定人脸机操作
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
try
|
||||
{
|
||||
if (SqlOperationsData.reviseRommFace(obje.hotel, obje.romm, obje.faceNo) != 0)
|
||||
{
|
||||
FaceBinding binding = new FaceBinding
|
||||
{
|
||||
bindingDate = DateTime.Now,
|
||||
HotelCode = int.Parse(obje.hotel),
|
||||
OperatorType = true,
|
||||
RoomId = obje.romm,
|
||||
SerialNo = obje.faceNo,
|
||||
Operator = Session["username"].ToString()
|
||||
|
||||
};
|
||||
if (SqlOperationsData.bindingState(binding) != 0)
|
||||
{
|
||||
result.Status = 200;
|
||||
result.Message = "为房间添加人脸机成功";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Status = 500;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex, Session["username"].ToString());
|
||||
result.Status = 100;
|
||||
}
|
||||
|
||||
return Json(result);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult RemoveFaceDeviceFromRoom(obje hotelno)
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
try
|
||||
{
|
||||
if (SqlOperationsData.unbundleoperateRoom(hotelno.faceNo) != 0)
|
||||
{
|
||||
FaceBinding binding = new FaceBinding
|
||||
{
|
||||
bindingDate = DateTime.Now,
|
||||
HotelCode = int.Parse(hotelno.hotel),
|
||||
OperatorType = false,
|
||||
RoomId = hotelno.romm,
|
||||
SerialNo = hotelno.faceNo,
|
||||
Operator = Session["username"].ToString()
|
||||
|
||||
};
|
||||
if (SqlOperationsData.bindingState(binding) != 0)
|
||||
result.Status = 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Status = 500;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex, Session["username"].ToString());
|
||||
result.Status = 100;
|
||||
|
||||
}
|
||||
return Json(result);
|
||||
}
|
||||
|
||||
|
||||
public class TwoRetDevList
|
||||
{
|
||||
public List<DeviceManage> allFreeOfHotel = new List<DeviceManage>();
|
||||
public List<DeviceManage> allFree = new List<DeviceManage>();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult GetFaceDeviceOfHotel(int hotelId)//根据酒店id有人脸机的房间下拉框
|
||||
{
|
||||
TwoRetDevList retObj = new TwoRetDevList();
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var allfree = db.Queryable<DeviceManage>().Where(x => x.bindingStatus == false).Select(x => x).ToList();
|
||||
var allfreeofhotel = allfree.Where(y => Convert.ToInt32(y.HotelCode) == hotelId).ToList();
|
||||
retObj.allFree = allfree;
|
||||
retObj.allFreeOfHotel = allfreeofhotel;
|
||||
}
|
||||
return Json(retObj, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
}
|
||||
365
Face.Web/Areas/App/Controllers/SendmessageController.cs
Normal file
365
Face.Web/Areas/App/Controllers/SendmessageController.cs
Normal file
@@ -0,0 +1,365 @@
|
||||
|
||||
using Face.Domain.Application.FaceAll;
|
||||
using Face.Domain.Entities;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using System.Web.Mvc;
|
||||
using WebSocketToolsConsole;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class SendmessageController : Controller
|
||||
{
|
||||
// GET: App/Sendmessage
|
||||
/// <summary>
|
||||
/// 新命令获取设备信息
|
||||
/// </summary>
|
||||
/// <param name="Serial">人脸机编号</param>
|
||||
/// <returns></returns>
|
||||
public ActionResult GetModelInfosas(string Serial)
|
||||
{
|
||||
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abcdef");
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "GetModelInfo";//得到设备信息
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
info.msgx = msgx;
|
||||
info.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
string sn = Serial;
|
||||
var dbt = db.Queryable<Domain.Application.FaceAll.DeviceManage>().First(x => x.SerialNo == sn);
|
||||
Domain.Application.FaceAll.ULog uLog = new Domain.Application.FaceAll.ULog
|
||||
{
|
||||
Uname = Session["username"].ToString(),
|
||||
faceSN = Serial,
|
||||
operatetype = "得到设备基本信息",
|
||||
hotelcode = int.Parse(Session["hotelCode"].ToString()),
|
||||
roomid = dbt.RoomId,
|
||||
Creationtime = DateTime.Now
|
||||
};
|
||||
SqlSugarBase.Db.Insertable(uLog).ExecuteCommand();
|
||||
}
|
||||
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
/// <summary>
|
||||
/// 恢复出厂设置命令
|
||||
/// </summary>
|
||||
/// <param name="Serial">人脸机编号</param>
|
||||
/// <returns></returns>
|
||||
public ActionResult RestoreFactorySettinginfo(string Serial)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abcdef");
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "RestoreFactorySetting";//恢复出场设置
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
info.msgx = msgx;
|
||||
info.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
string sn = Serial;
|
||||
var dbt = db.Queryable<Domain.Application.FaceAll.DeviceManage>().First(x => x.SerialNo == sn);
|
||||
Domain.Application.FaceAll.ULog uLog = new Domain.Application.FaceAll.ULog
|
||||
{
|
||||
Uname = Session["username"].ToString(),
|
||||
faceSN = Serial,
|
||||
operatetype = "恢复出场设置",
|
||||
hotelcode = int.Parse(Session["hotelCode"].ToString()),
|
||||
roomid = dbt.RoomId,
|
||||
Creationtime = DateTime.Now
|
||||
};
|
||||
SqlSugarBase.Db.Insertable(uLog).ExecuteCommand();
|
||||
}
|
||||
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 下发固件命令
|
||||
/// </summary>
|
||||
/// <param name="ApkName">固件名称</param>
|
||||
/// <param name="RoomidList">房间集合</param>
|
||||
/// <param name="DomainNmae">域名</param>
|
||||
/// <param name="FTPPort">端口</param>
|
||||
/// <param name="UserNmae">用户名称</param>
|
||||
/// <param name="pwd">密码</param>
|
||||
/// <param name="foder">路径</param>
|
||||
/// <returns></returns>
|
||||
public ActionResult UpdateApk(string ApkName, string RoomidList, string DomainNmae, string FTPPort, string UserNmae, string pwd, string foder)
|
||||
{
|
||||
List<string> arrlist = new List<string>();
|
||||
Domain.Application.FaceAll.DeviceManage hotel = SqlSugarBase.Db.Queryable<Domain.Application.FaceAll.DeviceManage>().First(x => x.RoomId == int.Parse(RoomidList));
|
||||
Entity.Rootinfo rootinfo = new Entity.Rootinfo();
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
if (!arrlist.Contains(msgx.msgid)) { arrlist.Add(msgx.msgid); }
|
||||
msgx.sn = hotel.SerialNo;
|
||||
msgx.cmd = "updateAPK2";//操作
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abcdef");
|
||||
sbperson.Append("&url=" + foder+"/"+ ApkName);
|
||||
sbperson.Append("&Hast=" + DomainNmae);
|
||||
sbperson.Append("&UserName=" + UserNmae);
|
||||
sbperson.Append("&Port=" + FTPPort);
|
||||
sbperson.Append("&PW=" + pwd);
|
||||
//sbperson.Append("&Folder=" + foder);
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
rootinfo.msgx = msgx;
|
||||
rootinfo.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(rootinfo);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json(new { isok = true, arr = arrlist });
|
||||
}
|
||||
/// <summary>
|
||||
/// 上传日志api
|
||||
/// </summary>
|
||||
/// <param name="Serial">人脸机编号</param>
|
||||
/// <param name="DomainNmae">域名</param>
|
||||
/// <param name="FTPPort">端口</param>
|
||||
/// <param name="UserNmae">用户名</param>
|
||||
/// <param name="pwd">密码</param>
|
||||
/// <param name="foder">路径</param>
|
||||
/// <returns></returns>
|
||||
public ActionResult UploadLogData(string Serial,string DomainNmae,string FTPPort,string UserNmae,string pwd,string foder)
|
||||
{
|
||||
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abcdef");
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "UploadLogData";//上传日志
|
||||
sbperson.Append("&Hast="+ DomainNmae);
|
||||
sbperson.Append("&UserName=" + UserNmae);
|
||||
sbperson.Append("&Port=" + FTPPort);
|
||||
sbperson.Append("&PW=" + pwd);
|
||||
sbperson.Append("&Folder=" + foder);
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
info.msgx = msgx;
|
||||
info.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
public ActionResult setPeopleinfov19(string Serial, string HotelID, string RoomID, string IC_NO, string Groupid, string npeople,string id,string kshitime,string jieshutime)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "setPerson";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("key=abc");
|
||||
if (npeople == "1")
|
||||
{
|
||||
sb.Append("&datatype=2");
|
||||
sb.Append("&id=432156782341123429");
|
||||
sb.Append("&name=KevinLu");
|
||||
sb.Append("&IC_NO=" + IC_NO);
|
||||
sb.Append("&ID_NO=432156782341123429");
|
||||
sb.Append("&photo=<http://face.blv-oa.com/upload/testimages/432156782341123429_661497.png>");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("&datatype=2");
|
||||
sb.Append("&id="+ id);
|
||||
sb.Append("&name=VellaLiu");
|
||||
sb.Append("&IC_NO="+ IC_NO);
|
||||
sb.Append("&ID_NO="+id);
|
||||
sb.Append("&photo=<http://face.blv-oa.com/upload/testimages/123456782341127777_612497.jpg>");
|
||||
}
|
||||
sb.Append("&startTs="+kshitime);
|
||||
sb.Append("&endTs="+jieshutime);
|
||||
sb.Append("&passCount=10000");
|
||||
sb.Append("&HotelID=" + HotelID);
|
||||
sb.Append("&RoomID=" + RoomID);
|
||||
sb.Append("&Groupid=" + Groupid);
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString());
|
||||
info.msgx = msgx;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
public ActionResult getPeopleData19(string Serial, string number, string offset, string Groupid)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abc");
|
||||
sbperson.Append("&number=" + number);
|
||||
sbperson.Append("&offset="+ offset);
|
||||
sbperson.Append("&Groupid=" + Groupid);
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "listPersonByNumber";//获取人员列表
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
info.msgx = msgx;
|
||||
info.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
string sn = Serial;
|
||||
var dbt = db.Queryable<Domain.Application.FaceAll.DeviceManage>().First(x => x.SerialNo == sn);
|
||||
Domain.Application.FaceAll.ULog uLog = new Domain.Application.FaceAll.ULog
|
||||
{
|
||||
Uname = Session["username"].ToString(),
|
||||
faceSN = Serial,
|
||||
operatetype = "获取人员列表",
|
||||
hotelcode = int.Parse(Session["hotelCode"].ToString()),
|
||||
roomid = dbt.RoomId,
|
||||
Creationtime = DateTime.Now
|
||||
};
|
||||
SqlSugarBase.Db.Insertable(uLog).ExecuteCommand();
|
||||
}
|
||||
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
public ActionResult selectPeopleData191(string Serial, string id, string Groupid)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "getPerson";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("key=abc");
|
||||
sb.Append("&id="+ id);
|
||||
sb.Append("&Groupid=" + Groupid);
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(sb.ToString());
|
||||
info.msgx = msgx;
|
||||
|
||||
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public ActionResult rebootface191(string Serial, string id, string HotelID, string RoomID, string Groupid)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "removePerson";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append("key=abc");
|
||||
builder.Append("&id="+id);
|
||||
builder.Append("&HotelID=" + HotelID);
|
||||
builder.Append("&RoomID=" + RoomID);
|
||||
builder.Append("&Groupid=" + Groupid);
|
||||
//if (isNew1Point6)
|
||||
//{
|
||||
// if (npeople == "1")
|
||||
// {
|
||||
// builder.Append("&id=[432156782341123429]");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// builder.Append("&id=[123456782341127777]");
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if (npeople == "1")
|
||||
// {
|
||||
// builder.Append("&id=432156782341123429");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// builder.Append("&id=123456782341127777");
|
||||
// }
|
||||
//}
|
||||
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
|
||||
info.msgx = msgx;
|
||||
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
public ActionResult removePeopleDataByGroup19(string Serial,string Groupid)
|
||||
{
|
||||
Entity.Rootinfo info = new Entity.Rootinfo();
|
||||
info.pmsid = -1;
|
||||
|
||||
Entity.msgx msgx = new Entity.msgx();
|
||||
msgx.msgid = Guid.NewGuid().ToString();
|
||||
msgx.sn = Serial;
|
||||
msgx.cmd = "removeGroup";
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.Append("key=abc");
|
||||
builder.Append("&Group=" + Groupid);
|
||||
msgx.msg = System.Web.HttpUtility.HtmlDecode(builder.ToString());
|
||||
info.msgx = msgx;
|
||||
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(info);
|
||||
UdpCommunication.QueueSend(sendMsg);
|
||||
return Json("成功", JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
|
||||
public ActionResult GetSetAPKSandProgressData(List<string> ApkName)
|
||||
{
|
||||
Dictionary<String, List<Face.Domain.Application.FaceAll.facedevicerxtxinfo>> listdevprog = new Dictionary<String, List<Face.Domain.Application.FaceAll.facedevicerxtxinfo>>();
|
||||
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
List<Face.Domain.Application.FaceAll.facedevicerxtxinfo> matchedList = db.Queryable<Face.Domain.Application.FaceAll.facedevicerxtxinfo>()
|
||||
.Where(x => x.msgid== ApkName[0] && x.direction == "Rx")
|
||||
.ToList();
|
||||
List<Face.Domain.Application.FaceAll.facedevicerxtxinfo> currMsgList = matchedList.Where(x => x.msgid == ApkName[0]).ToList();
|
||||
listdevprog.Add(ApkName[0], currMsgList);
|
||||
}
|
||||
return Json(listdevprog);
|
||||
}
|
||||
}
|
||||
public class GetDeviceinfo
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
|
||||
public string MsgID { get; set; }
|
||||
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public string SN { get; set; }
|
||||
|
||||
public string CMD { get; set; }
|
||||
public Parainfo Para { get; set; }
|
||||
}
|
||||
public class Parainfo
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
152
Face.Web/Areas/App/Controllers/SetFaceController.cs
Normal file
152
Face.Web/Areas/App/Controllers/SetFaceController.cs
Normal file
File diff suppressed because one or more lines are too long
576
Face.Web/Areas/App/Controllers/TestController.cs
Normal file
576
Face.Web/Areas/App/Controllers/TestController.cs
Normal file
@@ -0,0 +1,576 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Face.Domain.ViewModels;
|
||||
using Face.Services.Manager;
|
||||
using Face.Domain.Entities;
|
||||
using PagedList;
|
||||
using Face.Services.Cache;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
using WebServer;
|
||||
using System.Threading.Tasks;
|
||||
using Face.Services.DBUtility.Common;
|
||||
using Face.Web.Areas.App.Models;
|
||||
using System.Data.Entity;
|
||||
using System.Threading;
|
||||
using static Face.Web.Areas.App.Models.Roominfo;
|
||||
using Face.Domain.Application;
|
||||
using SqlSugar;
|
||||
using System.Web.Hosting;
|
||||
using AUTS.Services.Manager;
|
||||
using LogHelp = Face.Services.Manager.LogHelp;
|
||||
using Logs = Face.Services.Manager.Logs;
|
||||
using WebSocketToolsConsole;
|
||||
using TencentCloud.Common.Profile;
|
||||
using TencentCloud.Common;
|
||||
using TencentCloud.Sms.V20210111;
|
||||
using TencentCloud.Sms.V20210111.Models;
|
||||
using System.Diagnostics;
|
||||
using System.Data;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Face.Web.Areas.App.Controllers
|
||||
{
|
||||
public class TestController : BaseController
|
||||
{
|
||||
|
||||
public ActionResult FaceOperate(int? page)
|
||||
{
|
||||
var HotelsList = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
return View(HotelsList);
|
||||
}
|
||||
public ActionResult IssueBJandLogandroomid()
|
||||
{
|
||||
Uiinfo ui = new Uiinfo();
|
||||
string issuetype = "";
|
||||
var Roonid = int.Parse(Request.Form["Roonid"]);//获得房间id
|
||||
var roomname = Request.Form["roomname"];//获得房间名称
|
||||
var photo = Request.Form["photo"];//背景图
|
||||
var photologo = Request.Form["photologo"];//获得logo
|
||||
ImgServerController imgServer = new ImgServerController();
|
||||
if (!string.IsNullOrEmpty(photo))
|
||||
{
|
||||
issuetype = "BkgPng";
|
||||
var img = imgServer.YHFileImage(issuetype + "/" + photo);
|
||||
ui.imageBj = "<" + issuetype + "/" + photo + ">";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(photologo))
|
||||
{
|
||||
issuetype = "Logo";
|
||||
|
||||
var img = imgServer.YHFileImage(issuetype + "/" + photologo);
|
||||
ui.imagelogo = "<" + issuetype + "/" + photologo + ">";
|
||||
}
|
||||
if (!string.IsNullOrEmpty(roomname))
|
||||
{
|
||||
//Unicode编码房号,不转换字母和数字,
|
||||
//string sasd = Regex.Replace(roomname, @"(?![a-zA-Z0-9\s]).", match => "\\u" + ((int)match.Value[0]).ToString("x4"));
|
||||
//Unicode编码房号,所有的信息都进行编译
|
||||
char[] cs = roomname.ToCharArray();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < cs.Length; i++)
|
||||
{
|
||||
sb.AppendFormat("\\u{0:x4}", (int)cs[i]);
|
||||
}
|
||||
ui.Roomname = sb.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.Roomname = "U+0020U+0020U+0020U+0020";
|
||||
}
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var Sn = db.Queryable<DeviceManage>().Where(s => s.RoomId == Roonid).ToList();
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
sbperson.Append("key=abcdef");
|
||||
string ImageInfo = Newtonsoft.Json.JsonConvert.SerializeObject(ui);
|
||||
sbperson.Append("&ImageInfo=" + ImageInfo);
|
||||
Entity.Rootinfo msgx = new Entity.Rootinfo();
|
||||
Entity.msgx msgxs = new Entity.msgx();
|
||||
msgxs.msgid = Guid.NewGuid().ToString();
|
||||
msgxs.sn = Sn[0].SerialNo;
|
||||
msgxs.cmd = "SetUI";//操作
|
||||
msgxs.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
msgx.msgx = msgxs;
|
||||
msgx.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
|
||||
UdpCommunication.QueueSend(sendMsg);//下发数据给控制台
|
||||
}
|
||||
return Json("");
|
||||
}
|
||||
|
||||
public List<Hotels> GetHotel//酒店缓存
|
||||
{
|
||||
get { return CacheHelp.GetHotelslist(); }
|
||||
}
|
||||
|
||||
// GET: App/Test
|
||||
public ActionResult TestOpen()
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
string name = Session["id"].ToString();
|
||||
var list = db.Queryable<TestUser>().Where(x => x.state == 1).Where(j => j.establish == name).ToList();
|
||||
ViewBag.clist = list;
|
||||
}
|
||||
ViewData["Hotelsp"] = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
return View();
|
||||
}
|
||||
public ActionResult visitinfo(string infoShow, string hotel, string room, string checkin, int shi)//开房测试
|
||||
{
|
||||
try
|
||||
{
|
||||
List<Result> relist = null;
|
||||
List<string> vs = infoShow.Split(',').ToList();
|
||||
DateTime date = Convert.ToDateTime(checkin);
|
||||
var code = int.Parse(hotel);
|
||||
//查询酒店
|
||||
var hotellist = SqlSugarBase.authoriydb.Queryable<Hotels>().First(s => s.Code == code.ToString());
|
||||
if (hotellist == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
GetRoomInterface.test test = new GetRoomInterface.test
|
||||
{
|
||||
code = hotellist.Code.ToString(),
|
||||
creatDate = hotellist.CreateTime.ToString("yyyy-MM-dd")
|
||||
};
|
||||
//查询房间
|
||||
Roominfo.Root asd = GetRoomInterface.Roomport(test);
|
||||
if (asd == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
if (asd.IsSuccess != true)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
relist = asd.Result;
|
||||
//查询房间的第一条数据
|
||||
var sc = relist.FirstOrDefault(j => j.RoomNumber == room);
|
||||
if (sc == null)
|
||||
{
|
||||
return Json(false);
|
||||
}
|
||||
int state = 0;
|
||||
CheckinTest user = new CheckinTest() { testState = state, creationTime = DateTime.Now, predictCheckIn = date, checkInduration = shi, hotelid = hotellist.Id, Roomid = sc.ID };
|
||||
//插入到数据库Face的表CheckinTest返回主键
|
||||
var Staty = SqlSugarBase.Db.Insertable(user).ExecuteReturnIdentity();
|
||||
//Logs.WriteTimingUDPLog("保存开房信息主表成功");
|
||||
int id = Staty;
|
||||
for (int i = 0; i < vs.Count; i++)
|
||||
{
|
||||
subtabulation su = new subtabulation() { masterid = id, Lodgerid = int.Parse(vs[i]) };
|
||||
//插入到数据库Face的表subtabulation返回主键
|
||||
SqlSugarBase.Db.Insertable(su).ExecuteCommand();
|
||||
}
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
//查询CheckinTest数据表对应的数据信息
|
||||
var OutRoom = db.Queryable<CheckinTest>().First(x => x.id == id);
|
||||
//添加时间处理
|
||||
var timeOut = DateTime.Parse(OutRoom.predictCheckIn.ToString()).AddMinutes(Convert.ToDouble(OutRoom.checkInduration.ToString()));
|
||||
var dqsj = timeOut - DateTime.Now;
|
||||
if (OutRoom.checkInduration != 0)
|
||||
{
|
||||
Thread S = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var time = (int)dqsj.TotalMilliseconds;
|
||||
|
||||
Thread.Sleep(time);
|
||||
using (var ar = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var Out = ar.Queryable<CheckinTest>().First(x => x.id == id);
|
||||
if (OutRoom.checkInduration != 0)//判断是否为永久开房
|
||||
{
|
||||
if (FJHelp.outinfos(id.ToString()))
|
||||
{
|
||||
//Logs.WriteTimingUDPLog("退房ok");
|
||||
}
|
||||
else
|
||||
{
|
||||
//Logs.WriteTimingUDPLog("退房no id" + id + ":" + Out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logs.WriteLog("预退出错" + ex.ToString());
|
||||
}
|
||||
}));//到达时间的时候执行事件;
|
||||
S.Start();
|
||||
}
|
||||
//查询下发人员信息
|
||||
var select = SqlSugarBase.Db.Queryable<TestUser>().Where(x => vs.Contains(x.id.ToString())).ToList();
|
||||
List<WebServer.UserInfo> users = new List<WebServer.UserInfo>();
|
||||
|
||||
var nowok = true;
|
||||
bool isok = false;
|
||||
if (date <= DateTime.Now)
|
||||
{
|
||||
//Logs.WriteTimingUDPLog("立即开房");
|
||||
for (int i = 0; i < select.Count; i++)
|
||||
{
|
||||
WebServer.UserInfo fo = new WebServer.UserInfo()
|
||||
{
|
||||
idcard = select[i].idNumber,
|
||||
customer = select[i].name,
|
||||
sex = select[i].sex == 1 ? "男" : "女",
|
||||
photoUrl = "http://face.blv-oa.com/ImgServer/FileImage?url=" + select[i].picture,
|
||||
};
|
||||
users.Add(fo);
|
||||
int uid = int.Parse(vs[i]);
|
||||
var sm = SqlSugarBase.Db.Queryable<TestUser>().First(x => x.id == uid);
|
||||
isok = WebHelp.Send(new SendInfo { code = hotel, roomNumber = room, idNumber = sm.idNumber, phoneNumber = sm.phone }, users.ToArray());
|
||||
users.Clear();
|
||||
}
|
||||
int states = 3;
|
||||
if (isok)
|
||||
{
|
||||
states = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nowok = false;
|
||||
}
|
||||
|
||||
SqlSugarBase.Db.Updateable<CheckinTest>().SetColumns(it => it.testState == states).Where(it => it.id == Staty).ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var dt = date - DateTime.Now;
|
||||
Thread thread = new Thread(new ThreadStart(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
List<WebServer.UserInfo> users1 = new List<WebServer.UserInfo>();
|
||||
var time = (int)dt.TotalMilliseconds;
|
||||
Thread.Sleep(time);
|
||||
for (int i = 0; i < select.Count; i++)
|
||||
{
|
||||
WebServer.UserInfo fo = new WebServer.UserInfo()
|
||||
{
|
||||
idcard = select[i].idNumber,
|
||||
customer = select[i].name,
|
||||
sex = select[i].sex == 1 ? "男" : "女",
|
||||
photoUrl = "http://face.blv-oa.com/ImgServer/FileImage?url=" + select[i].picture,
|
||||
};
|
||||
users1.Add(fo);
|
||||
int uid = int.Parse(vs[i]);
|
||||
var sm = SqlSugarBase.Db.Queryable<TestUser>().First(x => x.id == uid);
|
||||
isok = WebHelp.Send(new SendInfo { code = hotel, roomNumber = room, idNumber = sm.idNumber, phoneNumber = sm.phone }, users1.ToArray());
|
||||
users1.Clear();
|
||||
}
|
||||
int states = 3;
|
||||
if (isok)
|
||||
{
|
||||
states = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
nowok = false;
|
||||
}
|
||||
|
||||
SqlSugarBase.Db.Updateable<CheckinTest>().SetColumns(it => it.testState == states).Where(it => it.id == user.id).ExecuteCommand();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AUTS.Services.Manager.Logs.WriteTimingUDPLog("预开出错" + ex.ToString());
|
||||
}
|
||||
}));//到达时间的时候执行事件;
|
||||
thread.Start();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
}
|
||||
}
|
||||
return Json(nowok);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelp.WriteExceptionLog(ex);
|
||||
return Json(false);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult outinfos(string id)//退房信息
|
||||
{
|
||||
|
||||
return Json(FJHelp.outinfos(id));
|
||||
}
|
||||
|
||||
public ActionResult action(string str)
|
||||
{
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var list = db.Queryable<CheckInInfo>().Where(s => s.IdNumber == str).ToList();
|
||||
return Json(list);
|
||||
}
|
||||
}
|
||||
public class OutClass
|
||||
{
|
||||
public string HotelCode { get; set; }
|
||||
public string roomid { get; set; }
|
||||
|
||||
public DateTime checkOutTime { get; set; }
|
||||
}
|
||||
public ActionResult testindent(int? page)//测试人员
|
||||
{
|
||||
int pageSize = 8;
|
||||
int pageNumber = page ?? 1;
|
||||
using (SqlSugarClient db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
string name = Session["id"].ToString();
|
||||
var testlist = db.Queryable<TestUser>().Where(s => s.establish == name).ToList();
|
||||
//ViewBag.testlist = testlist;
|
||||
IPagedList<TestUser> userPagedList = testlist.ToPagedList(pageNumber, pageSize);
|
||||
return View(userPagedList);
|
||||
}
|
||||
}
|
||||
public ActionResult freeze(string id)
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
if (SqlOperationsData.amendtestUser(id) != 0)
|
||||
{
|
||||
result.Status = 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Status = 100;
|
||||
}
|
||||
return Json(result);
|
||||
|
||||
}
|
||||
public ActionResult freeze1(string id)
|
||||
{
|
||||
ReturnResult result = new ReturnResult();
|
||||
if (SqlOperationsData.amendtestUser1(id) != 0)
|
||||
{
|
||||
result.Status = 200;
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Status = 100;
|
||||
}
|
||||
return Json(result);
|
||||
|
||||
}
|
||||
public ActionResult retreatinfo(int? page)
|
||||
{
|
||||
List<int> lit = (List<int>)Session["list"];
|
||||
List<TBL_ROOM_BASIC_INFO> ZongRoominfo = (List<TBL_ROOM_BASIC_INFO>)Session["ZongRoominfo"];
|
||||
|
||||
List<CheckinTest> li = new List<CheckinTest>();
|
||||
try
|
||||
{
|
||||
//第几页
|
||||
int pageNumber = page ?? 1;
|
||||
if (page != null)
|
||||
{
|
||||
ViewData["page"] = page;
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewData["page"] = 1;
|
||||
}
|
||||
//每页显示多少条
|
||||
int pageSize = 7;
|
||||
|
||||
//根据ID升序排序
|
||||
|
||||
using (SqlSugarClient ser = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var user = ser.Queryable<TestUser>().ToList();
|
||||
var se = ser.Queryable<subtabulation>().ToList();
|
||||
var userList = ser.Queryable<CheckinTest>().ToList();
|
||||
var dsae = ser.Queryable<CheckinTest>().ToList();
|
||||
for (int i = 0; i < lit.Count; i++)
|
||||
{
|
||||
var id = Convert.ToInt32(lit[i]);
|
||||
li.AddRange(userList.Where(x => x.hotelid == id).ToList());
|
||||
}
|
||||
ViewData["people"] = dsae;
|
||||
ViewBag.indent = li;
|
||||
ViewBag.se = se;
|
||||
ViewBag.user = user;
|
||||
}
|
||||
li = li.OrderByDescending(x => x.id).ToList();
|
||||
IPagedList<CheckinTest> userPagedList = li.ToPagedList(pageNumber, pageSize);
|
||||
//将分页处理后的列表传给View
|
||||
return View(userPagedList);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AUTS.Services.Manager.LogHelp.WriteExceptionLog(ex);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ActionResult FaceTestOperate(int? page)
|
||||
{
|
||||
var HotelsList = SqlSugarBase.authoriydb.Queryable<Hotels>().ToList();
|
||||
return View(HotelsList);
|
||||
}
|
||||
public ActionResult IssueUiType()
|
||||
{
|
||||
string issuetype = "";
|
||||
var Roonid = int.Parse(Request.Form["Roonid"]);//获得房间id
|
||||
|
||||
|
||||
var type = int.Parse(Request.Form["type"]);//获得下发类型
|
||||
|
||||
var roomname = Request.Form["roomname"];//获得房间名称
|
||||
var photo = Request.Form["photo"];//获得上传的文件
|
||||
ImgServerController imgServer = new ImgServerController();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 2:
|
||||
issuetype = "BkgPng";
|
||||
break;
|
||||
case 3:
|
||||
issuetype = "Logo";
|
||||
break;
|
||||
}
|
||||
var img = imgServer.YHFileImage(issuetype + "/" + photo);
|
||||
|
||||
using (var db = SqlSugarBase.GesmartDb())
|
||||
{
|
||||
var Sn = db.Queryable<DeviceManage>().Where(s => s.RoomId == Roonid).ToList();
|
||||
switch (type)
|
||||
{
|
||||
case 2:
|
||||
StringBuilder sbperson = new StringBuilder();
|
||||
UiImg ui = new UiImg();
|
||||
ui.name = "uiname";
|
||||
ui.image = "<" + issuetype + "/" + photo + ">";
|
||||
ui.x = 0;
|
||||
ui.y = 0;
|
||||
ui.w = 0;
|
||||
ui.h = 0;
|
||||
sbperson.Append("key=abc");
|
||||
string ImageInfo = Newtonsoft.Json.JsonConvert.SerializeObject(ui);
|
||||
sbperson.Append("&ImageInfo=" + ImageInfo);
|
||||
Entity.Rootinfo msgx = new Entity.Rootinfo();
|
||||
Entity.msgx msgxs = new Entity.msgx();
|
||||
msgxs.msgid = Guid.NewGuid().ToString();
|
||||
msgxs.sn = Sn[0].SerialNo;
|
||||
msgxs.cmd = "updateMainPageBG";//操作
|
||||
msgxs.msg = System.Web.HttpUtility.HtmlDecode(sbperson.ToString());
|
||||
msgx.msgx = msgxs;
|
||||
msgx.pmsid = -1;
|
||||
string sendMsg = Newtonsoft.Json.JsonConvert.SerializeObject(msgx);
|
||||
UdpCommunication.QueueSend(sendMsg);//下发数据给控制台
|
||||
break;
|
||||
case 3:
|
||||
StringBuilder sbperson2 = new StringBuilder();
|
||||
//Unicode编码房号,不转换字母和数字,
|
||||
//string sasd = Regex.Replace(roomname, @"(?![a-zA-Z0-9\s]).", match => "\\u" + ((int)match.Value[0]).ToString("x4"));
|
||||
//Unicode编码房号,所有的信息都进行编译
|
||||
//char[] cs = roomname.ToCharArray();
|
||||
//StringBuilder sb = new StringBuilder();
|
||||
//for (int i = 0; i < cs.Length; i++)
|
||||
//{
|
||||
// sb.AppendFormat("\\u{0:x4}", (int)cs[i]);
|
||||
////}
|
||||
//string roominfo = sb.ToString();
|
||||
sbperson2.Append("key=abc");
|
||||
sbperson2.Append("&Roomnumber=" + roomname);
|
||||
sbperson2.Append("&Logo=" + "<" + issuetype + "/" + photo + ">");
|
||||
Entity.Rootinfo msgx2 = new Entity.Rootinfo();
|
||||
Entity.msgx msgxs2 = new Entity.msgx();
|
||||
msgxs2.msgid = Guid.NewGuid().ToString();
|
||||
msgxs2.sn = Sn[0].SerialNo;
|
||||
msgxs2.cmd = "updateLogoRoomNo";//操作
|
||||
msgxs2.msg = System.Web.HttpUtility.HtmlDecode(sbperson2.ToString());
|
||||
msgx2.msgx = msgxs2;
|
||||
msgx2.pmsid = -1;
|
||||
string sendMsg2 = Newtonsoft.Json.JsonConvert.SerializeObject(msgx2);
|
||||
UdpCommunication.QueueSend(sendMsg2);//下发数据给控制台
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Json("");
|
||||
}
|
||||
public static class SMSinfo
|
||||
{
|
||||
public static Responsesd SMSNotify()
|
||||
{
|
||||
Responsesd shujiu = new Responsesd();
|
||||
try
|
||||
{
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
|
||||
// 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。以下代码示例仅供参考,建议采用更安全的方式来使用密钥,请参见:https://cloud.tencent.com/document/product/1278/85305
|
||||
// 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取
|
||||
Credential cred = new Credential
|
||||
{
|
||||
SecretId = "AKID99vRlvskQs52khPs78uQhkbKwaCkDeHo",
|
||||
SecretKey = " "
|
||||
};
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.Endpoint = ("sms.tencentcloudapi.com");
|
||||
clientProfile.HttpProfile = httpProfile;
|
||||
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
SmsClient client = new SmsClient(cred, "", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
SendSmsRequest req = new SendSmsRequest();
|
||||
req.PhoneNumberSet = new string[] { "13509214696" };
|
||||
req.SmsSdkAppId = "1400871751";
|
||||
req.SignName = "东莞市英皓思科技有限公司";
|
||||
req.TemplateId = "2000581";
|
||||
// 返回的resp是一个SendSmsResponse的实例,与请求对象对应
|
||||
SendSmsResponse resp = client.SendSmsSync(req);
|
||||
var abs = AbstractModel.ToJsonString(resp);
|
||||
shujiu = JsonConvert.DeserializeObject<Responsesd>(abs);
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e.ToString());
|
||||
}
|
||||
return shujiu;
|
||||
}
|
||||
}
|
||||
public class Responsesd
|
||||
{
|
||||
public SendStatusSetsdf SendStatusSet { get; set; }
|
||||
public string RequestId { get; set; }
|
||||
}
|
||||
public class SendStatusSetsdf
|
||||
{
|
||||
public string PhoneNumber { get; set; }
|
||||
public string SerialNo { get; set; }
|
||||
|
||||
public int Fee { get; set; }
|
||||
public string SessionContext { get; set; }
|
||||
public string Code { get; set; }
|
||||
public string Message { get; set; }
|
||||
public string IsoCode { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
1507
Face.Web/Areas/App/Controllers/WxTestController.cs
Normal file
1507
Face.Web/Areas/App/Controllers/WxTestController.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user