Authored by 邱骏

update

  1 +/**
  2 + * Created by qiujun on 2018/10/9.
  3 + * 双11红包雨相关接口
  4 + */
  5 +
  6 +const INVALID_PARAMS = '参数错误';
  7 +
  8 +const redpac = {
  9 + async getRedpac(req, res) {
  10 +
  11 + }
  12 +};
  13 +
  14 +module.exports = redpac;
  15 +
@@ -185,7 +185,7 @@ const shoes = { @@ -185,7 +185,7 @@ const shoes = {
185 } else if (parseInt(question, 10) === 0) { 185 } else if (parseInt(question, 10) === 0) {
186 let session_token = req.session.shoesToken; 186 let session_token = req.session.shoesToken;
187 187
188 - // console.log(session_token, token); 188 + console.log('save:', session_token, token);
189 if (session_token !== token) { 189 if (session_token !== token) {
190 return res.json({ 190 return res.json({
191 code: 400, 191 code: 400,
@@ -450,7 +450,7 @@ const shoes = { @@ -450,7 +450,7 @@ const shoes = {
450 if (referer && referer.indexOf('ad.yoho.cn') > 0) { 450 if (referer && referer.indexOf('ad.yoho.cn') > 0) {
451 req.session.shoesToken = token; 451 req.session.shoesToken = token;
452 452
453 - // console.log('shoesToken:', req.session.shoesToken); 453 + console.log('shoesToken:', req.session.shoesToken);
454 res.json({ 454 res.json({
455 data: token, 455 data: token,
456 }); 456 });
  1 +/**
  2 + * Created by qiujun on 2018/10/9.
  3 + */
  4 +
  5 +const service = global.yoho.ServiceAPI;
  6 +
  7 +class RedpacModel extends global.yoho.BaseModel {
  8 + constructor(ctx) {
  9 + super(ctx);
  10 + }
  11 +
  12 + /**
  13 + * 领取红包
  14 + * @param uid
  15 + * @param actSource
  16 + * @param redpacToken
  17 + */
  18 + getRedpac(uid, actSource, redpacToken) {
  19 + return this.get({
  20 + url: '',
  21 + method: 'app.redpac.addRedpac',
  22 + uid: uid,
  23 + actSource: actSource,
  24 + redpacToken: redpacToken
  25 + });
  26 + }
  27 +}
@@ -296,7 +296,7 @@ class ShoesModel extends global.yoho.BaseModel { @@ -296,7 +296,7 @@ class ShoesModel extends global.yoho.BaseModel {
296 let userInfoObj = userInfo[0]; 296 let userInfoObj = userInfo[0];
297 let userId = userInfoObj.id; 297 let userId = userInfoObj.id;
298 let userAvatar = userInfoObj.user_avatar; 298 let userAvatar = userInfoObj.user_avatar;
299 - let userName = userInfoObj.user_name; 299 + let userName = decodeURIComponent(userInfoObj.user_name);
300 let scoreInfo = await mySqlCli.query(strScore, { 300 let scoreInfo = await mySqlCli.query(strScore, {
301 userId, 301 userId,
302 actId 302 actId
@@ -326,8 +326,6 @@ class ShoesModel extends global.yoho.BaseModel { @@ -326,8 +326,6 @@ class ShoesModel extends global.yoho.BaseModel {
326 message: '用户无得分' 326 message: '用户无得分'
327 }; 327 };
328 } 328 }
329 -  
330 -  
331 } else { 329 } else {
332 return { 330 return {
333 code: 203, 331 code: 203,
@@ -455,7 +453,7 @@ class ShoesModel extends global.yoho.BaseModel { @@ -455,7 +453,7 @@ class ShoesModel extends global.yoho.BaseModel {
455 friendObj.rank = scoreInfo[i].rownum; 453 friendObj.rank = scoreInfo[i].rownum;
456 friendObj.userId = scoreInfo[i].user_id; 454 friendObj.userId = scoreInfo[i].user_id;
457 friendObj.headimgurl = scoreInfo[i].user_avatar; 455 friendObj.headimgurl = scoreInfo[i].user_avatar;
458 - friendObj.nickname = scoreInfo[i].user_name; 456 + friendObj.nickname = decodeURIComponent(scoreInfo[i].user_name);
459 friendObj.playTime = scoreInfo[i].playTime; 457 friendObj.playTime = scoreInfo[i].playTime;
460 friendObj.createTime = parseInt((new Date()).getTime() / 1000, 10) - parseInt(scoreInfo[i].create_time, 10); 458 friendObj.createTime = parseInt((new Date()).getTime() / 1000, 10) - parseInt(scoreInfo[i].create_time, 10);
461 459
@@ -505,7 +503,7 @@ class ShoesModel extends global.yoho.BaseModel { @@ -505,7 +503,7 @@ class ShoesModel extends global.yoho.BaseModel {
505 friendObj.userId = scoreInfo[i].user_id; 503 friendObj.userId = scoreInfo[i].user_id;
506 friendObj.userPhone = scoreInfo[i].user_phone; 504 friendObj.userPhone = scoreInfo[i].user_phone;
507 friendObj.headimgurl = scoreInfo[i].user_avatar; 505 friendObj.headimgurl = scoreInfo[i].user_avatar;
508 - friendObj.nickname = scoreInfo[i].user_name; 506 + friendObj.nickname = decodeURIComponent(scoreInfo[i].user_name);
509 friendObj.playTime = scoreInfo[i].playTime; 507 friendObj.playTime = scoreInfo[i].playTime;
510 friendObj.createTime = new Date(scoreInfo[i].create_time * 1000).toLocaleString(); 508 friendObj.createTime = new Date(scoreInfo[i].create_time * 1000).toLocaleString();
511 509
@@ -355,7 +355,7 @@ const userController = { @@ -355,7 +355,7 @@ const userController = {
355 let session_token = req.session.shoesToken; 355 let session_token = req.session.shoesToken;
356 let result = {}; 356 let result = {};
357 357
358 - // console.log(token, session_token); 358 + console.log(token, session_token);
359 359
360 if (token === session_token) { 360 if (token === session_token) {
361 result = await req.ctx(UserModel).updateUserMobileByUnionId(unionId, phone, force); 361 result = await req.ctx(UserModel).updateUserMobileByUnionId(unionId, phone, force);