Skip to content

Commit 492793b

Browse files
committed
update
1 parent a495c51 commit 492793b

14 files changed

Lines changed: 716 additions & 629 deletions

File tree

.editorconfig

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
7+
[*]
8+
end_of_line = lf
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
# Tabs in JS unless otherwise specified
14+
[**.js]
15+
indent_style = space
16+
indent_size = 4
17+
18+
[**.html]
19+
indent_style = space
20+
indent_size = 4
21+
22+
[**.css]
23+
indent_style = space
24+
indent_size = 4
25+
26+
[**.sass]
27+
indent_style = space
28+
indent_size = 4

.jshintrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// ==============预定义变量============
66
"globals":{
77
"$": true,
8+
"GLOBAL": true,
9+
"global": true,
810
"jQuery": true,
911
"exports": true,
1012
"module": true,

controller/action/StatisticsAction.js

Lines changed: 86 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,127 @@
11
/**
22
* Created by chriscai on 2015/1/15.
33
*/
4-
5-
64
var BusinessService = require('../../service/BusinessService'),
75
_ = require('underscore'),
86
StatisticsService = require('../../service/StatisticsService');
97

10-
var log4js = require('log4js'),
8+
var log4js = require('log4js'),
119
logger = log4js.getLogger();
1210

1311
var StatisticsAction = {
1412

1513

16-
index : function(param, req, res){
14+
index: function(param, req, res) {
1715
var params = req.query,
18-
user = req.session.user;
16+
user = req.session.user;
1917

20-
var businessService = new BusinessService();
18+
var businessService = new BusinessService();
2119

22-
businessService.findBusinessByUser(user.loginName , function (err, item){
23-
res.render(param.tpl, { layout: false, user: user, index:'statistics' , statisticsTitle:param.statisticsTitle, items : item});
20+
businessService.findBusinessByUser(user.loginName, function(err, item) {
21+
res.render(param.tpl, {
22+
layout: false,
23+
user: user,
24+
index: 'statistics',
25+
statisticsTitle: param.statisticsTitle,
26+
items: item
27+
});
2428
});
2529
},
26-
projectTotal : function(param, req, res){
30+
projectTotal: function(param, req, res) {
2731
var params = req.query,
28-
user = req.session.user;
32+
user = req.session.user;
2933

30-
var businessService = new BusinessService();
34+
var businessService = new BusinessService();
3135

32-
businessService.findBusiness(function(err, items){
33-
res.render(param.tpl, { layout: false, user: user, index:'projectTotal' , statisticsTitle:param.statisticsTitle, items : items});
36+
businessService.findBusiness(function(err, items) {
37+
res.render(param.tpl, {
38+
layout: false,
39+
user: user,
40+
index: 'projectTotal',
41+
statisticsTitle: param.statisticsTitle,
42+
items: items
43+
});
3444
});
3545

3646
},
37-
queryByChart : function (param, req, res) {
38-
var statisticsService = new StatisticsService();
39-
if(!param.projectId || isNaN(param.projectId) || !param.timeScope){
40-
res.json({ret:0 , msg:'success' , data : {} });
41-
return ;
47+
queryByChart: function(param, req, res) {
48+
var statisticsService = new StatisticsService();
49+
if (!param.projectId || isNaN(param.projectId) || !param.timeScope) {
50+
res.json({
51+
ret: 0,
52+
msg: 'success',
53+
data: {}
54+
});
55+
return;
4256
}
43-
statisticsService.queryByChart({userName : param.user.loginName , projectId : param.projectId-0 , timeScope:param.timeScope-0 } , function (err, data){
44-
if(err){
45-
res.json({ret:-1, msg:"error"});
57+
statisticsService.queryByChart({
58+
userName: param.user.loginName,
59+
projectId: param.projectId - 0,
60+
timeScope: param.timeScope - 0
61+
}, function(err, data) {
62+
if (err) {
63+
res.json({
64+
ret: -1,
65+
msg: "error"
66+
});
4667
return;
4768
}
4869
res.json(data);
4970
});
5071
},
51-
queryByChartForAdmin : function (param, req, res) {
52-
var statisticsService = new StatisticsService();
53-
if(!param.projectId || isNaN(param.projectId) || !param.timeScope || param.user.role !=1 ){
54-
res.json({ret:0 , msg:'success' , data : {} });
55-
return ;
72+
queryByChartForAdmin: function(param, req, res) {
73+
var statisticsService = new StatisticsService();
74+
if (!param.projectId || isNaN(param.projectId) || !param.timeScope || param.user.role != 1) {
75+
res.json({
76+
ret: 0,
77+
msg: 'success',
78+
data: {}
79+
});
80+
return;
5681
}
5782

58-
statisticsService.queryByChart({ projectId : param.projectId-0 , timeScope:param.timeScope-0} , function (err, data){
59-
if(err){
60-
res.json({ret:-1, msg:"error"});
83+
statisticsService.queryByChart({
84+
projectId: param.projectId - 0,
85+
timeScope: param.timeScope - 0
86+
}, function(err, data) {
87+
if (err) {
88+
res.json({
89+
ret: -1,
90+
msg: "error"
91+
});
6192
return;
6293
}
6394
res.json(data);
6495
return;
6596
});
6697
},
67-
queryById:function (param , req, res ){
68-
var statisticsService = new StatisticsService();
69-
if(!req.query.projectId || isNaN(req.query.projectId) || !req.query.startDate){
70-
res.json({ret:0 , msg:'success' , data : {} });
71-
return ;
98+
queryById: function(param, req, res) {
99+
var statisticsService = new StatisticsService();
100+
if (!req.query.projectId || isNaN(req.query.projectId) || !req.query.startDate) {
101+
res.json({
102+
ret: 0,
103+
msg: 'success',
104+
data: {}
105+
});
106+
return;
72107
}
73-
statisticsService.queryById({userName : param.user.loginName , projectId : req.query.projectId-0 , startDate : new Date(param.startDate - 0 ) } , function (err, data){
74-
if(err){
75-
res.json({ret:-1 , msg:'error' , data : {} });
76-
}else {
77-
res.json({ret:0 , msg:'success' , data : data });
108+
statisticsService.queryById({
109+
userName: param.user.loginName,
110+
projectId: req.query.projectId - 0,
111+
startDate: new Date(param.startDate - 0)
112+
}, function(err, data) {
113+
if (err) {
114+
res.json({
115+
ret: -1,
116+
msg: 'error',
117+
data: {}
118+
});
119+
} else {
120+
res.json({
121+
ret: 0,
122+
msg: 'success',
123+
data: data
124+
});
78125
}
79126

80127
});

service/EmailService.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,24 @@ var getImageData = function(name, data) {
6767

6868
return {
6969
data: {
70+
width: 800,
71+
title: {
72+
text: "The last " + DAY_LENGTH + " days line charts"
73+
},
7074
xAxis: {
7175
categories: categories
7276
},
77+
yAxis: {
78+
min: 0,
79+
title: {
80+
text: 'Total'
81+
}
82+
},
7383
series: [{
7484
data: totalArray,
7585
name: "-"
7686
}]
77-
},
78-
options: {
79-
title: {
80-
text: "The last " + DAY_LENGTH + " days line charts"
81-
},
82-
"yAxis": {
83-
"title": {
84-
"text": "total"
85-
}
86-
}
87-
},
88-
width: 800
87+
}
8988
};
9089
};
9190

@@ -175,9 +174,9 @@ EmailService.prototype = {
175174
name = v.name;
176175
}); // jshint ignore:line
177176

178-
//测试代码
177+
// 测试代码
179178
if (sendObject) {
180-
if (sendObject.sendId && sendObject.sendId != applyId) {
179+
if (sendObject.sendId && sendObject.sendId !== applyId) {
181180
return;
182181
}
183182
if (sendObject.sendToList.length) {

0 commit comments

Comments
 (0)