Skip to content
This repository has been archived by the owner on Mar 12, 2022. It is now read-only.

Commit

Permalink
fix: 修改IP归属地查询接口
Browse files Browse the repository at this point in the history
淘宝的经常500
  • Loading branch information
klren0312 authored Oct 9, 2019
1 parent 5173241 commit 2248fb4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ApiServer/app/service/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ class LogService extends Service {
const { ctx } = this
const result = await ctx.helper.request({
ctx,
url: `http://ip.taobao.com/service/getIpInfo.php?ip=${ip}`,
url: `http://ip-api.com/json/${ip}?lang=zh-CN`,
method: 'GET'
})
ctx.logger.info(result.data)
if (result.data.code === 0) {
const data = result.data.data
return `${data.country} | ${data.region} | ${data.city} | ${data.isp}`
if (result.data && result.data.status === 'success') {
const data = result.data
return `${data.country} | ${data.regionName} | ${data.city} | ${data.isp}`
} else {
return null
}
Expand Down

0 comments on commit 2248fb4

Please sign in to comment.