Authored by htoooth

fix

@@ -12,7 +12,7 @@ class errorModel extends model { @@ -12,7 +12,7 @@ class errorModel extends model {
12 pageSize = pageSize || 10; 12 pageSize = pageSize || 10;
13 13
14 let recordsTotal = await this.mysql.query('SELECT COUNT(*) as count from error_report where app = ?', [app]).then(([r]) => r.count); 14 let recordsTotal = await this.mysql.query('SELECT COUNT(*) as count from error_report where app = ?', [app]).then(([r]) => r.count);
15 - let data = await this.mysql.query('SELECT id, app, type, preq_id, req_id, uid, udid, code, line, `column`, script, message, stack from error_report where app = ? order by create_time desc limit ?, ? ', [app, page, pageSize]).then(r => r.map(vars.handleItem)); 15 + let data = await this.mysql.query('SELECT id, app, type, preq_id, req_id, uid, udid, code, line, `column`, script, message, stack, create_time as time from error_report where app = ? order by create_time desc limit ?, ? ', [app, page, pageSize]).then(r => r.map(vars.handleItem));
16 16
17 return { 17 return {
18 recordsTotal, 18 recordsTotal,
@@ -12,7 +12,7 @@ class slowRouteModel extends model { @@ -12,7 +12,7 @@ class slowRouteModel extends model {
12 pageSize = pageSize || 10; 12 pageSize = pageSize || 10;
13 13
14 let recordsTotal = await this.mysql.query('SELECT COUNT(*) as count from slow_duration where app = ?', [app]).then(([r]) => r.count); 14 let recordsTotal = await this.mysql.query('SELECT COUNT(*) as count from slow_duration where app = ?', [app]).then(([r]) => r.count);
15 - let data = await this.mysql.query('SELECT id, app, `type`, preq_id, req_id, uid, udid, api, route, duration from slow_duration where app = ? ORDER BY create_time DESC LIMIT ?, ? ', [app, page, pageSize]).then(r => { 15 + let data = await this.mysql.query('SELECT id, app, `type`, preq_id, req_id, uid, udid, api, route, duration, create_time as time from slow_duration where app = ? ORDER BY create_time DESC LIMIT ?, ? ', [app, page, pageSize]).then(r => {
16 return r.map(vars.handleItem) 16 return r.map(vars.handleItem)
17 }); 17 });
18 18
1 -const APP_VALUE = {  
2 - 0: 'unknown',  
3 - 1: 'yohobuy',  
4 - 2: 'yohobuywap',  
5 - 3: 'blk',  
6 - 4: 'blkwap'  
7 -};  
8 -  
9 -const TYPE_VALUE = {  
10 - 0: 'unknown',  
11 - 1: 'api',  
12 - 2: 'route',  
13 - 3: 'firstscreen',  
14 - 4: 'domready',  
15 - 5: 'documentload'  
16 -};  
17 -  
18 -function handleItem(i) {  
19 - i.app = APP_VALUE[i.app];  
20 - i.type = TYPE_VALUE[i.type];  
21 - return i;  
22 -}  
23 -  
24 -module.exports = {  
25 - handleItem  
26 -};  
@@ -37,10 +37,11 @@ @@ -37,10 +37,11 @@
37 <table id="table-servers" class="table table-striped table-bordered"> 37 <table id="table-servers" class="table table-striped table-bordered">
38 <thead class=""> 38 <thead class="">
39 <tr> 39 <tr>
  40 + <td >时间</td>
40 <td >应用名称</td> 41 <td >应用名称</td>
41 <td >接口名称</td> 42 <td >接口名称</td>
42 <td >路由</td> 43 <td >路由</td>
43 - <td >时间</td> 44 + <td >耗时</td>
44 </thead> 45 </thead>
45 46
46 <tbody> 47 <tbody>
@@ -82,12 +83,14 @@ @@ -82,12 +83,14 @@
82 dataSrc: 'data', 83 dataSrc: 'data',
83 pageLength: 25, 84 pageLength: 25,
84 columns: [ 85 columns: [
  86 + {data: 'time'},
85 {data: 'app'}, 87 {data: 'app'},
86 {data: 'api'}, 88 {data: 'api'},
87 {data: 'route'}, 89 {data: 'route'},
88 {data: 'duration'}, 90 {data: 'duration'},
89 ], 91 ],
90 data: [{ 92 data: [{
  93 + time: '',
91 app: '', 94 app: '',
92 api: 0, 95 api: 0,
93 route: 0, 96 route: 0,
@@ -95,7 +98,7 @@ @@ -95,7 +98,7 @@
95 }], 98 }],
96 columnDefs: [{ 99 columnDefs: [{
97 orderable: false, 100 orderable: false,
98 - targets: [0,1,2,3] 101 + targets: [0,1,2,3, 4]
99 }] 102 }]
100 103
101 }); 104 });