Browse Source

后台数据统计传值问题

huangb 7 years ago
parent
commit
a0754de7d0
1 changed files with 17 additions and 15 deletions
  1. 17 15
      src/main/webapp/resources/js/admin/controllers/statsDataCtrl.js

+ 17 - 15
src/main/webapp/resources/js/admin/controllers/statsDataCtrl.js

@@ -37,29 +37,26 @@ define([ 'app/app' ], function(app) {
         $scope.endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
         $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
         $scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
+        var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000)
+        var addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000)
+        $scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
+        $scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
 
         $scope.setFilters = function (type, val) {
             $scope[type] = val;
             if (type == 'dateArea') {
                 // 时间筛选
                 var currentTime = _getClearDay(new Date());
-                console.log(currentTime, 'currentTime')
                 var endDate = new Date(currentTime + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
                 if (val == 'oneMonth') {
                     $scope.startDate = new Date(currentTime - 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
                 } else if (val == 'threeMonth') {
                     $scope.startDate = new Date(currentTime - 3 * 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
                 } else if (val == 'sixMonth') {
                     $scope.startDate = new Date(currentTime - 6 * 30 * 24 * 60 * 60 * 1000 - 24 * 60 * 60 * 1000);
                     $scope.endDate = endDate;
-                    $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
-                    $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
                 }
             }
             if (val != 'autoMonth') {
@@ -112,7 +109,7 @@ define([ 'app/app' ], function(app) {
                 $scope.ssoUrl = data.data == 'success' ? 'https://sso.ubtob.com' : 'http://192.168.253.6:32323';
                 $scope.uasUrl = data.data == 'success' ? 'http://uas.ubtob.com' : 'http://192.168.253.12:9000/b2b-test';
                 $scope.commonUrl = data.data == 'success' ? 'https://api-inquiry.usoftmall.com' : 'http://218.17.158.219:24000';
-                // 询价信息
+                // 询价信息(刘)
                 $http({
                     method: 'get',
                     dataType: 'json',
@@ -123,34 +120,34 @@ define([ 'app/app' ], function(app) {
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 新增企业用户数
+                // 新增企业用户数(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/userspace/inputTime/count/apps',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, fromApps:'mall,b2b'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
                 }).success(function (data) {
                     $scope.newAddUserSpaceData = data.content
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 新增个人用户
+                // 新增个人用户(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/user/inputTime/count/apps',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, fromApps:'mall,b2b'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
                 }).success(function (data) {
                     $scope.newAddUserData = data.content
                 }).error(function () {
                     toaster.pop('error', '获取未处理审批数据失败');
                 });
-                // 半年未登录用户数
+                // 半年未登录用户数(1)
                 $http({
                     method: 'get',
                     dataType: 'json',
                     url: $scope.ssoUrl + '/api/user/count/notlgoin/month',
-                    params: {start: $scope.startFormatDate, end: $scope.endFormatDate, months: '6,12,24'}
+                    params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, months: '6,12,24'}
                 }).success(function (data) {
                     $scope.monthLogoData = data
                 }).error(function () {
@@ -160,9 +157,14 @@ define([ 'app/app' ], function(app) {
                 toaster.pop('error', '获取运行环境失败');
             });
         };
-
         // 获取不同时间阶段的相关数据
         var initData = function () {
+            var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000)
+            var addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000)
+            $scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
+            $scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
+            $scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
+            $scope.endFormatDate =  _formatDate($scope.endDate, 'yyyy-MM-dd');
             getDevOrProdData();
             // 上传产品个数
             Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {