Commit d8e98005 authored by 姜登's avatar 姜登

ip

parent 10d1195f
Pipeline #7169 passed with stage
in 4 seconds
...@@ -140,7 +140,8 @@ class ScriptsService extends Service { ...@@ -140,7 +140,8 @@ class ScriptsService extends Service {
const { ctx } = this; const { ctx } = this;
const { ip } = ctx.request; const { ip } = ctx.request;
ctx.logger.info(ctx.request); ctx.logger.info(ctx.request);
const url = `https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=${ip}`; const ipArray = ip.split(',');
const url = `https://api.map.baidu.com/location/ip?ak=3TBenWOhPygtFFazaR5kSibU&ip=${ipArray[0]}`;
const result = await ctx.curl(url, { const result = await ctx.curl(url, {
charset: 'utf-8', charset: 'utf-8',
timeout: [30000, 30000], timeout: [30000, 30000],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment