Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shouzhouServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjinjing
shouzhouServer
Commits
d380a3b1
Commit
d380a3b1
authored
Jul 03, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
清理和更新错误处理
parent
902871d0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
5 deletions
+6
-5
guchengLoadStrategy.ts
src/biz/strategies/guchengLoadStrategy.ts
+0
-2
sightVisitorFlowByDayStrategy.ts
src/biz/strategies/sightVisitorFlowByDayStrategy.ts
+0
-1
strategyFactory.ts
src/biz/strategies/strategyFactory.ts
+2
-2
httpErrorHandler.ts
src/middleware/httpErrorHandler.ts
+4
-0
No files found.
src/biz/strategies/guchengLoadStrategy.ts
View file @
d380a3b1
...
...
@@ -5,5 +5,4 @@ export class guchengLoadStrategy implements dataStrategy {
execute
():
any
{
return
randomStatusGenerator
.
getRandomStatus
();
}
}
\ No newline at end of file
src/biz/strategies/sightVisitorFlowByDayStrategy.ts
View file @
d380a3b1
...
...
@@ -17,7 +17,6 @@ export class sightVisitorFlowByDayStrategy implements dataStrategy {
private
getVisitorFlowByDay
(
data
:
any
,
date
:
string
)
{
const
visitorCount
:
{
[
sight
:
string
]:
{
count
:
number
,
status
:
string
}
}
=
{};
data
.
forEach
(
row
=>
{
const
rowDate
=
excelSerialToJSDate
(
row
[
'游玩时间'
]);
let
rowDateString
=
''
;
...
...
src/biz/strategies/strategyFactory.ts
View file @
d380a3b1
...
...
@@ -5,7 +5,7 @@ import { gateStatusStrategy } from "./gateStatusStrategy";
import
{
sightVisitorFlowByHourStrategy
}
from
"./sightVisitorFlowPerHourStrategy"
;
import
{
guchengLoadStrategy
}
from
"./guchengLoadStrategy"
;
import
{
totalVisitorFlowStrategy
}
from
"./totalVisitorFlowStrategy"
;
import
{
totalVisitorFlowByHourStrategy
}
from
"./totalVisitorFlowByHourStrategy"
;
import
{
totalVisitorFlowByHourStrategy
}
from
"./totalVisitorFlowByHourStrategy"
;
export
class
strategyFactory
{
private
static
strategies
:
{
[
key
:
string
]:
new
()
=>
dataStrategy
}
=
{
...
...
@@ -21,7 +21,7 @@ export class strategyFactory {
static
createStrategy
(
type
:
string
):
dataStrategy
{
const
StrategyClass
=
this
.
strategies
[
type
];
if
(
!
StrategyClass
)
{
throw
new
Error
(
'Invalid strategy type'
);
throw
new
Error
(
'Invalid strategy type
.
'
);
}
return
new
StrategyClass
();
}
...
...
src/middleware/httpErrorHandler.ts
View file @
d380a3b1
...
...
@@ -19,6 +19,10 @@ export function httpErrorHandler(err, req, res, next) {
res
.
success
({
success
:
false
,
msg
:
err
.
message
,
code
:
504
});
next
();
}
else
if
(
err
.
message
==
"Invalid strategy type."
)
{
res
.
success
({
success
:
false
,
msg
:
"不支持该请求"
,
code
:
505
});
next
();
}
else
{
res
.
success
({
success
:
false
,
msg
:
err
.
message
,
code
:
500
});
next
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment