添加redis获取机场数据
parent
5bb38d60e0
commit
f7317974f6
|
|
@ -2973,7 +2973,8 @@ WHERE
|
|||
{
|
||||
Result = new
|
||||
{
|
||||
modeCode, droneInDock
|
||||
modeCode,
|
||||
droneInDock
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -3004,5 +3005,25 @@ WHERE
|
|||
}
|
||||
).First();
|
||||
}
|
||||
|
||||
|
||||
#region redis获取数据
|
||||
public async Task<Response<string>> GetDronePortInfoFromRedis(string key)
|
||||
{
|
||||
var info = _redisCacheContext.Get<string>(key);
|
||||
if (!string.IsNullOrEmpty(info))
|
||||
{
|
||||
return new Response<string>
|
||||
{
|
||||
Result = info
|
||||
};
|
||||
}
|
||||
return new Response<string>
|
||||
{
|
||||
Message = "暂无数据",
|
||||
Code = 500
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1011,5 +1011,19 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
{
|
||||
await _configSubscribe.HandleTopic(null, topic, message);
|
||||
}
|
||||
|
||||
#region 获取redis数据
|
||||
/// <summary>
|
||||
/// 根据key获取redis数据
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public async Task<Response<string>> GetDronePortInfoFromRedis(string key)
|
||||
{
|
||||
return await _app.GetDronePortInfoFromRedis(key);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
"UploadPath": "",
|
||||
//附件上传的路径,如果为空则保存在站点根目录
|
||||
"RedisConf": {
|
||||
//"Conn": "192.168.10.163:6379,password=123456",
|
||||
"Conn": "127.0.0.1:6379,password=123456",
|
||||
"Conn": "192.168.10.163:6379,password=123456",
|
||||
//"Conn": "127.0.0.1:6379,password=123456",
|
||||
"Database": 7
|
||||
},
|
||||
//redis配置
|
||||
|
|
|
|||
Loading…
Reference in New Issue