Authored by 李奇

管理员查看用户中奖信息

... ... @@ -267,12 +267,11 @@ const whSurfController = {
userFind: async function(req, res) {
let obj = req.body;
// let result = await req.ctx(wheelSurfModel).userFind(obj);
let result = await req.ctx(wheelSurfModel).userFind(obj);
return res.json({
code: 200,
data: {}
data: result
});
},
... ...
... ... @@ -26,9 +26,28 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
return Activity.findOne({where: {id: act_id}});
}
userFind(obj) {
async userFind(obj) {
let pageNo = obj.pageNo || 1;
let pageSize = obj.pageSize || 20;
let actId = obj.act_id;
let len = await this.client.llenAsync(`turntable:${actId}:prize:users`);
return this.client.lrangeAsync(`turntable:${actId}:prize:users`, (pageNo - 1) * pageSize, pageNo * pageSize - 1).then(prizes => {
let afters = prizes.map(prize => {
prize = prize.split(':::');
return {
uid: prize[0],
type: prize[1],
name: prize[2],
time: +prize[3]
}
});
return {
total: len,
list: afters
}
});
}
async exportRecords(actId) {
... ...
... ... @@ -35,36 +35,17 @@
},
{
title: '奖品类型',
key: 'type',
render: (h, {row}) => {
return h('span', {}, pirzeType[row.type]);
}
key: 'type'
},
{
title: '奖品名称',
key: 'name'
},
{
title: '奖品图片',
key: 'img',
render: (h, {row}) => {
return h('img', {
attrs: {
src: row.img
},
style: {
width: '100%',
height: 'auto',
maxWidth: '70px'
}
});
}
},
{
title: '中奖时间',
key: 'endTime',
key: 'time',
render: (h, {row}) => {
return h('span', {}, moment(new Date(row.create_time).getTime()).format('YYYY-MM-DD HH:mm:ss '));
return h('span', {}, moment(row.time).format('YYYY-MM-DD HH:mm:ss'));
}
}
],
... ... @@ -94,18 +75,6 @@
pageSize: this.pageSize
};
if (this.uid) {
params.uid = this.uid;
}
if (this.type) {
params.type = this.type;
}
if (this.name) {
params.name = this.name;
}
this.list(params);
},
output() {
... ...