...
|
...
|
@@ -5,9 +5,9 @@ |
|
|
*/
|
|
|
const _ = require('lodash');
|
|
|
const moment = require('moment');
|
|
|
const excelExport = require('excel-export');
|
|
|
const UserModel = require('../models/user');
|
|
|
const camelcase = require('camelcase');
|
|
|
const {excel_export} = require('../../../utils/excel');
|
|
|
|
|
|
const DO_SUCCESS = '操作成功';
|
|
|
const GET_SUCCESS = '获取成功';
|
...
|
...
|
@@ -235,24 +235,7 @@ const userController = { |
|
|
exportUserList(req, res, next) {
|
|
|
let conf = {
|
|
|
name: 'mysheet',
|
|
|
cols: [
|
|
|
{
|
|
|
caption: '用户ID',
|
|
|
type: 'number'
|
|
|
},
|
|
|
{
|
|
|
caption: '昵称',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '手机号',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '创建时间',
|
|
|
type: 'string'
|
|
|
}
|
|
|
],
|
|
|
cols: ['用户ID', '昵称', '手机号', '创建时间'],
|
|
|
rows: []
|
|
|
};
|
|
|
|
...
|
...
|
@@ -269,11 +252,13 @@ const userController = { |
|
|
conf.rows.push(temp);
|
|
|
});
|
|
|
|
|
|
let exportFile = excelExport.execute(conf);
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
res.setHeader('Content-Disposition', 'attachment; filename=userList.xlsx');
|
|
|
res.end(exportFile, 'binary');
|
|
|
return excel_export({
|
|
|
title: conf.cols,
|
|
|
data: conf.rows,
|
|
|
fileName: 'userList',
|
|
|
sheetName: conf.name,
|
|
|
res
|
|
|
});
|
|
|
})
|
|
|
.catch(next);
|
|
|
},
|
...
|
...
|
@@ -281,39 +266,14 @@ const userController = { |
|
|
let conf = {
|
|
|
name: 'myInfoSheet',
|
|
|
cols: [
|
|
|
{
|
|
|
caption: '用户ID',
|
|
|
type: 'number'
|
|
|
},
|
|
|
{
|
|
|
caption: '昵称',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '生日',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '性别',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '手机号',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: 'email',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '省份',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '城市',
|
|
|
type: 'string'
|
|
|
},
|
|
|
],
|
|
|
'用户ID',
|
|
|
'昵称',
|
|
|
'生日',
|
|
|
'性别',
|
|
|
'手机号',
|
|
|
'email',
|
|
|
'省份',
|
|
|
'城市'],
|
|
|
rows: []
|
|
|
};
|
|
|
|
...
|
...
|
@@ -334,38 +294,24 @@ const userController = { |
|
|
conf.rows.push(temp);
|
|
|
});
|
|
|
|
|
|
let exportFile = excelExport.execute(conf);
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
res.setHeader('Content-Disposition', 'attachment; filename=userInfoList.xlsx');
|
|
|
res.end(exportFile, 'binary');
|
|
|
return excel_export({
|
|
|
title: conf.cols,
|
|
|
data: conf.rows,
|
|
|
fileName: 'userInfoList',
|
|
|
sheetName: conf.name,
|
|
|
res
|
|
|
});
|
|
|
}).catch(next);
|
|
|
},
|
|
|
exportPrizeUserList(req, res, next) {
|
|
|
let conf = {
|
|
|
name: 'myInfoSheet',
|
|
|
cols: [
|
|
|
{
|
|
|
caption: '用户ID',
|
|
|
type: 'number'
|
|
|
},
|
|
|
{
|
|
|
caption: '昵称',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '手机号',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '地址',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '鞋码',
|
|
|
type: 'number'
|
|
|
}
|
|
|
],
|
|
|
'用户ID',
|
|
|
'昵称',
|
|
|
'手机号',
|
|
|
'地址',
|
|
|
'鞋码'],
|
|
|
rows: []
|
|
|
};
|
|
|
|
...
|
...
|
@@ -383,11 +329,13 @@ const userController = { |
|
|
conf.rows.push(temp);
|
|
|
});
|
|
|
|
|
|
let exportFile = excelExport.execute(conf);
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
res.setHeader('Content-Disposition', 'attachment; filename=userInfoList.xlsx');
|
|
|
res.end(exportFile, 'binary');
|
|
|
return excel_export({
|
|
|
title: conf.cols,
|
|
|
data: conf.rows,
|
|
|
fileName: 'prizeUserList',
|
|
|
sheetName: conf.name,
|
|
|
res
|
|
|
});
|
|
|
}).catch(next);
|
|
|
},
|
|
|
userLoginLog(req, res) {
|
...
|
...
|
@@ -404,28 +352,7 @@ const userController = { |
|
|
|
|
|
let conf = {
|
|
|
name: 'mysheet',
|
|
|
cols: [
|
|
|
{
|
|
|
caption: '用户id',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '登录时间',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '平台',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: '地址',
|
|
|
type: 'string'
|
|
|
},
|
|
|
{
|
|
|
caption: 'ip',
|
|
|
type: 'string'
|
|
|
}
|
|
|
],
|
|
|
cols: ['用户id', '登录时间', '平台', '地址', 'ip'],
|
|
|
rows: []
|
|
|
};
|
|
|
|
...
|
...
|
@@ -443,11 +370,13 @@ const userController = { |
|
|
conf.rows.push(temp);
|
|
|
});
|
|
|
|
|
|
let exportFile = excelExport.execute(conf);
|
|
|
|
|
|
res.setHeader('Content-Type', 'application/vnd.openxmlformats');
|
|
|
res.setHeader('Content-Disposition', 'attachment; filename=user-login-log.xlsx');
|
|
|
res.end(exportFile, 'binary');
|
|
|
return excel_export({
|
|
|
title: conf.cols,
|
|
|
data: conf.rows,
|
|
|
fileName: 'user-login-log',
|
|
|
sheetName: conf.name,
|
|
|
res
|
|
|
});
|
|
|
})
|
|
|
.catch(next);
|
|
|
}
|
...
|
...
|
|