Browse Source

b2b请求

yangc 8 years ago
parent
commit
39ab3a78f1

+ 56 - 52
src/main/webapp/resources/js/common/b2bServices.js

@@ -1,4 +1,4 @@
-define([ 'angular', 'common/utils', 'big'], function(angular, utils) {
+define([ 'angular', 'common/services', 'common/utils', 'big'], function(angular, utils) {
     'use strict';
     'use strict';
     angular.module('common.b2bServices', [ 'common.utils', 'ngResource' ])
     angular.module('common.b2bServices', [ 'common.utils', 'ngResource' ])
         .factory('SearchFilter', function() {
         .factory('SearchFilter', function() {
@@ -93,6 +93,7 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils) {
         }])
         }])
         .factory('VendorService', ['$http', '$resource', 'BaseService', function($http, $resource, BaseService) {
         .factory('VendorService', ['$http', '$resource', 'BaseService', function($http, $resource, BaseService) {
             var rootPath = BaseService.getRootPath();
             var rootPath = BaseService.getRootPath();
+            var b2bPath = BaseService.getB2bUrl();
             return {
             return {
                 getCount: function(success) {
                 getCount: function(success) {
                     var request = $http.get(rootPath + '/vendor/count');
                     var request = $http.get(rootPath + '/vendor/count');
@@ -100,181 +101,183 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils) {
                         success.call(null, data);
                         success.call(null, data);
                     });
                     });
                 },
                 },
-                customer: $resource('http://192.168.253.12:9000/b2b-test/vendor/customer/info/search', {}),
-                vendor: $resource('http://192.168.253.12:9000/b2b-test/vendor/info/search', {}),
-                userInfo: $resource('http://192.168.253.12:9000/b2b-test/vendor/userInfo/:uu', {}),
-                user: $resource('http://192.168.253.12:9000/b2b-test/vendor/user', {}),
-                exportXls: $resource('http://192.168.253.12:9000/b2b-test/vendor/customer/xls/permission', {})
+                customer: $resource(b2bPath + '/vendor/customer/info/search', {}),
+                vendor: $resource(b2bPath + '/vendor/info/search', {}),
+                userInfo: $resource(b2bPath + '/vendor/userInfo/:uu', {}),
+                user: $resource(b2bPath + '/vendor/user', {}),
+                exportXls: $resource(b2bPath + '/vendor/customer/xls/permission', {})
             };
             };
         }])
         }])
-        .factory('Vendor', ['$resource', function($resource){
-            return $resource('http://192.168.253.12:9000/b2b-test/purc/vendor/:id', {}, {
+        .factory('Vendor', ['$resource', 'BaseService', function($resource, BaseService){
+            var b2bPath = BaseService.getB2bUrl();
+            return $resource(b2bPath + '/purc/vendor/:id', {}, {
                 getServe: {
                 getServe: {
                     // 调取使用uas系统的供应商信息
                     // 调取使用uas系统的供应商信息
-                    url: 'http://192.168.253.12:9000/b2b-test/purc/vendor/serve',
+                    url: b2bPath + '/purc/vendor/serve',
                     isArray: true
                     isArray: true
                 },
                 },
                 getVendor: {
                 getVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/info/search'
+                    url: b2bPath + '/vendor/info/search'
                 },
                 },
                 getServicer: {
                 getServicer: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/servicer'
+                    url: b2bPath + '/vendor/servicer'
                 },
                 },
                 getVendorDetail: {
                 getVendorDetail: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/:id/info',
+                    url: b2bPath + '/vendor/:id/info',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 getCustomerDetail: {
                 getCustomerDetail: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/customer/:id/info',
+                    url: b2bPath + '/vendor/customer/:id/info',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 saveContact: {
                 saveContact: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/savecontact',
+                    url: b2bPath + '/vendor/savecontact',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 contacts: {
                 contacts: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/contacts/:venduu',
+                    url: b2bPath + '/vendor/contacts/:venduu',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 deleteContact: {
                 deleteContact: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/deleteContact/:id',
+                    url: b2bPath + '/vendor/deleteContact/:id',
                     method: 'DELETE'
                     method: 'DELETE'
                 },
                 },
                 getSimilarVendors: {
                 getSimilarVendors: {
-                    url: 'http://192.168.253.12:9000/b2b-test/search/similarVendors',
+                    url: b2bPath + '/search/similarVendors',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 getSimilarCustomers: {
                 getSimilarCustomers: {
-                    url: 'http://192.168.253.12:9000/b2b-test/search/similarCustomers',
+                    url: b2bPath + '/search/similarCustomers',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 saveCustContact: {
                 saveCustContact: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/saveCustomerContact',
+                    url: b2bPath + '/vendor/saveCustomerContact',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 custContacts: {
                 custContacts: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/custContacts/:enuu',
+                    url: b2bPath + '/vendor/custContacts/:enuu',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 getSimilarEnterprise: {
                 getSimilarEnterprise: {
-                    url: 'http://192.168.253.12:9000/b2b-test/search/similarEnterprise',
+                    url: b2bPath + '/search/similarEnterprise',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 vendorInfo: {
                 vendorInfo: {
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/vendorInfo',
+                    url: b2bPath + '/vendor/vendorInfo',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 enterpriseInfo: {
                 enterpriseInfo: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/enterprise/info/:bussinessCode',
+                    url: b2bPath + '/account/enterprise/info/:bussinessCode',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 setRead:{
                 setRead:{
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/customer/setRead',
+                    url: b2bPath + '/vendor/customer/setRead',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 setVendorRead:{
                 setVendorRead:{
-                    url: 'http://192.168.253.12:9000/b2b-test/vendor/vendor/setRead',
+                    url: b2bPath + '/vendor/vendor/setRead',
                     method: 'POST'
                     method: 'POST'
                 }
                 }
             });
             });
         }])
         }])
-        .factory('AccountUser', ['$resource', function($resource) {
-            return $resource('http://192.168.253.12:9000/b2b-test/account/user/:uu', {}, {
+        .factory('AccountUser', ['$resource', 'BaseService', function($resource, BaseService) {
+            var b2bPath = BaseService.getB2bUrl();
+            return $resource('/account/user/:uu', {}, {
                 getAll: {
                 getAll: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user',
+                    url: b2bPath + '/account/user',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 findUsers: {
                 findUsers: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/customer/:uu',
+                    url: b2bPath + '/account/user/customer/:uu',
                     method: 'POST',
                     method: 'POST',
                     isArray: true
                     isArray: true
                 },
                 },
                 addUserToVendor: {
                 addUserToVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/bindUserToVendor/:uu',
+                    url: b2bPath + '/account/user/bindUserToVendor/:uu',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 transferUserToVendor: {
                 transferUserToVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/transferUserToVendor/:uu',
+                    url: b2bPath + '/account/user/transferUserToVendor/:uu',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 transferMyDistribute: {
                 transferMyDistribute: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/transferMyDistribute',
+                    url: b2bPath + '/account/user/transferMyDistribute',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 findDistribute: {
                 findDistribute: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/findDistribute',
+                    url: b2bPath + '/account/user/findDistribute',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 getDistribute: {
                 getDistribute: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/getDistribute/:custUU',
+                    url: b2bPath + '/account/user/getDistribute/:custUU',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 getEnTransfer: {
                 getEnTransfer: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/getEnTransfer/:custUU',
+                    url: b2bPath + '/account/user/getEnTransfer/:custUU',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 findVendor: {
                 findVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/findVendor/:uu',
+                    url: b2bPath + '/account/user/findVendor/:uu',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 findChooseVendor: {
                 findChooseVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/removeVendor/:uu',
+                    url: b2bPath + '/account/user/removeVendor/:uu',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 removeChooseVendor: {
                 removeChooseVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/removeVendor/:uu',
+                    url: b2bPath + '/account/user/removeVendor/:uu',
                     method: 'POST',
                     method: 'POST',
                     isArray: true
                     isArray: true
                 },
                 },
                 addVendor: {
                 addVendor: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/addVendor/:uu',
+                    url: b2bPath + '/account/user/addVendor/:uu',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 update: {
                 update: {
                     method: 'PUT'
                     method: 'PUT'
                 },
                 },
                 updateRole: {
                 updateRole: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/update/role',
+                    url: b2bPath + '/account/user/update/role',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 checkPassword: {
                 checkPassword: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/checkPassword',
+                    url: b2bPath + '/account/user/checkPassword',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 updatePassword: {
                 updatePassword: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/updatePassword',
+                    url: b2bPath + '/account/user/updatePassword',
                     method: 'POST'
                     method: 'POST'
                 },
                 },
                 telEnable: {
                 telEnable: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/telEnable',
+                    url: b2bPath + '/account/user/telEnable',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 emailEnable: {
                 emailEnable: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/emailEnable',
+                    url: b2bPath + '/account/user/emailEnable',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 findUsersByKeyword: {
                 findUsersByKeyword: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/info',
+                    url: b2bPath + '/account/user/info',
                     method: 'GET',
                     method: 'GET',
                     isArray: true
                     isArray: true
                 },
                 },
                 getUpdatePasswordUrl: {
                 getUpdatePasswordUrl: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/getUrl',
+                    url: b2bPath + '/account/user/getUrl',
                     params: {
                     params: {
                         "_operate": "updatePassword"
                         "_operate": "updatePassword"
                     },
                     },
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 getCloudCenterUrl: {
                 getCloudCenterUrl: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/user/getUrl',
+                    url: b2bPath + '/account/user/getUrl',
                     params: {
                     params: {
                         "_operate": "cloudcenter"
                         "_operate": "cloudcenter"
                     },
                     },
@@ -282,19 +285,20 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils) {
                 }
                 }
             });
             });
         }])
         }])
-        .factory('CurrentRole', ['$resource', function($resource) {
-            return $resource('http://192.168.253.12:9000/b2b-test/account/role', {}, {
+        .factory('CurrentRole', ['$resource', 'BaseService', function($resource, BaseService) {
+            var b2bPath = BaseService.getB2bUrl();
+            return $resource('/account/role', {}, {
                 //当前企业对应的角色是否是销售经理或管理员
                 //当前企业对应的角色是否是销售经理或管理员
                 roles: {
                 roles: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/role/currentRole',
+                    url: b2bPath + '/account/role/currentRole',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 isManager: {
                 isManager: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/role/isManager',
+                    url: b2bPath + '/account/role/isManager',
                     method: 'GET'
                     method: 'GET'
                 },
                 },
                 isUser: {
                 isUser: {
-                    url: 'http://192.168.253.12:9000/b2b-test/account/role/isUser',
+                    url: b2bPath + '/account/role/isUser',
                     method: 'GET'
                     method: 'GET'
                 }
                 }
             })
             })

+ 3 - 0
src/main/webapp/resources/js/common/services.js

@@ -136,6 +136,9 @@ define([ 'angular', 'common/utils', 'big'], function(angular, utils, Big) {
 				}else {
 				}else {
 					return currentPathname.replace(currentModule, nextModule);
 					return currentPathname.replace(currentModule, nextModule);
 				}
 				}
+			},
+			getB2bUrl: function () {
+				return 'http://10.1.51.124:8090/platform-b2b';
 			}
 			}
 		};
 		};
 	}]).factory('AuthenticationService', ['$http', 'SessionService', 'BaseService', 'SerializerUtil', function($http, SessionService, BaseService, SerializerUtil) {
 	}]).factory('AuthenticationService', ['$http', 'SessionService', 'BaseService', 'SerializerUtil', function($http, SessionService, BaseService, SerializerUtil) {