Authored by lijing

VIP

1 -//优惠券 by acgpiano 1 +// 优惠券 by acgpiano
2 'use strict'; 2 'use strict';
3 const headerModel = require('../../../doraemon/models/header'), // 头部model 3 const headerModel = require('../../../doraemon/models/header'), // 头部model
4 model = require('../models/coupons'); 4 model = require('../models/coupons');
@@ -15,11 +15,11 @@ const index = (req, res) => { @@ -15,11 +15,11 @@ const index = (req, res) => {
15 }); 15 });
16 }; 16 };
17 17
18 -//处理Ajax请求,status为使用状态 18 +// 处理Ajax请求,status为使用状态
19 const couponData = (req, res, next) => { 19 const couponData = (req, res, next) => {
20 model.couponData({ 20 model.couponData({
21 method: 'app.coupons.li', 21 method: 'app.coupons.li',
22 - uid: 20000382, 22 + uid: req.user.uid,
23 status: req.body.status || 0, 23 status: req.body.status || 0,
24 page: req.body.page || 1, 24 page: req.body.page || 1,
25 limit: 10, 25 limit: 10,
  1 +// 帮助 by acgpiano
  2 +'use strict';
  3 +const headerModel = require('../../../doraemon/models/header'), // 头部model
  4 + model = require('../models/help');
  5 +
  6 +exports.index = (req, res, next) => {
  7 + model.getHelpList().then(result => {
  8 + res.render('help', {
  9 + module: 'home',
  10 + page: 'help',
  11 + pageHeader: headerModel.setNav({
  12 + navTitle: '帮助中心'
  13 + }),
  14 + title: '帮助中心',
  15 + pageFooter: true,
  16 + iHelp: result,
  17 + });
  18 + }).catch(next);
  19 +};
  20 +
  21 +exports.helpDetail = (req, res, next) => {
  22 + model.getHelpDetail(req.query.code).then(result => {
  23 + res.render('help-detail', {
  24 + module: 'home',
  25 + page: 'help-detail',
  26 + pageHeader: headerModel.setNav({
  27 + navTitle: req.query.name
  28 + }),
  29 + title: req.query.name,
  30 + pageFooter: true,
  31 + detail: result,
  32 + });
  33 + }).catch(next);
  34 +};
@@ -60,7 +60,6 @@ const currencyDetail = (req, res, next) => { @@ -60,7 +60,6 @@ const currencyDetail = (req, res, next) => {
60 }), 60 }),
61 title: '有货币明细', 61 title: '有货币明细',
62 pageFooter: true, 62 pageFooter: true,
63 -  
64 money: result.money 63 money: result.money
65 }); 64 });
66 }).catch(next); 65 }).catch(next);
1 -//优惠券 by acgpiano  
2 -"use strict"; 1 +// 优惠券 by acgpiano
  2 +'use strict';
3 3
4 const api = global.yoho.API; 4 const api = global.yoho.API;
5 5
@@ -23,11 +23,11 @@ const couponData = (params) => { @@ -23,11 +23,11 @@ const couponData = (params) => {
23 <i></i> 23 <i></i>
24 <p>您还没有优惠券!</p> 24 <p>您还没有优惠券!</p>
25 <a href="/product/new">随便逛逛</a> 25 <a href="/product/new">随便逛逛</a>
26 - </div>` 26 + </div>`;
27 } 27 }
28 }); 28 });
29 -} 29 +};
30 30
31 module.exports = { 31 module.exports = {
32 couponData 32 couponData
33 -}  
  33 +};
  1 +// 帮助 by acgpiano
  2 +'use strict';
  3 +
  4 +const api = global.yoho.API;
  5 +
  6 +// 获取帮助列表
  7 +exports.getHelpList = () => {
  8 + return api.get('', {
  9 + method: 'app.help.li'
  10 + }).then(result => {
  11 + if (result && result.code === 200 && result.data) {
  12 + let final = [];
  13 + for (let name of result.data) {
  14 + final.push({
  15 + name: name.caption,
  16 + code: name.code,
  17 + });
  18 + }
  19 + return final;
  20 + }
  21 + });
  22 +};
  23 +
  24 +// 获取帮助详情
  25 +exports.getHelpDetail = (code) => {
  26 + return api.get('', {
  27 + method: 'app.help.detail',
  28 + code: code,
  29 + }).then(result => {
  30 + return result.replace(/^<!DOCTYPE.*<body>/g, '').
  31 + replace(/<\/body>.*<\/html>/g, '');
  32 + });
  33 +};
@@ -61,7 +61,7 @@ const currencyDetail = (uid, page, limit) => { @@ -61,7 +61,7 @@ const currencyDetail = (uid, page, limit) => {
61 let total = parseInt(result.data.page_total, 10) + 1; 61 let total = parseInt(result.data.page_total, 10) + 1;
62 62
63 if (page && page < total) { 63 if (page && page < total) {
64 - return myCurrency(uid).then(list => { 64 + return yohoCoin(uid).then(list => {
65 65
66 if (list.yohocoinNum && list.yohocoinNum === 0) { 66 if (list.yohocoinNum && list.yohocoinNum === 0) {
67 result.data = _.assign(result.data, { 67 result.data = _.assign(result.data, {
@@ -86,24 +86,25 @@ const currencyDetail = (uid, page, limit) => { @@ -86,24 +86,25 @@ const currencyDetail = (uid, page, limit) => {
86 }); 86 });
87 }; 87 };
88 88
89 -const mayLike = (uid, page, limit, udid, gender, recPos, channel) => {  
90 - return api.get('', {  
91 - method: 'app.search.newLast7day',  
92 - uid: uid,  
93 - page: page,  
94 - limit: limit,  
95 - udid: udid,  
96 - rec_pos: recPos,  
97 - yh_channel: channel  
98 - }).then((result) => {  
99 - console.log(result);  
100 - });  
101 -}; 89 +// const mayLike = (uid, page, limit, udid, gender, recPos, channel) => {
  90 +// return api.get('', {
  91 +// method: 'app.search.newLast7day',
  92 +// uid: uid,
  93 +// page: page,
  94 +// limit: limit,
  95 +// udid: udid,
  96 +// rec_pos: recPos,
  97 +// yh_channel: channel
  98 +// }).then((result) => {
  99 +// console.log(result);
  100 +// });
  101 +// };
102 102
103 module.exports = { 103 module.exports = {
104 myCurrency, 104 myCurrency,
105 currencyDetail, 105 currencyDetail,
106 bannerData, 106 bannerData,
107 - yohoCoin,  
108 - mayLike 107 + yohoCoin
  108 +
  109 + // mayLike
109 }; 110 };
@@ -18,6 +18,7 @@ const orderController = require(`${cRoot}/order`); @@ -18,6 +18,7 @@ const orderController = require(`${cRoot}/order`);
18 const orderDetailController = require(`${cRoot}/orderDetail`); 18 const orderDetailController = require(`${cRoot}/orderDetail`);
19 const currencyController = require(`${cRoot}/myCurrency`); 19 const currencyController = require(`${cRoot}/myCurrency`);
20 const coupons = require(`${cRoot}/coupons`); 20 const coupons = require(`${cRoot}/coupons`);
  21 +const help = require(`${cRoot}/help`);
21 22
22 // const myDetail = require(`${cRoot}/myDetail); 23 // const myDetail = require(`${cRoot}/myDetail);
23 24
@@ -70,4 +71,8 @@ router.post('/favoriteDel', favorite.favoriteDelete); @@ -70,4 +71,8 @@ router.post('/favoriteDel', favorite.favoriteDelete);
70 router.get('/coupons', coupons.index); 71 router.get('/coupons', coupons.index);
71 router.post('/couponData', coupons.couponData); 72 router.post('/couponData', coupons.couponData);
72 73
  74 +// 帮助中心
  75 +router.get('/help', help.index);
  76 +router.get('/helpDetail', help.helpDetail);
  77 +
73 module.exports = router; 78 module.exports = router;
  1 +<div class="iHelp">
  2 + <ul>
  3 + {{#iHelp}}
  4 + <li><a href="//m.yohobuy.com/home/helpDetail?code={{code}}&name={{name}}"><span>{{name}}</span><i class="iconfont num">&#xe604;</i></a></li>
  5 + {{/iHelp}}
  6 + </ul>
  7 +</div>
  1 +'use strict';
  2 +
  3 +const mRoot = '../models';
  4 +const headerModel = require('../../../doraemon/models/header'); // 头部model
  5 +const mayLikeModel = require('../models/recom');
  6 +
  7 +const mayLike = (req, res, next) => {
  8 + let uid = req.user.uid || 8039759;
  9 + let page = req.body.page || 1;
  10 + let limit = 50;
  11 + let gender = req.query.gender || '1,3';
  12 + let udid = req.sessionID || 'yoho';
  13 + let recPos = 100009;
  14 + let channel = req.query.channel || 1;
  15 +
  16 + mayLikeModel.mayLike(uid, page, limit, gender, udid, recPos, channel).then((result) => {
  17 +
  18 + // res.render('../common/goods', {
  19 + // layout: false
  20 + // });
  21 + }).catch(next);
  22 +};
  23 +
  24 +
  25 +module.exports = {
  26 + mayLike
  27 +};
  1 +'use strict';
  2 +
  3 +const serviceAPI = global.yoho.ServiceAPI;
  4 +const api = global.yoho.API;
  5 +const _ = require('lodash');
  6 +const camelCase = global.yoho.camelCase;
  7 +const logger = global.yoho.logger;
  8 +
  9 +const mayLike = (uid, page, limit, gender, udid, recPos, channel) => {
  10 + return api.get('', {
  11 + method: 'app.search.newLast7day',
  12 + uid: uid,
  13 + page: page,
  14 + limit: limit,
  15 + udid: udid,
  16 + rec_pos: recPos,
  17 + yh_channel: channel
  18 + }).then((result) => {
  19 + // console.log(result);
  20 + });
  21 +};
  22 +
  23 +module.exports = {
  24 + mayLike
  25 +};
@@ -24,6 +24,9 @@ const outlet = require(`${cRoot}/outlet`); @@ -24,6 +24,9 @@ const outlet = require(`${cRoot}/outlet`);
24 // recommend-for-you controller 24 // recommend-for-you controller
25 const recommendForYou = require(`${cRoot}/recommend-for-you`); 25 const recommendForYou = require(`${cRoot}/recommend-for-you`);
26 26
  27 +// recom
  28 +const recom = require(`${cRoot}/recom`);
  29 +
27 // routers 30 // routers
28 31
29 // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html 32 // /pro_136349_455445/HEARTSOFARMianMaShuJiaoXiuXianKuPS1684.html
@@ -34,6 +37,7 @@ router.get('/detail/consults', detail.consults); // 商品咨询页 @@ -34,6 +37,7 @@ router.get('/detail/consults', detail.consults); // 商品咨询页
34 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页 37 router.get('/detail/consultform', auth, detail.consultform); // 商品咨询表单页
35 router.get('/detail/comments', detail.comments); 38 router.get('/detail/comments', detail.comments);
36 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口 39 router.post('/detail/consultsubmit', auth, detail.consultsubmit); // 商品咨询提交接口
  40 +router.get('/recom/maylike', recom.mayLike);// 你可能喜欢
37 41
38 router.get('/sale', sale.index); 42 router.get('/sale', sale.index);
39 router.get('/sale/discount', sale.discount); 43 router.get('/sale/discount', sale.discount);
1 -//不要使用es6  
2 -"use strict"; 1 +// 不要使用es6
  2 +'use strict';
3 3
4 var $ = require('yoho-jquery'), 4 var $ = require('yoho-jquery'),
5 Hammer = require('yoho-hammer'), 5 Hammer = require('yoho-hammer'),
@@ -9,9 +9,11 @@ var $ = require('yoho-jquery'), @@ -9,9 +9,11 @@ var $ = require('yoho-jquery'),
9 var employ, 9 var employ,
10 statu = 0, 10 statu = 0,
11 page = 1, 11 page = 1,
12 - //防止重复请求 12 +
  13 + // 防止重复请求
13 AjaxFlag = 0, 14 AjaxFlag = 0,
14 - //上滑不请求 15 +
  16 + // 上滑不请求
15 direction = true; 17 direction = true;
16 18
17 var couponAJAX = function(statu, page) { 19 var couponAJAX = function(statu, page) {
@@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) { @@ -35,7 +37,7 @@ var couponAJAX = function(statu, page) {
35 AjaxFlag = 0; 37 AjaxFlag = 0;
36 } 38 }
37 }); 39 });
38 -} 40 +};
39 41
40 var scrollHandler = function() { 42 var scrollHandler = function() {
41 if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) { 43 if (direction && ($(window).scrollTop() + $(window).height() > $('body').height() - 100)) {
@@ -43,14 +45,14 @@ var scrollHandler = function() { @@ -43,14 +45,14 @@ var scrollHandler = function() {
43 couponAJAX(statu, page); 45 couponAJAX(statu, page);
44 return; 46 return;
45 } 47 }
46 -} 48 +};
47 49
48 50
49 require('../common'); 51 require('../common');
50 52
51 ellipsis.init(); 53 ellipsis.init();
52 54
53 -//判断滑动方向 55 +// 判断滑动方向
54 $('body').on('touchstart', function(e) { 56 $('body').on('touchstart', function(e) {
55 var touch = e.originalEvent, 57 var touch = e.originalEvent,
56 startX = touch.changedTouches[0].pageX, 58 startX = touch.changedTouches[0].pageX,
@@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) { @@ -62,12 +64,12 @@ $('body').on('touchstart', function(e) {
62 $('body').off('touchmove'); 64 $('body').off('touchmove');
63 } else if (touch.pageX - startX < -10) { 65 } else if (touch.pageX - startX < -10) {
64 $('body').off('touchmove'); 66 $('body').off('touchmove');
65 - }; 67 + }
66 if (touch.pageY - startY > 10) { 68 if (touch.pageY - startY > 10) {
67 direction = false; 69 direction = false;
68 } else if (touch.pageY - startY < -10) { 70 } else if (touch.pageY - startY < -10) {
69 direction = true; 71 direction = true;
70 - }; 72 + }
71 }); 73 });
72 }).on('touchend', function() { 74 }).on('touchend', function() {
73 $('body').off('touchmove'); 75 $('body').off('touchmove');
  1 +require('../common');
  1 +require('../common');
@@ -3,3 +3,4 @@ @@ -3,3 +3,4 @@
3 @import "address/index"; 3 @import "address/index";
4 @import "favorite"; 4 @import "favorite";
5 @import "coupons"; 5 @import "coupons";
  6 +@import "ihelp";
@@ -10,7 +10,6 @@ @@ -10,7 +10,6 @@
10 @import "address-modify"; 10 @import "address-modify";
11 @import "online-service"; 11 @import "online-service";
12 @import "my-guang"; 12 @import "my-guang";
13 -@import "ihelp";  
14 @import "browse-record"; 13 @import "browse-record";
15 @import "logistic"; 14 @import "logistic";
16 @import "pay"; 15 @import "pay";