Sfoglia il codice sorgente

获取b2b测试环境地质

yangc 8 anni fa
parent
commit
9059b4d3a9

+ 0 - 18
src/main/webapp/resources/js/common/b2bServices.js

@@ -285,24 +285,6 @@ define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular,
                 }
             });
         }])
-        .factory('B2bCurrentRole', ['$resource', 'BaseService', function($resource, BaseService) {
-            var b2bPath = BaseService.getB2bUrl();
-            return $resource(b2bPath + '/account/role', {}, {
-                //当前企业对应的角色是否是销售经理或管理员
-                roles: {
-                    url: b2bPath + '/account/role/currentRole',
-                    method: 'GET'
-                },
-                isManager: {
-                    url: b2bPath + '/account/role/isManager',
-                    method: 'GET'
-                },
-                isUser: {
-                    url: b2bPath + '/account/role/isUser',
-                    method: 'GET'
-                }
-            })
-        }])
         .factory('B2bPurcChange', ['$resource', 'BaseService', function($resource, BaseService) {
           var b2bPath = BaseService.getB2bUrl();
           return $resource(b2bPath + '/sale/changes/info/search', {}, {

+ 17 - 2
src/main/webapp/resources/js/common/services.js

@@ -63,7 +63,7 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 				}
 			}
 		};
-	}).factory('BaseService', ['$rootScope', function($rootScope) {
+	}).factory('BaseService', ['$rootScope', '$http', '$q', function($rootScope, $http, $q) {
 		return {
             getRootPath: function() {
             	var pathName = window.location.pathname.substring(1);
@@ -138,7 +138,22 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 				}
 			},
 			getB2bUrl: function () {
-				return 'http://10.1.51.88:8090/platform-b2b/';
+				if (!$rootScope.b2bUrl) {
+					// var defer = $q.defer();
+					// $http({
+					// 	method: 'get',
+					// 	url: 'b2b/sale/accessUrl'
+					// }).success(function (data) {
+					// 	defer.resolve(data);
+					// }).error(function (error) {
+					// 	defer.reject(error);
+					// });
+					// defer.promise.then(function (resolve) {
+					// 	$rootScope.b2bUrl = resolve.url;
+					// });
+					$rootScope.b2bUrl = this.getRootPath().indexOf('usoftmall.com') > -1 ? 'http://uas.ubtob.com' : 'http://192.168.253.12:9000/b2b-test';
+				}
+				return $rootScope.b2bUrl;
 			}
 		};
 	}]).factory('AuthenticationService', ['$http', 'SessionService', 'BaseService', 'SerializerUtil', function($http, SessionService, BaseService, SerializerUtil) {