parent
e3c7927bab
commit
5f9b173fe6
@ -0,0 +1,24 @@
|
||||
package au.com.royalpay.payment.manage.dev.web;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.maxmind.geoip.LookupService;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(value = "/dev/ip")
|
||||
|
||||
public class IPController {
|
||||
@Resource
|
||||
private LookupService lookupService;
|
||||
|
||||
@RequestMapping(value = "/{ipAddr}", method = RequestMethod.GET)
|
||||
public String getIpInfo(@PathVariable String ipAddr) {
|
||||
String city = lookupService.getLocation(ipAddr).city;
|
||||
return city;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue