Authored by 李奇

管理员查看用户中奖信息

@@ -267,12 +267,11 @@ const whSurfController = { @@ -267,12 +267,11 @@ const whSurfController = {
267 267
268 userFind: async function(req, res) { 268 userFind: async function(req, res) {
269 let obj = req.body; 269 let obj = req.body;
270 -  
271 - // let result = await req.ctx(wheelSurfModel).userFind(obj); 270 + let result = await req.ctx(wheelSurfModel).userFind(obj);
272 271
273 return res.json({ 272 return res.json({
274 code: 200, 273 code: 200,
275 - data: {} 274 + data: result
276 }); 275 });
277 }, 276 },
278 277
@@ -26,9 +26,28 @@ class ActWheelSurfModel extends global.yoho.BaseModel { @@ -26,9 +26,28 @@ class ActWheelSurfModel extends global.yoho.BaseModel {
26 return Activity.findOne({where: {id: act_id}}); 26 return Activity.findOne({where: {id: act_id}});
27 } 27 }
28 28
29 - userFind(obj) { 29 + async userFind(obj) {
30 let pageNo = obj.pageNo || 1; 30 let pageNo = obj.pageNo || 1;
31 let pageSize = obj.pageSize || 20; 31 let pageSize = obj.pageSize || 20;
  32 + let actId = obj.act_id;
  33 +
  34 + let len = await this.client.llenAsync(`turntable:${actId}:prize:users`);
  35 + return this.client.lrangeAsync(`turntable:${actId}:prize:users`, (pageNo - 1) * pageSize, pageNo * pageSize - 1).then(prizes => {
  36 + let afters = prizes.map(prize => {
  37 + prize = prize.split(':::');
  38 + return {
  39 + uid: prize[0],
  40 + type: prize[1],
  41 + name: prize[2],
  42 + time: +prize[3]
  43 + }
  44 + });
  45 +
  46 + return {
  47 + total: len,
  48 + list: afters
  49 + }
  50 + });
32 } 51 }
33 52
34 async exportRecords(actId) { 53 async exportRecords(actId) {
@@ -35,36 +35,17 @@ @@ -35,36 +35,17 @@
35 }, 35 },
36 { 36 {
37 title: '奖品类型', 37 title: '奖品类型',
38 - key: 'type',  
39 - render: (h, {row}) => {  
40 - return h('span', {}, pirzeType[row.type]);  
41 - } 38 + key: 'type'
42 }, 39 },
43 { 40 {
44 title: '奖品名称', 41 title: '奖品名称',
45 key: 'name' 42 key: 'name'
46 }, 43 },
47 { 44 {
48 - title: '奖品图片',  
49 - key: 'img',  
50 - render: (h, {row}) => {  
51 - return h('img', {  
52 - attrs: {  
53 - src: row.img  
54 - },  
55 - style: {  
56 - width: '100%',  
57 - height: 'auto',  
58 - maxWidth: '70px'  
59 - }  
60 - });  
61 - }  
62 - },  
63 - {  
64 title: '中奖时间', 45 title: '中奖时间',
65 - key: 'endTime', 46 + key: 'time',
66 render: (h, {row}) => { 47 render: (h, {row}) => {
67 - return h('span', {}, moment(new Date(row.create_time).getTime()).format('YYYY-MM-DD HH:mm:ss ')); 48 + return h('span', {}, moment(row.time).format('YYYY-MM-DD HH:mm:ss'));
68 } 49 }
69 } 50 }
70 ], 51 ],
@@ -94,18 +75,6 @@ @@ -94,18 +75,6 @@
94 pageSize: this.pageSize 75 pageSize: this.pageSize
95 }; 76 };
96 77
97 - if (this.uid) {  
98 - params.uid = this.uid;  
99 - }  
100 -  
101 - if (this.type) {  
102 - params.type = this.type;  
103 - }  
104 -  
105 - if (this.name) {  
106 - params.name = this.name;  
107 - }  
108 -  
109 this.list(params); 78 this.list(params);
110 }, 79 },
111 output() { 80 output() {