Commit ec45c4f8 authored by 刘松's avatar 刘松

表格更新 解绑记录和账户

parent f95b01d6
This diff is collapsed.
This diff is collapsed.
......@@ -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 = upstreams[i]['_id']['creater'];
upMap[id] = upstreams[i]['count'];
let id = unbindhistorys[i]['_id']['userId'];
unbindhistorysMap[id] = unbindhistorys[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')
})
}
......
'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
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment