add ip location

master
eason.qian 7 years ago
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;
}
}

@ -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.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) { app.controller('orderDetailEditCtrl', ['$scope', '$http', 'commonDialog', 'order', function ($scope, $http, commonDialog,order) {
$scope.order = order.data; $scope.order = order.data;

@ -75,7 +75,9 @@
<div class="form-group" ng-if="order.customer_ip"> <div class="form-group" ng-if="order.customer_ip">
<label class="control-label col-xs-3">IP</label> <label class="control-label col-xs-3">IP</label>
<div class="col-xs-9"> <div class="col-xs-9">
<p class="form-control-static" ng-bind="order.customer_ip"></p> <p class="form-control-static">
{{order.customer_ip}}&nbsp;&nbsp;<a href="#" ng-click="getPayLocation(order.customer_ip)">查询地区</a><span ng-if="pay_location"> : {{pay_location}}</span>
</p>
</div> </div>
</div> </div>
@ -128,6 +130,12 @@
<p class="form-control-static" ng-bind="order.clearing_amount|currency:'AUD '"></p> <p class="form-control-static" ng-bind="order.clearing_amount|currency:'AUD '"></p>
</div> </div>
</div> </div>
<div class="form-group" ng-if="order.status>=5">
<label class="control-label col-xs-3">Gateway</label>
<div class="col-xs-9">
<p class="form-control-static" ng-bind="order.gateway|tradeGateway"></p>
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="control-label col-xs-3">Create Time</label> <label class="control-label col-xs-3">Create Time</label>
<div class="col-xs-9"> <div class="col-xs-9">

Loading…
Cancel
Save