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
acd7876c
Commit
acd7876c
authored
Jul 24, 2024
by
Leo Zheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改返回参数
parent
0499f80a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
visitorGenderProfileStrategy.ts
...biz/map2/strategies/right/visitorGenderProfileStrategy.ts
+20
-15
No files found.
src/biz/map2/strategies/right/visitorGenderProfileStrategy.ts
View file @
acd7876c
import
{
abstractCustomerProfileStrategy
}
from
"./abstractCustomerProfileStrategy"
;
import
{
abstractCustomerProfileStrategy
}
from
"./abstractCustomerProfileStrategy"
;
import
paramChecker
from
"../../../../util/paramChecker"
;
import
paramChecker
from
"../../../../util/paramChecker"
;
export
default
class
visitorGenderProfileStrategy
extends
abstractCustomerProfileStrategy
{
export
default
class
visitorGenderProfileStrategy
extends
abstractCustomerProfileStrategy
{
...
@@ -11,33 +11,38 @@ export default class visitorGenderProfileStrategy extends abstractCustomerProfil
...
@@ -11,33 +11,38 @@ export default class visitorGenderProfileStrategy extends abstractCustomerProfil
processData
(
data
:
any
,
type
:
string
):
any
{
processData
(
data
:
any
,
type
:
string
):
any
{
let
total
=
0
,
maleCount
=
0
,
femaleCount
=
0
;
let
total
=
0
,
maleCount
=
0
,
femaleCount
=
0
;
if
(
type
==
'ticket'
)
{
if
(
type
==
=
'ticket'
)
{
data
.
forEach
((
row
)
=>
{
data
.
forEach
((
row
)
=>
{
total
++
;
total
++
;
if
(
row
[
'性别'
]
===
'男'
)
{
if
(
row
[
'性别'
]
===
'男'
)
{
maleCount
++
;
maleCount
++
;
}
}
else
{
else
{
femaleCount
++
;
femaleCount
++
;
}
}
});
});
}
else
if
(
type
==
'ecommerce'
)
{
}
else
if
(
type
==
=
'ecommerce'
)
{
total
=
3429
;
total
=
3429
;
maleCount
=
Math
.
floor
(
Math
.
random
()
*
1700
)
+
100
;
maleCount
=
Math
.
floor
(
Math
.
random
()
*
1700
)
+
100
;
femaleCount
=
total
-
maleCount
;
femaleCount
=
total
-
maleCount
;
}
}
const
result
=
type
===
'ticket'
?{
const
maleRatio
=
((
maleCount
/
total
)
*
100
).
toFixed
(
2
)
+
'%'
;
总游客数
:
total
,
const
femaleRatio
=
((
femaleCount
/
total
)
*
100
).
toFixed
(
2
)
+
'%'
;
男性游客
:
maleCount
,
女性游客
:
femaleCount
}
:
{
总会员数
:
total
,
男性会员
:
maleCount
,
女性会员
:
femaleCount
}
return
Object
.
entries
(
result
).
map
(([
key
,
value
])
=>
({
key
,
value
}));
const
result
=
{
totalList
:
{
name
:
type
===
'ticket'
?
'总游客数'
:
'总会员数'
,
value
:
total
,
unit
:
'人'
},
sexRatio
:
{
male
:
maleCount
,
maleRatio
:
maleRatio
,
female
:
femaleCount
,
femaleRatio
:
femaleRatio
}
}
};
return
result
;
}
}
}
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