Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fengchao-admin
Project
Project
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
tf-boys
fengchao-admin
Commits
ec45c4f8
Commit
ec45c4f8
authored
Aug 10, 2017
by
刘松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表格更新 解绑记录和账户
parent
f95b01d6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
17 deletions
+31
-17
app.bundle.js
app/built/app.bundle.js
+0
-0
common.bundle.js
app/built/common.bundle.js
+0
-0
detail.jsx
app/jsx/statistics/detail.jsx
+16
-8
index.js
config/index.js
+2
-6
statistics.js
lib/statistics.js
+13
-3
No files found.
app/built/app.bundle.js
View file @
ec45c4f8
This diff is collapsed.
Click to expand it.
app/built/common.bundle.js
View file @
ec45c4f8
This diff is collapsed.
Click to expand it.
app/jsx/statistics/detail.jsx
View file @
ec45c4f8
...
...
@@ -61,46 +61,54 @@ class Detail extends React.Component{
key
:
'charges'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
}
}
,
{
title
:
'注册时间'
,
dataIndex
:
'date'
,
key
:
'date'
,
width
:
100
,
render
:
text
=>
<
a
href=
"#"
>
{
text
}
</
a
>,
}
,
}
];
let
pluginMap
=
{
''
'publish-baijia'
:
'百家助手'
,
'publish-netease'
:
'网易助手'
}
let
users
=
this
.
props
.
data
.
detail
?
this
.
props
.
data
.
detail
.
users
:
[];
let
upstreams
=
this
.
props
.
data
.
detail
?
this
.
props
.
data
.
detail
.
upstreams
:
[];
let
auths
=
this
.
props
.
data
.
detail
?
this
.
props
.
data
.
detail
.
auths
:
[];
let
unbindhistorys
=
this
.
props
.
data
.
detail
?
this
.
props
.
data
.
detail
.
unbindhistorys
:
[]
;
let
unbindhistorys
=
this
.
props
.
data
.
detail
?
this
.
props
.
data
.
detail
.
unbindhistorys
:
0
;
let
upMap
=
{};
let
authMap
=
{};
let
unbindhistorysMap
=
{};
let
data
=
[];
for
(
let
i
=
0
;
i
<
upstreams
.
length
;
i
++
){
let
id
=
upstreams
[
i
][
'_id'
][
'creater'
];
upMap
[
id
]
=
upstreams
[
i
][
'count'
];
}
for
(
let
i
=
0
;
i
<
auths
.
length
;
i
++
){
let
id
=
upstreams
[
i
][
'_id'
][
'creater'
];
upMap
[
id
]
=
upstreams
[
i
][
'count'
];
let
id
=
auths
[
i
][
'userId'
];
if
(
authMap
[
id
])
authMap
[
id
].
push
(
auths
[
i
]);
else
authMap
[
id
]
=
[
auths
[
i
]];
}
for
(
let
i
=
0
;
i
<
unbindhistorys
.
length
;
i
++
){
let
id
=
u
pstreams
[
i
][
'_id'
][
'creater
'
];
u
pMap
[
id
]
=
upstream
s
[
i
][
'count'
];
let
id
=
u
nbindhistorys
[
i
][
'_id'
][
'userId
'
];
u
nbindhistorysMap
[
id
]
=
unbindhistory
s
[
i
][
'count'
];
}
for
(
let
i
=
0
;
i
<
users
.
length
;
i
++
){
let
item
=
users
[
i
];
let
charges
=
[
'-'
];
if
(
authMap
[
item
[
'_id'
]])
charges
=
authMap
[
item
[
'_id'
]
].
map
(
x
=>
pluginMap
[
x
.
plugin
]
+
':'
+
x
.
times
);
data
.
push
({
key
:
i
,
name
:
item
[
'username'
]
||
'-'
,
phone
:
item
[
'phone'
]
||
'-'
,
ups
:
upMap
[
item
[
'_id'
]
]
||
0
,
upsunbind
:
unbindhistorysMap
[
item
[
'_id'
]]
||
0
,
charges
:
charges
.
join
(
','
),
date
:
moment
(
item
[
'createdAt'
]).
format
(
'YYYY/MM/DD HH:mm:ss'
)
})
}
...
...
config/index.js
View file @
ec45c4f8
'use strict'
;
try
{
module
.
exports
=
require
(
'./config_current.js'
);
}
catch
(
err
)
{
module
.
exports
=
require
(
'./config.default.js'
);
}
\ No newline at end of file
module
.
exports
=
require
(
'./config.default.js'
);
\ No newline at end of file
lib/statistics.js
View file @
ec45c4f8
...
...
@@ -86,13 +86,23 @@ exports.detail = async(req,res,next) => {
}
];
const
unbindPipeline
=
[
{
'$match'
:
{
userId
:
{
'$in'
:
creaters
}
}},
{
'$group'
:
{
_id
:{
userId
:
'$userId'
},
count
:
{
$sum
:
1
}
}
}
];
const
upstreamPromise
=
await
upstream
.
aggregate
(
pipeline
);
const
authPromise
=
await
UserAuth
.
find
({
userId
:
{
'$in'
:
creaters
}});
const
upstreamUnbindHistoryPromise
=
await
UpstreamUnbindHistory
.
find
({
userId
:
{
'$in'
:
creaters
}}
);
const
authPromise
=
await
UserAuth
.
find
({
userId
:
{
'$in'
:
creaters
}})
.
limit
(
300
)
;
const
upstreamUnbindHistoryPromise
=
await
UpstreamUnbindHistory
.
aggregate
(
unbindPipeline
);
let
upstreams
=
[];
let
auths
=
[];
let
unbindhistorys
=
[]
let
unbindhistorys
=
0
await
Promise
.
all
([
upstreamPromise
,
authPromise
,
upstreamUnbindHistoryPromise
]).
then
(
([
_upstreams
,
_auths
,
_unbindhistorys
])
=>
{
upstreams
=
_upstreams
;
auths
=
_auths
;
...
...
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