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
ab12e838
Commit
ab12e838
authored
Jul 17, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改sightVisitorFlowByDay的返回格式
parent
9c5ed632
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
serverConfig.xml
serverConfig.xml
+2
-1
sightVisitorFlowByDayStrategy.ts
src/biz/strategies/left/sightVisitorFlowByDayStrategy.ts
+4
-2
replaceZeroWithRandomNumber.ts
src/util/replaceZeroWithRandomNumber.ts
+13
-0
No files found.
serverConfig.xml
View file @
ab12e838
<config>
<port>
3001
6
</port>
<port>
3001
7
</port>
<host>
192.168.0.132
</host>
</config>
\ No newline at end of file
src/biz/strategies/left/sightVisitorFlowByDayStrategy.ts
View file @
ab12e838
...
...
@@ -67,10 +67,12 @@ export class sightVisitorFlowByDayStrategy extends abstractDataStrategyLeft {
});
}
// Convert the map to the desired format
// Convert the map to the desired format
with "01时" format for hours
const
result
:
Array
<
{
key
:
string
,
count
:
number
,
status
:
string
}
>
=
[];
visitorCount
.
forEach
((
value
,
key
)
=>
{
result
.
push
({
key
,
count
:
value
.
count
,
status
:
value
.
status
});
const
formattedKey
=
key
.
toString
().
padStart
(
2
,
'0'
)
+
"时"
;
result
.
push
({
key
:
formattedKey
,
count
:
value
.
count
,
status
:
value
.
status
});
console
.
log
(
"here!"
);
});
return
result
;
...
...
src/util/replaceZeroWithRandomNumber.ts
0 → 100644
View file @
ab12e838
/**
* Checks if any value in the object is zero and replaces it with a random value.
* @param obj - The object to check.
* @param min - The minimum value for the random number.
* @param max - The maximum value for the random number.
*/
function
replaceZeroValuesWithRandom
(
obj
:
{
[
key
:
string
]:
number
},
min
:
number
,
max
:
number
)
{
for
(
let
key
in
obj
)
{
if
(
obj
[
key
]
===
0
)
{
obj
[
key
]
=
Math
.
floor
(
Math
.
random
()
*
(
max
-
min
+
1
))
+
min
;
}
}
}
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