Authored by 李奇

Merge remote-tracking branch 'origin/feature/trans-redis' into feature/trans-redis

# Conflicts:
#	apps/api/models/wheel-surf.js
@@ -373,7 +373,7 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel { @@ -373,7 +373,7 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel {
373 } 373 }
374 374
375 if (!obj.act_id) { 375 if (!obj.act_id) {
376 - return []; 376 + return {};
377 } 377 }
378 378
379 try { 379 try {
@@ -386,17 +386,22 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel { @@ -386,17 +386,22 @@ class ActWheelSurfModelRedis extends global.yoho.BaseModel {
386 `select u.id, u.act_id act_id, u.prize_id prize_id, u.create_time createTime, p.name name,p.type type ,p.value value,p.img img 386 `select u.id, u.act_id act_id, u.prize_id prize_id, u.create_time createTime, p.name name,p.type type ,p.value value,p.img img
387 from act_wheel_surf_user u , act_wheel_surf_prize p where u.prize_id = p.id and u.act_id =:act_id and u.uid = :uid and type != :type 387 from act_wheel_surf_user u , act_wheel_surf_prize p where u.prize_id = p.id and u.act_id =:act_id and u.uid = :uid and type != :type
388 order by u.create_time desc`, {act_id: obj.act_id, uid: obj.uid, type: 1}); 388 order by u.create_time desc`, {act_id: obj.act_id, uid: obj.uid, type: 1});
  389 +
  390 + oddPrizes = oddPrizes.map(prize => {
  391 +
  392 + });
389 } catch(e) { 393 } catch(e) {
390 logger.error(e); 394 logger.error(e);
391 } 395 }
392 396
393 return this.client.zrevrangeAsync(`turntable:${obj.act_id}:user:${obj.uid}:prize`, 0, 300) 397 return this.client.zrevrangeAsync(`turntable:${obj.act_id}:user:${obj.uid}:prize`, 0, 300)
394 .then(prizes => { 398 .then(prizes => {
  399 + prizes = prizes.concat(oddPrizes);
395 return prizes.map(prize => { 400 return prizes.map(prize => {
396 return JSON.parse(prize.split(':::')[0]); 401 return JSON.parse(prize.split(':::')[0]);
397 }).filter(prize => { 402 }).filter(prize => {
398 return prize.type !== 1; 403 return prize.type !== 1;
399 - }).concat(oddPrizes); 404 + });
400 }); 405 });
401 } else { 406 } else {
402 return await this.client.zrevrangeAsync(`turntable:${obj.act_id}:user:${obj.uid}:prize`, 0, 300) 407 return await this.client.zrevrangeAsync(`turntable:${obj.act_id}:user:${obj.uid}:prize`, 0, 300)