feat(#IWOJ3): IP地理位置服务接口增加缓存调用

#Comment
为了减少IP地理位置服务增加缓存配置项减少请求次数
comment #IWOJ3

#Issue
close https://gitee.com/LongbowEnterprise/dashboard/issues?id=IWOJ3
This commit is contained in:
Argo Zhang 2019-05-17 15:57:46 +08:00
parent 36656b4a78
commit b9c68a32c8
9 changed files with 334 additions and 306 deletions

Binary file not shown.

View File

@ -160,6 +160,12 @@ namespace Bootstrap.DataAccess
/// <returns></returns>
public string RetrieveLocaleIPSvr() => DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "IP地理位置接口" && d.Define == 0)?.Code;
/// <summary>
///
/// </summary>
/// <returns></returns>
public string RetrieveLocaleIPSvrCachePeriod() => DictHelper.RetrieveDicts().FirstOrDefault(d => d.Category == "系统设置" && d.Name == "IP请求缓存时长" && d.Define == 0)?.Code;
/// <summary>
/// 获得 项目是否获取登录地点 默认为false
/// </summary>

View File

@ -79,6 +79,7 @@ namespace Bootstrap.DataAccess
var url = RetrieveLocaleIPSvrUrl(name);
op.Locator = string.IsNullOrEmpty(url) ? null : DefaultIPLocatorProvider.CreateLocator(name);
op.Url = string.IsNullOrEmpty(url) ? string.Empty : $"{url}{op.IP}";
if (int.TryParse(RetrieveLocaleIPSvrCachePeriod(), out var period) && period > 0) op.Period = period;
}
}
@ -176,9 +177,16 @@ namespace Bootstrap.DataAccess
/// <summary>
///
/// </summary>
/// <param name="ipSvr">ip地址请求服务名称</param>
/// <returns></returns>
public static string RetrieveLocaleIPSvrUrl(string ipSvr) => DbContextManager.Create<Dict>().RetrieveLocaleIPSvrUrl(ipSvr);
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string RetrieveLocaleIPSvrCachePeriod() => DbContextManager.Create<Dict>().RetrieveLocaleIPSvrCachePeriod();
/// <summary>
/// 访问日志保留时长 默认一个月
/// </summary>

View File

@ -43,6 +43,8 @@ INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'IP地理位置接口', 'None', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0)
-- 时长单位 分钟
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'IP请求缓存时长', '10', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'演示系统', '0', 0)
INSERT [dbo].[Dicts] ([Category], [Name], [Code], [Define]) VALUES (N'系统设置', N'验证码图床', 'http://images.sdgxgz.com/', 0)

View File

@ -1,309 +1,315 @@
Dicts = [
{
"Category": "菜单",
"Name": "系统菜单",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "菜单",
"Name": "外部菜单",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "应用程序",
"Name": "未设置",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "网站标题",
"Code": "后台管理系统",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "网站页脚",
"Code": "2016 © 通用后台管理系统",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "用户注册",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "程序异常",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "数据库连接",
"Code": "2",
"Define": NumberInt(0)
},
{
"Category": "通知状态",
"Name": "未处理",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "通知状态",
"Name": "已处理",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "处理结果",
"Name": "同意",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "处理结果",
"Name": "拒绝",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "消息状态",
"Name": "未读",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "消息状态",
"Name": "已读",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "消息标签",
"Name": "一般",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "消息标签",
"Name": "紧要",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "头像地址",
"Name": "头像路径",
"Code": "~/images/uploader/",
"Define": NumberInt(0)
},
{
"Category": "头像地址",
"Name": "头像文件",
"Code": "default.jpg",
"Define": NumberInt(0)
},
{
"Category": "当前样式",
"Name": "使用样式",
"Code": "blue.css",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "前台首页",
"Code": "~/Home/Index",
"Define": NumberInt(0)
},
{
"Category": "应用程序",
"Name": "组垛平台",
"Code": "4",
"Define": NumberInt(0)
},
{
"Category": "组垛平台",
"Name": "网站标题",
"Code": "托盘组垛程序",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "网站页脚",
"Code": "版权所有:中烟信息",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "个人中心地址",
"Code": "http://localhost:50852/Admin/Profiles",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "系统设置地址",
"Code": "http://localhost:50852/Admin/Index",
"Define": NumberInt(1)
},
{
"Category": "设备厂商",
"Name": "远望谷",
"Code": "Invengo",
"Define": NumberInt(1)
},
{
"Category": "设备厂商",
"Name": "测试",
"Code": "Test",
"Define": NumberInt(1)
},
{
"Category": "远程数据库",
"Name": "组垛数据库",
"Code": "Corp_Scan",
"Define": NumberInt(1)
},
{
"Category": "网站样式",
"Name": "黑色样式",
"Code": "black.css",
"Define": NumberInt(0)
},
{
"Category": "网站样式",
"Name": "蓝色样式",
"Code": "blue.css",
"Define": NumberInt(0)
},
{
"Category": "设备天线",
"Name": "天线1",
"Code": "1",
"Define": NumberInt(1)
},
{
"Category": "设备天线",
"Name": "天线2",
"Code": "2",
"Define": NumberInt(1)
},
{
"Category": "应用程序",
"Name": "测试平台",
"Code": "2",
"Define": NumberInt(0)
},
{
"Category": "测试平台",
"Name": "网站标题",
"Code": "托盘组垛程序",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "网站页脚",
"Code": "通用后台管理测试平台",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "个人中心地址",
"Code": "http://localhost:50852/Admin/Profiles",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "系统设置地址",
"Code": "http://localhost:50852/Admin/Index",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "系统通知地址",
"Code": "http://localhost:50852/Admin/Notifications",
"Define": NumberInt(1)
},
{
"Category": "设备驱动",
"Name": "Invengo",
"Code": "Longbow.Invengo.Device, Longbow.Invengo",
"Define": NumberInt(1)
},
{
"Category": "设备驱动",
"Name": "Test",
"Code": "Pallet.DeviceInterface.Device, Pallet.DeviceHub",
"Define": NumberInt(1)
},
{
"Category": "应用首页",
"Name": "2",
"Code": "http://localhost:49185/",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "程序异常保留时长",
"Code": "1",
"Define": NumberInt(0)
},
{
{
"Category": "菜单",
"Name": "系统菜单",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "菜单",
"Name": "外部菜单",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "应用程序",
"Name": "未设置",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "网站标题",
"Code": "后台管理系统",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "网站页脚",
"Code": "2016 © 通用后台管理系统",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "用户注册",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "程序异常",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "系统通知",
"Name": "数据库连接",
"Code": "2",
"Define": NumberInt(0)
},
{
"Category": "通知状态",
"Name": "未处理",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "通知状态",
"Name": "已处理",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "处理结果",
"Name": "同意",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "处理结果",
"Name": "拒绝",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "消息状态",
"Name": "未读",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "消息状态",
"Name": "已读",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "消息标签",
"Name": "一般",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "消息标签",
"Name": "紧要",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "头像地址",
"Name": "头像路径",
"Code": "~/images/uploader/",
"Define": NumberInt(0)
},
{
"Category": "头像地址",
"Name": "头像文件",
"Code": "default.jpg",
"Define": NumberInt(0)
},
{
"Category": "当前样式",
"Name": "使用样式",
"Code": "blue.css",
"Define": NumberInt(0)
},
{
"Category": "网站设置",
"Name": "前台首页",
"Code": "~/Home/Index",
"Define": NumberInt(0)
},
{
"Category": "应用程序",
"Name": "组垛平台",
"Code": "4",
"Define": NumberInt(0)
},
{
"Category": "组垛平台",
"Name": "网站标题",
"Code": "托盘组垛程序",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "网站页脚",
"Code": "版权所有:中烟信息",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "个人中心地址",
"Code": "http://localhost:50852/Admin/Profiles",
"Define": NumberInt(1)
},
{
"Category": "组垛平台",
"Name": "系统设置地址",
"Code": "http://localhost:50852/Admin/Index",
"Define": NumberInt(1)
},
{
"Category": "设备厂商",
"Name": "远望谷",
"Code": "Invengo",
"Define": NumberInt(1)
},
{
"Category": "设备厂商",
"Name": "测试",
"Code": "Test",
"Define": NumberInt(1)
},
{
"Category": "远程数据库",
"Name": "组垛数据库",
"Code": "Corp_Scan",
"Define": NumberInt(1)
},
{
"Category": "网站样式",
"Name": "黑色样式",
"Code": "black.css",
"Define": NumberInt(0)
},
{
"Category": "网站样式",
"Name": "蓝色样式",
"Code": "blue.css",
"Define": NumberInt(0)
},
{
"Category": "设备天线",
"Name": "天线1",
"Code": "1",
"Define": NumberInt(1)
},
{
"Category": "设备天线",
"Name": "天线2",
"Code": "2",
"Define": NumberInt(1)
},
{
"Category": "应用程序",
"Name": "测试平台",
"Code": "2",
"Define": NumberInt(0)
},
{
"Category": "测试平台",
"Name": "网站标题",
"Code": "托盘组垛程序",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "网站页脚",
"Code": "通用后台管理测试平台",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "个人中心地址",
"Code": "http://localhost:50852/Admin/Profiles",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "系统设置地址",
"Code": "http://localhost:50852/Admin/Index",
"Define": NumberInt(1)
},
{
"Category": "测试平台",
"Name": "系统通知地址",
"Code": "http://localhost:50852/Admin/Notifications",
"Define": NumberInt(1)
},
{
"Category": "设备驱动",
"Name": "Invengo",
"Code": "Longbow.Invengo.Device, Longbow.Invengo",
"Define": NumberInt(1)
},
{
"Category": "设备驱动",
"Name": "Test",
"Code": "Pallet.DeviceInterface.Device, Pallet.DeviceHub",
"Define": NumberInt(1)
},
{
"Category": "应用首页",
"Name": "2",
"Code": "http://localhost:49185/",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "程序异常保留时长",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "操作日志保留时长",
"Code": "12",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "登录日志保留时长",
"Code": "12",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "Cookie保留时长",
"Code": "7",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "IP地理位置接口",
"Code": "None",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "BaiDuIPSvr",
"Code": "http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "JuheIPSvr",
"Code": "http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "访问日志保留时长",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "演示系统",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "验证码图床",
"Code": "http://images.sdgxgz.com/",
"Define": NumberInt(0)
}
"Category": "系统设置",
"Name": "操作日志保留时长",
"Code": "12",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "登录日志保留时长",
"Code": "12",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "Cookie保留时长",
"Code": "7",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "IP地理位置接口",
"Code": "None",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "BaiDuIPSvr",
"Code": "http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "JuheIPSvr",
"Code": "http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "访问日志保留时长",
"Code": "1",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "IP请求缓存时长",
"Code": "10",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "演示系统",
"Code": "0",
"Define": NumberInt(0)
},
{
"Category": "系统设置",
"Name": "验证码图床",
"Code": "http://images.sdgxgz.com/",
"Define": NumberInt(0)
}
];

View File

@ -40,6 +40,8 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'Cookie
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP地理位置接口', 'None', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
-- 时长单位 分钟
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP请求缓存时长', '10', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '验证码图床', 'http://images.sdgxgz.com/', 0);

View File

@ -41,6 +41,8 @@ INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP地
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '演示系统', '0', 0);
-- 时长单位 分钟
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', 'IP请求缓存时长', '10', 0);
INSERT INTO Dicts (Category, Name, Code, Define) VALUES ('系统设置', '验证码图床', 'http://images.sdgxgz.com/', 0);
DELETE FROM Navigations Where Category = '0';

View File

@ -40,6 +40,8 @@ INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'IP地理位置接口', 'None', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'BaiDuIPSvr', 'http://api.map.baidu.com/location/ip?ak=6lvVPMDlm2gjLpU0aiqPsHXi2OiwGQRj&ip=', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'JuheIPSvr', 'http://apis.juhe.cn/ip/ipNew?key=f57102d1b9fadd3f4a1c29072d0c0206&ip=', 0);
-- 时长单位 分钟
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', 'IP请求缓存时长', '10', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '演示系统', '0', 0);
INSERT INTO [Dicts] ([Category], [Name], [Code], [Define]) VALUES ('系统设置', '验证码图床', 'http://images.sdgxgz.com/', 0);

Binary file not shown.