You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

  1. 'use strict';
  2. angular.module('app.main', ['ngRoute'])
  3. .config(['$routeProvider', function($routeProvider) {
  4. $routeProvider.when('/main', {
  5. templateUrl: 'views/main/main.html',
  6. controller: 'MainCtrl'
  7. });
  8. }])
  9. .controller('MainCtrl', function($scope, $http) {
  10. //last addr
  11. $scope.addresses = [];
  12. $http.get(urlapi + 'lastaddr')
  13. .then(function(data, status, headers, config) {
  14. console.log('data success');
  15. console.log(data);
  16. $scope.addresses = data.data;
  17. }, function(data, status, headers, config) {
  18. console.log('data error');
  19. });
  20. //last tx
  21. $scope.txs = [];
  22. $http.get(urlapi + 'lasttx')
  23. .then(function(data, status, headers, config) {
  24. console.log('data success');
  25. console.log(data);
  26. $scope.txs = data.data;
  27. }, function(data, status, headers, config) {
  28. console.log('data error');
  29. });
  30. //date analysis
  31. $scope.last24hour= {
  32. data:[],
  33. labels: []
  34. };
  35. $http.get(urlapi + 'last24hour')
  36. .then(function(data, status, headers, config) {
  37. console.log('data success');
  38. console.log(data);
  39. $scope.last24hour.data = data.data.data;
  40. $scope.last24hour.labels = data.data.labels;
  41. }, function(data, status, headers, config) {
  42. console.log('data error');
  43. });
  44. $scope.last7dayhour= {
  45. data:[],
  46. labels: []
  47. };
  48. $http.get(urlapi + 'last7dayhour')
  49. .then(function(data, status, headers, config) {
  50. console.log('data success');
  51. console.log(data);
  52. $scope.last7dayhour.data = data.data.data;
  53. $scope.last7dayhour.labels = data.data.labels;
  54. $scope.last7dayhour.series = data.data.series;
  55. }, function(data, status, headers, config) {
  56. console.log('data error');
  57. });
  58. });