diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java new file mode 100644 index 000000000..fb3c75895 --- /dev/null +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/IPController.java @@ -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; + } +} diff --git a/src/main/ui/static/commons/services/orderService.js b/src/main/ui/static/commons/services/orderService.js index b6fb25d7e..1c628772a 100644 --- a/src/main/ui/static/commons/services/orderService.js +++ b/src/main/ui/static/commons/services/orderService.js @@ -36,8 +36,13 @@ define(['../app'], function (app) { } } }]); - app.controller('orderDetailDialogCtrl', ['$scope', 'order', function ($scope, order) { + app.controller('orderDetailDialogCtrl', ['$scope', 'order','$http', function ($scope, order,$http) { $scope.order = order.data; + $scope.getPayLocation=function (ip) { + $http.get('/dev/ip/'+ip).then(function (res) { + $scope.pay_location = res.data; + }) + } }]); app.controller('orderDetailEditCtrl', ['$scope', '$http', 'commonDialog', 'order', function ($scope, $http, commonDialog,order) { $scope.order = order.data; diff --git a/src/main/ui/static/commons/templates/order_detail.html b/src/main/ui/static/commons/templates/order_detail.html index ae0bd21de..f077f56d2 100644 --- a/src/main/ui/static/commons/templates/order_detail.html +++ b/src/main/ui/static/commons/templates/order_detail.html @@ -75,7 +75,9 @@
+ {{order.customer_ip}} 查询地区 : {{pay_location}} +