|
@@ -1,6 +1,6 @@
|
|
|
define([ 'app/app' ], function(app) {
|
|
define([ 'app/app' ], function(app) {
|
|
|
//在售商品信息统计
|
|
//在售商品信息统计
|
|
|
- app.register.controller('statsDataCtrl', ['$scope', 'Goods', 'toaster', 'ComponentActive', 'BrandActive', 'CommonCountAPI', 'User', '$http', function($scope, Goods, toaster, ComponentActive, BrandActive, CommonCountAPI, User, $http) {
|
|
|
|
|
|
|
+ app.register.controller('statsDataCtrl', ['$scope', 'Goods', 'toaster', 'ComponentActive', 'BrandActive', 'CommonCountAPI', 'User', '$http', '$q', 'Loading', function($scope, Goods, toaster, ComponentActive, BrandActive, CommonCountAPI, User, $http, $q, Loading) {
|
|
|
$scope.dateArea = 'oneMonth';
|
|
$scope.dateArea = 'oneMonth';
|
|
|
var _formatDate = function (date, fmt) {
|
|
var _formatDate = function (date, fmt) {
|
|
|
if (!date) {
|
|
if (!date) {
|
|
@@ -102,76 +102,124 @@ define([ 'app/app' ], function(app) {
|
|
|
}
|
|
}
|
|
|
initData();
|
|
initData();
|
|
|
};
|
|
};
|
|
|
|
|
+ var getSeekInfo = function (commonUrl) {
|
|
|
|
|
+ // 询价信息
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
|
|
+ $http({
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ url: commonUrl + '/inquiry/public/getInquiryCountData',
|
|
|
|
|
+ params: {startDate: $scope.startFormatDate, endDate: $scope.endFormatDate}
|
|
|
|
|
+ }).success(function (data) {
|
|
|
|
|
+ defer.resolve(data);
|
|
|
|
|
+ }).error(function (err) {
|
|
|
|
|
+ defer.reject(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ return defer.promise;
|
|
|
|
|
+ }
|
|
|
|
|
+ var getAddEnUserCount = function (ssoUrl) {
|
|
|
|
|
+ // 新增企业用户数
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
|
|
+ $http({
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ url: ssoUrl + '/api/userspace/inputTime/count/apps',
|
|
|
|
|
+ params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
|
|
|
|
|
+ }).success(function (data) {
|
|
|
|
|
+ defer.resolve(data);
|
|
|
|
|
+ }).error(function (err) {
|
|
|
|
|
+ defer.reject(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ return defer.promise;
|
|
|
|
|
+ }
|
|
|
|
|
+ var getAddUserCount = function (ssoUrl) {
|
|
|
|
|
+ // 新增个人用户
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
|
|
+ $http({
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ url: ssoUrl + '/api/user/inputTime/count/apps',
|
|
|
|
|
+ params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
|
|
|
|
|
+ }).success(function (data) {
|
|
|
|
|
+ defer.resolve(data);
|
|
|
|
|
+ }).error(function (err) {
|
|
|
|
|
+ defer.reject(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ return defer.promise;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var getNoLoginInfo = function (ssoUrl) {
|
|
|
|
|
+ // 半年未登录用户数
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
|
|
+ $http({
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ dataType: 'json',
|
|
|
|
|
+ url: ssoUrl + '/api/user/count/notlgoin/month',
|
|
|
|
|
+ params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, months: '6,12,24'}
|
|
|
|
|
+ }).success(function (data) {
|
|
|
|
|
+ defer.resolve(data);
|
|
|
|
|
+ }).error(function (err) {
|
|
|
|
|
+ defer.reject(err);
|
|
|
|
|
+ });
|
|
|
|
|
+ return defer.promise;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var getProductData = function () {
|
|
|
|
|
+ // 上传产品个数
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
|
|
+ Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {
|
|
|
|
|
+ defer.resolve(data.data);
|
|
|
|
|
+ }, function (err) {
|
|
|
|
|
+ defer.reject(err);
|
|
|
|
|
+ toaster.pop('error', '数据获取失败,请重试')
|
|
|
|
|
+ });
|
|
|
|
|
+ return defer.promise;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// 获取帐户中心数据和询价接口数据
|
|
// 获取帐户中心数据和询价接口数据
|
|
|
- var getDevOrProdData = function () {
|
|
|
|
|
|
|
+ var getAllData = function (addStartFormatDate, addEndFormatDate, startFormatDate, endFormatDate) {
|
|
|
|
|
+ var defer = $q.defer();
|
|
|
User.isDevOrProd(null, function (data) {
|
|
User.isDevOrProd(null, function (data) {
|
|
|
- $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',
|
|
|
|
|
- url: $scope.commonUrl + '/inquiry/public/getInquiryCountData',
|
|
|
|
|
- params: {startDate: $scope.startFormatDate, endDate: $scope.endFormatDate}
|
|
|
|
|
- }).success(function (data) {
|
|
|
|
|
- $scope.inquiryData = data
|
|
|
|
|
- }).error(function () {
|
|
|
|
|
- toaster.pop('error', '获取未处理审批数据失败');
|
|
|
|
|
- });
|
|
|
|
|
- // 新增企业用户数
|
|
|
|
|
- $http({
|
|
|
|
|
- method: 'get',
|
|
|
|
|
- dataType: 'json',
|
|
|
|
|
- url: $scope.ssoUrl + '/api/userspace/inputTime/count/apps',
|
|
|
|
|
- params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
|
|
|
|
|
- }).success(function (data) {
|
|
|
|
|
- $scope.newAddUserSpaceData = data.content
|
|
|
|
|
- }).error(function () {
|
|
|
|
|
- toaster.pop('error', '获取未处理审批数据失败');
|
|
|
|
|
- });
|
|
|
|
|
- // 新增个人用户
|
|
|
|
|
- $http({
|
|
|
|
|
- method: 'get',
|
|
|
|
|
- dataType: 'json',
|
|
|
|
|
- url: $scope.ssoUrl + '/api/user/inputTime/count/apps',
|
|
|
|
|
- params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, fromApps:'mall,b2b'}
|
|
|
|
|
- }).success(function (data) {
|
|
|
|
|
- $scope.newAddUserData = data.content
|
|
|
|
|
- }).error(function () {
|
|
|
|
|
- toaster.pop('error', '获取未处理审批数据失败');
|
|
|
|
|
- });
|
|
|
|
|
- // 半年未登录用户数
|
|
|
|
|
- $http({
|
|
|
|
|
- method: 'get',
|
|
|
|
|
- dataType: 'json',
|
|
|
|
|
- url: $scope.ssoUrl + '/api/user/count/notlgoin/month',
|
|
|
|
|
- params: {start: $scope.addStartFormatDate, end: $scope.addEndFormatDate, months: '6,12,24'}
|
|
|
|
|
- }).success(function (data) {
|
|
|
|
|
- $scope.monthLogoData = data
|
|
|
|
|
- }).error(function () {
|
|
|
|
|
- toaster.pop('error', '获取未处理审批数据失败');
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ var ssoUrl = data.data == 'success' ? 'https://sso.ubtob.com' : 'http://192.168.253.6:32323',
|
|
|
|
|
+ // uasUrl = data.data == 'success' ? 'http://uas.ubtob.com' : 'http://192.168.253.12:9000/b2b-test',
|
|
|
|
|
+ commonUrl = data.data == 'success' ? 'https://api-inquiry.usoftmall.com' : 'http://218.17.158.219:24000';
|
|
|
|
|
+ defer.resolve([
|
|
|
|
|
+ getSeekInfo(commonUrl),
|
|
|
|
|
+ getAddEnUserCount(ssoUrl),
|
|
|
|
|
+ getAddUserCount(ssoUrl),
|
|
|
|
|
+ getNoLoginInfo(ssoUrl),
|
|
|
|
|
+ getProductData()
|
|
|
|
|
+ ]);
|
|
|
}, function (response) {
|
|
}, function (response) {
|
|
|
toaster.pop('error', '获取运行环境失败');
|
|
toaster.pop('error', '获取运行环境失败');
|
|
|
|
|
+ defer.reject(response);
|
|
|
});
|
|
});
|
|
|
|
|
+ return defer.promise;
|
|
|
};
|
|
};
|
|
|
// 获取不同时间阶段的相关数据
|
|
// 获取不同时间阶段的相关数据
|
|
|
var initData = function () {
|
|
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)
|
|
|
|
|
|
|
+ var addStartDate = new Date($scope.startDate.getTime() + 24 * 60 * 60 * 1000),
|
|
|
|
|
+ addEndDate = new Date($scope.endDate.getTime() + 24 * 60 * 60 * 1000);
|
|
|
$scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
|
|
$scope.addStartFormatDate = _formatDate(addStartDate, 'yyyy-MM-dd');
|
|
|
$scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
|
|
$scope.addEndFormatDate = _formatDate(addEndDate, 'yyyy-MM-dd');
|
|
|
$scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
|
|
$scope.startFormatDate = _formatDate($scope.startDate, 'yyyy-MM-dd');
|
|
|
$scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
|
|
$scope.endFormatDate = _formatDate($scope.endDate, 'yyyy-MM-dd');
|
|
|
- getDevOrProdData();
|
|
|
|
|
- // 上传产品个数
|
|
|
|
|
- Goods.getProductsCmp({fromDate: $scope.startDate.getTime(), toDate: $scope.endDate.getTime()}, function (data) {
|
|
|
|
|
- $scope.productsCount = data.data
|
|
|
|
|
- }, function (res) {
|
|
|
|
|
- toaster.pop('error', '数据获取失败,请重试')
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ $q.all([getAllData()]).then(function (resolve) {
|
|
|
|
|
+ Loading.show();
|
|
|
|
|
+ $q.all(resolve[0]).then(function (dataListResolve) {
|
|
|
|
|
+ $scope.inquiryData = dataListResolve[0];
|
|
|
|
|
+ $scope.newAddUserSpaceData = dataListResolve[1].content;
|
|
|
|
|
+ $scope.newAddUserData = dataListResolve[2].content;
|
|
|
|
|
+ $scope.monthLogoData = dataListResolve[3];
|
|
|
|
|
+ $scope.productsCount = dataListResolve[4];
|
|
|
|
|
+ Loading.hide();
|
|
|
|
|
+ }, function (dataListReject) {
|
|
|
|
|
+ console.log(dataListReject);
|
|
|
|
|
+ Loading.hide();
|
|
|
|
|
+ })
|
|
|
|
|
+ }, function (reject) {
|
|
|
|
|
+ console.log(reject);
|
|
|
|
|
+ })
|
|
|
};
|
|
};
|
|
|
initData();
|
|
initData();
|
|
|
|
|
|