Browse Source

站内信--未读消息数量修复

huyy 7 years ago
parent
commit
1979f2670e

+ 13 - 11
src/main/webapp/resources/js/usercenter/controllers/forstore/messagePersonalCtrl.js

@@ -412,20 +412,22 @@ define(['app/app'], function(app) {
                         // $rootScope.unReadMessCount = data.totalElements;
                     } else {
                         var param = {
-                            page: 1,
-                            count: 10,
-                            timeSorting: 'DESC',
-                            classes: '',
-                            recRole: 'SELLER',
+                            'receiverUu': info.userUU,
+                            'receiverEnuu': info.enUU,
+                            'consumerApp': 'MALL',
                             'isRead': 0
                         };
+                        $http({
+                            method: 'get',
+                            dataType: 'json',
+                            url: url + '/messages/count',
+                            params: param
+                        }).success(function (data) {
+                            $rootScope.unReadMessCount = data.count;
 
-                            /*InternalMessage.getUnread({isRead: 0}, function (data) {*/
-                                InternalMessage.getUnread({isRead: 0}, function (data) {
-                                $rootScope.unReadMessCount = data.toRead;
-                                $scope.unReadMessCount = data.toRead;
-                            })
-
+                        }).error(function (err) {
+                            toaster.pop('error', err || '获取未读消息数量失败');
+                        });
                     }
                 }
             }, function(response) {

+ 14 - 12
src/main/webapp/resources/js/vendor/controllers/forstore/messagePersonalCtrl.js

@@ -373,20 +373,22 @@ define(['app/app'], function(app) {
                         // $rootScope.unReadMessCount = data.totalElements;
                     } else {
                         var param = {
-                            page: 1,
-                            count: 10,
-                            timeSorting: 'DESC',
-                            classes: '',
-                            recRole: 'SELLER',
+                            'receiverUu': info.userUU,
+                            'receiverEnuu': info.enUU,
+                            'consumerApp': 'MALL',
                             'isRead': 0
                         };
-                        InternalMessage.getUrl({}, function(data) {
-                            /*InternalMessage.getUnread({isRead: 0}, function (data) {*/
-                            InternalMessage.getUnread({isRead: 0}, function (data) {
-                                $rootScope.unReadMessCount = data.toRead;
-                                $scope.unReadMessCount = data.toRead;
-                            })
-                        })
+                        $http({
+                            method: 'get',
+                            dataType: 'json',
+                            url: url + '/messages/count',
+                            params: param
+                        }).success(function (data) {
+                            $rootScope.unReadMessCount = data.count;
+
+                        }).error(function (err) {
+                            toaster.pop('error', err || '获取未读消息数量失败');
+                        });
                     }
                 }
             }, function(response) {