修改:Redis方法修改。
This commit is contained in:
@@ -13,6 +13,8 @@ using static Services.Manager.SyncAllFromOutterDB;
|
||||
using Newtonsoft.Json;
|
||||
using Models.ApiModei;
|
||||
using NLog;
|
||||
using Services.Tool;
|
||||
using Common;
|
||||
|
||||
namespace UI.Controllers
|
||||
{
|
||||
@@ -448,8 +450,57 @@ namespace UI.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取房间地址状态
|
||||
/// </summary>
|
||||
/// <param name="roomAddressStatus"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult GetRoomAddressStatus(int Code, string RoomNum)
|
||||
{
|
||||
RoomAddressStatus roomAddressStatus = new RoomAddressStatus
|
||||
{
|
||||
Code = Code,
|
||||
RoomNum = RoomNum
|
||||
};
|
||||
try
|
||||
{
|
||||
if (roomAddressStatus == null)
|
||||
{
|
||||
Response.StatusCode = (int)HttpStatusCode.BadRequest;
|
||||
return Json(new { Status = 0, Message = "请求参数不能为空" }, JsonRequestBehavior.DenyGet);
|
||||
}
|
||||
|
||||
string code = roomAddressStatus.Code.ToString();
|
||||
string RoomNumVal = roomAddressStatus.RoomNum ?? string.Empty;
|
||||
string key = $"WXFault_{code}_{RoomNumVal}";
|
||||
var result = CSRedisCacheHelper.HMGetAll(key);
|
||||
|
||||
if (result != null && result.Count > 0)
|
||||
{
|
||||
return Json(new { Status = 1, Message = "获取成功", Data = result }, JsonRequestBehavior.DenyGet);
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.StatusCode = (int)HttpStatusCode.NotFound;
|
||||
return Json(new { Status = 0, Message = "未找到数据", Data = result }, JsonRequestBehavior.DenyGet);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, "GetRoomAddressStatus error");
|
||||
Response.StatusCode = (int)HttpStatusCode.InternalServerError;
|
||||
return Json(new { Status = -1, Message = "服务器错误", Detail = ex.Message }, JsonRequestBehavior.DenyGet);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public class RoomAddressStatus
|
||||
{
|
||||
public string RoomNum { get; set; }
|
||||
public int Code { get; set; }
|
||||
}
|
||||
// 服务控制请求参数类
|
||||
public class RCUServiceRequest
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user