Authored by 毕凯

Merge branch 'feature/ctxlj' into 'release/6.0'

Feature/ctxlj

个人中心ctx优化

See merge request !754
@@ -5,7 +5,7 @@ const headerModel = require('../../../doraemon/models/header'), // 头部model @@ -5,7 +5,7 @@ const headerModel = require('../../../doraemon/models/header'), // 头部model
5 5
6 // status为使用状态 6 // status为使用状态
7 const index = (req, res, next) => { 7 const index = (req, res, next) => {
8 - model.couponData({ 8 + req.ctx(model).couponData({
9 method: 'app.coupons.li', 9 method: 'app.coupons.li',
10 uid: req.user.uid, 10 uid: req.user.uid,
11 status: req.body.status || 0, 11 status: req.body.status || 0,
@@ -29,7 +29,7 @@ const index = (req, res, next) => { @@ -29,7 +29,7 @@ const index = (req, res, next) => {
29 }; 29 };
30 30
31 const couponsAjax = (req, res, next) => { 31 const couponsAjax = (req, res, next) => {
32 - model.couponData({ 32 + req.ctx(model).couponData({
33 method: 'app.coupons.li', 33 method: 'app.coupons.li',
34 uid: req.user.uid, 34 uid: req.user.uid,
35 status: parseInt(req.body.status || 0, 10), 35 status: parseInt(req.body.status || 0, 10),
@@ -15,7 +15,7 @@ const favorite = (req, res, next) => { @@ -15,7 +15,7 @@ const favorite = (req, res, next) => {
15 let page = 1; 15 let page = 1;
16 let limit = 10; 16 let limit = 10;
17 17
18 - favoriteModel.index(uid, page, limit, tab === 'brand').then((result)=>{ 18 + req.ctx(favoriteModel).index(uid, page, limit, tab === 'brand').then((result)=>{
19 res.render('favorite', { 19 res.render('favorite', {
20 module: 'home', 20 module: 'home',
21 page: 'favorite', 21 page: 'favorite',
@@ -39,7 +39,7 @@ let favProduct = (req, res, next) => { @@ -39,7 +39,7 @@ let favProduct = (req, res, next) => {
39 let page = req.query.page || 1; 39 let page = req.query.page || 1;
40 let limit = 10; 40 let limit = 10;
41 41
42 - favoriteModel.favProduct(uid, page, limit).then((result) => { 42 + req.ctx(favoriteModel).favProduct(uid, page, limit).then((result) => {
43 if (typeof(result.total) === 'undefined' && typeof(result.more) === 'undefined') { 43 if (typeof(result.total) === 'undefined' && typeof(result.more) === 'undefined') {
44 res.render('favorite/favorite-product', { 44 res.render('favorite/favorite-product', {
45 layout: false, 45 layout: false,
@@ -56,7 +56,7 @@ let favfavBrand = (req, res, next) => { @@ -56,7 +56,7 @@ let favfavBrand = (req, res, next) => {
56 let page = req.query.page || 1; 56 let page = req.query.page || 1;
57 let limit = 10; 57 let limit = 10;
58 58
59 - favoriteModel.favfavBrand(uid, page, limit).then((result) => { 59 + req.ctx(favoriteModel).favfavBrand(uid, page, limit).then((result) => {
60 60
61 if (typeof(result.total) === 'undefined' && typeof(result.more) === 'undefined') { 61 if (typeof(result.total) === 'undefined' && typeof(result.more) === 'undefined') {
62 res.render('favorite/favorite-brand', { 62 res.render('favorite/favorite-brand', {
@@ -75,7 +75,7 @@ let favoriteDelete = (req, res, next) => { @@ -75,7 +75,7 @@ let favoriteDelete = (req, res, next) => {
75 let type = 'product'; 75 let type = 'product';
76 let favId = req.body.id; 76 let favId = req.body.id;
77 77
78 - favoriteModel.favoriteDelete(uid, type, favId).then((result) => { 78 + req.ctx(favoriteModel).favoriteDelete(uid, type, favId).then((result) => {
79 res.json(result); 79 res.json(result);
80 }).catch(next); 80 }).catch(next);
81 }; 81 };
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 - navBtn: false  
14 - }),  
15 - title: '帮助中心',  
16 - pageFooter: true,  
17 - iHelp: result  
18 - });  
19 - }).catch(next);  
20 -};  
21 -  
22 -exports.helpDetail = (req, res, next) => {  
23 - model.getHelpDetail(req.query.code).then(result => {  
24 - res.render('help-detail', {  
25 - module: 'home',  
26 - page: 'help-detail',  
27 - pageHeader: headerModel.setNav({  
28 - navTitle: req.query.name,  
29 - navBtn: false  
30 - }),  
31 - title: req.query.name,  
32 - pageFooter: true,  
33 - detail: result  
34 - });  
35 - }).catch(next);  
36 -};  
@@ -4,7 +4,7 @@ const headerModel = require('../../../doraemon/models/header'), // 头部model @@ -4,7 +4,7 @@ const headerModel = require('../../../doraemon/models/header'), // 头部model
4 model = require('../models/message'); 4 model = require('../models/message');
5 5
6 const _getList = (req, res, next) => { 6 const _getList = (req, res, next) => {
7 - model.getList({ 7 + req.ctx(model).getList({
8 page: req.body.page, 8 page: req.body.page,
9 size: 20, 9 size: 20,
10 uid: req.user.uid, 10 uid: req.user.uid,
@@ -26,7 +26,7 @@ const _getList = (req, res, next) => { @@ -26,7 +26,7 @@ const _getList = (req, res, next) => {
26 }; 26 };
27 27
28 const _msgDetail = (req, res, next) => { 28 const _msgDetail = (req, res, next) => {
29 - model.getList({ 29 + req.ctx(model).getList({
30 page: req.body.page, 30 page: req.body.page,
31 size: 1000, 31 size: 1000,
32 msgid: req.query.id, 32 msgid: req.query.id,
@@ -61,7 +61,7 @@ exports.index = (req, res, next) => { @@ -61,7 +61,7 @@ exports.index = (req, res, next) => {
61 }; 61 };
62 62
63 exports.ajaxDelMes = (req, res, next) => { 63 exports.ajaxDelMes = (req, res, next) => {
64 - model.delMsg({ 64 + req.ctx(model).delMsg({
65 uid: req.user.uid, 65 uid: req.user.uid,
66 msgid: req.body.id, 66 msgid: req.body.id,
67 }).then(result => { 67 }).then(result => {
@@ -71,7 +71,7 @@ exports.ajaxDelMes = (req, res, next) => { @@ -71,7 +71,7 @@ exports.ajaxDelMes = (req, res, next) => {
71 }; 71 };
72 72
73 exports.pickCoupon = (req, res, next) => { 73 exports.pickCoupon = (req, res, next) => {
74 - model.pickCoupon({ 74 + req.ctx(model).pickCoupon({
75 uid: req.user.uid, 75 uid: req.user.uid,
76 couponId: req.body.id, 76 couponId: req.body.id,
77 }).then(result => { 77 }).then(result => {
@@ -92,7 +92,7 @@ exports.birthCoupon = (req, res, next) => { @@ -92,7 +92,7 @@ exports.birthCoupon = (req, res, next) => {
92 pageFooter: true 92 pageFooter: true
93 }; 93 };
94 94
95 - model._getBirthCouponById(req.user.uid).then(result => { 95 + req.ctx(model)._getBirthCouponById(req.user.uid).then(result => {
96 res.render('birth-coupon', Object.assign(responseData, result)); 96 res.render('birth-coupon', Object.assign(responseData, result));
97 }).catch(next); 97 }).catch(next);
98 }; 98 };
@@ -14,8 +14,7 @@ const myCurrency = (req, res, next) => { @@ -14,8 +14,7 @@ const myCurrency = (req, res, next) => {
14 let uid = req.user.uid; 14 let uid = req.user.uid;
15 let contentCode = '05afedf76886d732573f10f7451a1703'; 15 let contentCode = '05afedf76886d732573f10f7451a1703';
16 16
17 - myCurrencyModel.myCurrency(uid, contentCode).then(result => {  
18 - 17 + req.ctx(myCurrencyModel).myCurrency(uid, contentCode).then(result => {
19 res.render('currency-new', { 18 res.render('currency-new', {
20 module: 'home', 19 module: 'home',
21 page: 'mycurrency', 20 page: 'mycurrency',
@@ -39,7 +38,7 @@ const currencyDetail = (req, res, next) => { @@ -39,7 +38,7 @@ const currencyDetail = (req, res, next) => {
39 let page = 1; 38 let page = 1;
40 let limit = 10; 39 let limit = 10;
41 40
42 - myCurrencyModel.currencyDetailIndex(uid, page, limit).then(result => { 41 + req.ctx(myCurrencyModel).currencyDetailIndex(uid, page, limit).then(result => {
43 res.render('currency-detail', { 42 res.render('currency-detail', {
44 module: 'home', 43 module: 'home',
45 page: 'currencyDetail', 44 page: 'currencyDetail',
@@ -63,7 +62,7 @@ let ajaxCurrencyDetail = (req, res, next) => { @@ -63,7 +62,7 @@ let ajaxCurrencyDetail = (req, res, next) => {
63 let page = req.body.page || 1; 62 let page = req.body.page || 1;
64 let limit = 10; 63 let limit = 10;
65 64
66 - myCurrencyModel.currencyDetail(uid, page, limit).then((result) => { 65 + req.ctx(myCurrencyModel).currencyDetail(uid, page, limit).then(result => {
67 res.json(result); 66 res.json(result);
68 }).catch(next); 67 }).catch(next);
69 }; 68 };
@@ -20,7 +20,7 @@ exports.index = (req, res, next) => { @@ -20,7 +20,7 @@ exports.index = (req, res, next) => {
20 } catch (e) { 20 } catch (e) {
21 uname = params.uname; 21 uname = params.uname;
22 } 22 }
23 - model.getQr({ 23 + req.ctx(model).getQr({
24 token: params.token, 24 token: params.token,
25 }).then(result => { 25 }).then(result => {
26 params.token = result; 26 params.token = result;
@@ -11,7 +11,7 @@ const QRcodeModel = require('../models/qrcode'); @@ -11,7 +11,7 @@ const QRcodeModel = require('../models/qrcode');
11 exports.QRcode = (req, res, next) => { 11 exports.QRcode = (req, res, next) => {
12 let id = req.params.id || 0; 12 let id = req.params.id || 0;
13 13
14 - QRcodeModel.getQRcodeData(id, req.user.uid).then((result)=>{ 14 + req.ctx(QRcodeModel).getQRcodeData(id, req.user.uid).then((result)=>{
15 if (result) { 15 if (result) {
16 result.ticks = result.ticks.map(item=>{ 16 result.ticks = result.ticks.map(item=>{
17 if (+item.ticket_type === 2) { 17 if (+item.ticket_type === 2) {
@@ -4,7 +4,12 @@ @@ -4,7 +4,12 @@
4 const api = global.yoho.API; 4 const api = global.yoho.API;
5 const helpers = global.yoho.helpers; 5 const helpers = global.yoho.helpers;
6 6
7 -const couponData = (params) => { 7 +class couponsModel extends global.yoho.BaseModel {
  8 + constructor(ctx) {
  9 + super(ctx);
  10 + }
  11 +
  12 + couponData(params) {
8 return api.get('', params).then(result => { 13 return api.get('', params).then(result => {
9 14
10 if (result && result.data && result.data.couponList) { 15 if (result && result.data && result.data.couponList) {
@@ -33,8 +38,7 @@ const couponData = (params) => { @@ -33,8 +38,7 @@ const couponData = (params) => {
33 38
34 return []; 39 return [];
35 }); 40 });
36 -}; 41 + }
  42 +}
37 43
38 -module.exports = {  
39 - couponData  
40 -}; 44 +module.exports = couponsModel;
@@ -15,7 +15,12 @@ const _ = require('lodash'); @@ -15,7 +15,12 @@ const _ = require('lodash');
15 const config = global.yoho.config; 15 const config = global.yoho.config;
16 const helpers = global.yoho.helpers; 16 const helpers = global.yoho.helpers;
17 17
18 -const favProduct = (uid, page, limit) => { 18 +class favoriteIndexModel extends global.yoho.BaseModel {
  19 + constructor(ctx) {
  20 + super(ctx);
  21 + }
  22 +
  23 + favProduct(uid, page, limit) {
19 24
20 return api.get('', { 25 return api.get('', {
21 method: 'app.favorite.product', 26 method: 'app.favorite.product',
@@ -115,10 +120,9 @@ const favProduct = (uid, page, limit) => { @@ -115,10 +120,9 @@ const favProduct = (uid, page, limit) => {
115 }; 120 };
116 } 121 }
117 }); 122 });
118 -};  
119 -  
120 -const favfavBrand = (uid, page, limit) => { 123 + }
121 124
  125 + favfavBrand(uid, page, limit) {
122 return api.get('', { 126 return api.get('', {
123 method: 'app.favorite.brand', 127 method: 'app.favorite.brand',
124 uid: uid, 128 uid: uid,
@@ -199,9 +203,9 @@ const favfavBrand = (uid, page, limit) => { @@ -199,9 +203,9 @@ const favfavBrand = (uid, page, limit) => {
199 }; 203 };
200 } 204 }
201 }); 205 });
202 -}; 206 + }
203 207
204 -const favoriteDelete = (uid, type, favId) => { 208 + favoriteDelete(uid, type, favId) {
205 209
206 return api.get('', { 210 return api.get('', {
207 method: 'app.favorite.cancel', 211 method: 'app.favorite.cancel',
@@ -209,28 +213,25 @@ const favoriteDelete = (uid, type, favId) => { @@ -209,28 +213,25 @@ const favoriteDelete = (uid, type, favId) => {
209 type: type, 213 type: type,
210 fav_id: favId 214 fav_id: favId
211 }); 215 });
212 -};  
213 -const index = (uid, page, limit, isbrand) => { 216 + }
  217 +
  218 + index(uid, page, limit, isbrand) {
214 if (isbrand) { 219 if (isbrand) {
215 - return favfavBrand(uid, page, limit).then(result=> { 220 + return this.favfavBrand(uid, page, limit).then(result=> {
216 if (result.total === 0) { 221 if (result.total === 0) {
217 result = {nobrandData: 1}; 222 result = {nobrandData: 1};
218 } 223 }
219 return result; 224 return result;
220 }); 225 });
221 } else { 226 } else {
222 - return favProduct(uid, page, limit).then(result=> { 227 + return this.favProduct(uid, page, limit).then(result=> {
223 if (result.total === 0) { 228 if (result.total === 0) {
224 result = {noproductData: 1}; 229 result = {noproductData: 1};
225 } 230 }
226 return result; 231 return result;
227 }); 232 });
228 } 233 }
229 -}; 234 + }
  235 +}
230 236
231 -module.exports = {  
232 - favProduct,  
233 - favfavBrand,  
234 - favoriteDelete,  
235 - index  
236 -}; 237 +module.exports = favoriteIndexModel;
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 -  
14 - for (let name of result.data) {  
15 - final.push({  
16 - name: name.caption,  
17 - code: name.code,  
18 - });  
19 - }  
20 - return final;  
21 - }  
22 - });  
23 -};  
24 -  
25 -// 获取帮助详情  
26 -exports.getHelpDetail = (code) => {  
27 - return api.get('', {  
28 - method: 'app.help.detail',  
29 - code: code,  
30 - }).then(result => {  
31 - return result.replace(/^<!DOCTYPE.*<body>/g, '').  
32 - replace(/<\/body>.*<\/html>/g, '');  
33 - });  
34 -};  
@@ -15,8 +15,13 @@ const _formatDay = (day) => { @@ -15,8 +15,13 @@ const _formatDay = (day) => {
15 return moment(day).format('YYYY.MM.DD'); 15 return moment(day).format('YYYY.MM.DD');
16 }; 16 };
17 17
18 -// 获取列表页  
19 -const _list = (result) => { 18 +class messageModel extends global.yoho.BaseModel {
  19 + constructor(ctx) {
  20 + super(ctx);
  21 + }
  22 +
  23 + // 获取列表页
  24 + _list(result) {
20 let final = []; 25 let final = [];
21 26
22 if (result.data && result.data.list) { 27 if (result.data && result.data.list) {
@@ -46,10 +51,10 @@ const _list = (result) => { @@ -46,10 +51,10 @@ const _list = (result) => {
46 } 51 }
47 } 52 }
48 return final; 53 return final;
49 -}; 54 + }
50 55
51 -// 获取生日信息  
52 -const _getBirthCouponById = (uid) => { 56 + // 获取生日信息
  57 + _getBirthCouponById(uid) {
53 return api.get('', { 58 return api.get('', {
54 method: 'app.promotion.queryBirthCoupon', 59 method: 'app.promotion.queryBirthCoupon',
55 uid: uid, 60 uid: uid,
@@ -94,10 +99,10 @@ const _getBirthCouponById = (uid) => { @@ -94,10 +99,10 @@ const _getBirthCouponById = (uid) => {
94 } 99 }
95 } 100 }
96 }); 101 });
97 -}; 102 + }
98 103
99 -// 获取详情页  
100 -const _detail = (result, id) => { 104 + // 获取详情页
  105 + _detail(result, id) {
101 let final = {}; 106 let final = {};
102 107
103 if (result.data && result.data.list) { 108 if (result.data && result.data.list) {
@@ -146,10 +151,10 @@ const _detail = (result, id) => { @@ -146,10 +151,10 @@ const _detail = (result, id) => {
146 } 151 }
147 } 152 }
148 return final; 153 return final;
149 -}; 154 + }
150 155
151 -// 获取列表或详情  
152 -const getList = (params) => { 156 + // 获取列表或详情
  157 + getList(params) {
153 return api.get('', { 158 return api.get('', {
154 method: 'app.inbox.getlist', 159 method: 'app.inbox.getlist',
155 page: params.page || 1, 160 page: params.page || 1,
@@ -158,15 +163,15 @@ const getList = (params) => { @@ -158,15 +163,15 @@ const getList = (params) => {
158 }).then(result => { 163 }).then(result => {
159 if (params.msgid) { 164 if (params.msgid) {
160 // 绕的一比 165 // 绕的一比
161 - return _detail(result, params.msgid); 166 + return this._detail(result, params.msgid);
162 } else { 167 } else {
163 - return _list(result); 168 + return this._list(result);
164 } 169 }
165 }); 170 });
166 -}; 171 + }
167 172
168 -// 删除消息  
169 -const delMsg = (params) => { 173 + // 删除消息
  174 + delMsg(params) {
170 return api.get('', { 175 return api.get('', {
171 method: 'app.inbox.delmessage', 176 method: 'app.inbox.delmessage',
172 uid: params.uid, 177 uid: params.uid,
@@ -183,10 +188,10 @@ const delMsg = (params) => { @@ -183,10 +188,10 @@ const delMsg = (params) => {
183 }; 188 };
184 } 189 }
185 }); 190 });
186 -}; 191 + }
187 192
188 -// 领取优惠券  
189 -const pickCoupon = (params) => { 193 + // 领取优惠券
  194 + pickCoupon(params) {
190 return api.get('', { 195 return api.get('', {
191 method: 'app.promotion.getCoupon', 196 method: 'app.promotion.getCoupon',
192 uid: params.uid, 197 uid: params.uid,
@@ -203,11 +208,7 @@ const pickCoupon = (params) => { @@ -203,11 +208,7 @@ const pickCoupon = (params) => {
203 }; 208 };
204 } 209 }
205 }); 210 });
206 -}; 211 + }
  212 +}
207 213
208 -module.exports = {  
209 - getList,  
210 - delMsg,  
211 - pickCoupon,  
212 - _getBirthCouponById  
213 -}; 214 +module.exports = messageModel;
@@ -5,7 +5,12 @@ const api = global.yoho.API; @@ -5,7 +5,12 @@ const api = global.yoho.API;
5 const _ = require('lodash'); 5 const _ = require('lodash');
6 const logger = global.yoho.logger; 6 const logger = global.yoho.logger;
7 7
8 -const _yohoCoin = (uid) => { 8 +class myCurrencyModel extends global.yoho.BaseModel {
  9 + constructor(ctx) {
  10 + super(ctx);
  11 + }
  12 +
  13 + _yohoCoin(uid) {
9 return api.get('', { 14 return api.get('', {
10 method: 'app.yoho.yohocoin', 15 method: 'app.yoho.yohocoin',
11 uid: uid 16 uid: uid
@@ -20,9 +25,9 @@ const _yohoCoin = (uid) => { @@ -20,9 +25,9 @@ const _yohoCoin = (uid) => {
20 25
21 return data; 26 return data;
22 }); 27 });
23 -}; 28 + }
24 29
25 -const bannerData = (contentCode) => { 30 + bannerData(contentCode) {
26 31
27 return serviceAPI.get('operations/api/v5/resource/get', { 32 return serviceAPI.get('operations/api/v5/resource/get', {
28 content_code: contentCode 33 content_code: contentCode
@@ -39,20 +44,22 @@ const bannerData = (contentCode) => { @@ -39,20 +44,22 @@ const bannerData = (contentCode) => {
39 return {}; 44 return {};
40 } 45 }
41 }); 46 });
42 -}; 47 + }
43 48
44 -const myCurrency = (uid, contentCode) => {  
45 - return Promise.all([_yohoCoin(uid), bannerData(contentCode)])  
46 - .then((result) => { 49 + myCurrency(uid, contentCode) {
  50 + return Promise.all([
  51 + this._yohoCoin(uid),
  52 + this.bannerData(contentCode)
  53 + ]).then((result) => {
47 54
48 return { 55 return {
49 yohoCoin: result[0], 56 yohoCoin: result[0],
50 banner: result[1] 57 banner: result[1]
51 }; 58 };
52 }); 59 });
53 -}; 60 + }
54 61
55 -const currencyDetail = (uid, page, limit) => { 62 + currencyDetail(uid, page, limit) {
56 return api.get('', { 63 return api.get('', {
57 method: 'app.yohocoin.lists', 64 method: 'app.yohocoin.lists',
58 uid: uid, 65 uid: uid,
@@ -73,22 +80,19 @@ const currencyDetail = (uid, page, limit) => { @@ -73,22 +80,19 @@ const currencyDetail = (uid, page, limit) => {
73 80
74 return data; 81 return data;
75 }); 82 });
76 -}; 83 + }
77 84
78 -const currencyDetailIndex = (uid, page, limit) => {  
79 - return Promise.all(  
80 - [currencyDetail(uid, page, limit), _yohoCoin(uid)]  
81 - ).then(result => { 85 + currencyDetailIndex(uid, page, limit) {
  86 + return Promise.all([
  87 + this.currencyDetail(uid, page, limit),
  88 + this._yohoCoin(uid)
  89 + ]).then(result => {
82 return { 90 return {
83 coinlist: result[0], 91 coinlist: result[0],
84 yohoCoin: result[1] 92 yohoCoin: result[1]
85 }; 93 };
86 }); 94 });
87 -};  
88 -  
89 -module.exports = {  
90 - myCurrency,  
91 - currencyDetailIndex,  
92 - currencyDetail,  
93 - bannerData  
94 -}; 95 + }
  96 +}
  97 +
  98 +module.exports = myCurrencyModel;
@@ -4,7 +4,12 @@ const api = global.yoho.API; @@ -4,7 +4,12 @@ const api = global.yoho.API;
4 const crypto = global.yoho.crypto; 4 const crypto = global.yoho.crypto;
5 const PASSWORD = 'yoho9646yoho9646'; 5 const PASSWORD = 'yoho9646yoho9646';
6 6
7 -exports.getQr = (params) => { 7 +class qrcodeModel extends global.yoho.BaseModel {
  8 + constructor(ctx) {
  9 + super(ctx);
  10 + }
  11 +
  12 + getQr(params) {
8 let uid = ''; 13 let uid = '';
9 14
10 try { 15 try {
@@ -20,4 +25,7 @@ exports.getQr = (params) => { @@ -20,4 +25,7 @@ exports.getQr = (params) => {
20 }).then(result => { 25 }).then(result => {
21 return (result && result.data && result.data.code) || ''; 26 return (result && result.data && result.data.code) || '';
22 }); 27 });
23 -}; 28 + }
  29 +}
  30 +
  31 +module.exports = qrcodeModel;
@@ -8,7 +8,12 @@ @@ -8,7 +8,12 @@
8 const logger = global.yoho.logger; 8 const logger = global.yoho.logger;
9 var api = global.yoho.API; 9 var api = global.yoho.API;
10 10
11 -exports.getQRcodeData = (id, uid) => { 11 +class qrcodeModel extends global.yoho.BaseModel {
  12 + constructor(ctx) {
  13 + super(ctx);
  14 + }
  15 +
  16 + getQRcodeData(id, uid) {
12 return api.get('', { 17 return api.get('', {
13 method: 'app.SpaceOrders.getQrByOrderCode', 18 method: 'app.SpaceOrders.getQrByOrderCode',
14 order_code: id, 19 order_code: id,
@@ -21,5 +26,7 @@ exports.getQRcodeData = (id, uid) => { @@ -21,5 +26,7 @@ exports.getQRcodeData = (id, uid) => {
21 return false; 26 return false;
22 } 27 }
23 }); 28 });
24 -}; 29 + }
  30 +}
25 31
  32 +module.exports = qrcodeModel;
@@ -24,7 +24,6 @@ const orderController = require(`${cRoot}/order`); @@ -24,7 +24,6 @@ const orderController = require(`${cRoot}/order`);
24 const orderDetailController = require(`${cRoot}/orderDetail`); 24 const orderDetailController = require(`${cRoot}/orderDetail`);
25 const currencyController = require(`${cRoot}/myCurrency`); 25 const currencyController = require(`${cRoot}/myCurrency`);
26 const coupons = require(`${cRoot}/coupons`); 26 const coupons = require(`${cRoot}/coupons`);
27 -const help = require(`${cRoot}/help`);  
28 const suggest = require(`${cRoot}/suggest`); 27 const suggest = require(`${cRoot}/suggest`);
29 const message = require(`${cRoot}/message`); 28 const message = require(`${cRoot}/message`);
30 const onlineService = require(`${cRoot}/onlineService`); 29 const onlineService = require(`${cRoot}/onlineService`);
@@ -84,10 +83,6 @@ router.post('/favoriteDel', auth, favorite.favoriteDelete);// 取消收藏 @@ -84,10 +83,6 @@ router.post('/favoriteDel', auth, favorite.favoriteDelete);// 取消收藏
84 router.use('/coupons', auth, coupons.index); 83 router.use('/coupons', auth, coupons.index);
85 router.use('/couponsAjax', coupons.couponsAjax); 84 router.use('/couponsAjax', coupons.couponsAjax);
86 85
87 -// 帮助中心  
88 -router.get('/help', help.index);  
89 -router.get('/helpDetail', help.helpDetail);  
90 -  
91 // 意见反馈 86 // 意见反馈
92 router.get('/suggest', suggest.suggestData); 87 router.get('/suggest', suggest.suggestData);
93 router.post('/upAndDown', suggest.upAndDown); 88 router.post('/upAndDown', suggest.upAndDown);
1 -<div class="i-help">  
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>  
@@ -65,7 +65,7 @@ const about = (req, res, next) => { @@ -65,7 +65,7 @@ const about = (req, res, next) => {
65 width750: true 65 width750: true
66 }; 66 };
67 67
68 - aboutModel.about(req.yoho.isApp).then(result => { 68 + req.ctx(aboutModel).about(req.yoho.isApp).then(result => {
69 res.render('agreement/about', Object.assign(responseData, {wxFooter: result})); 69 res.render('agreement/about', Object.assign(responseData, {wxFooter: result}));
70 }).catch(next); 70 }).catch(next);
71 }; 71 };
@@ -2,7 +2,12 @@ @@ -2,7 +2,12 @@
2 2
3 const api = global.yoho.API; 3 const api = global.yoho.API;
4 4
5 -const about = (isApp) => { 5 +class aboutModel extends global.yoho.BaseModel {
  6 + constructor(ctx) {
  7 + super(ctx);
  8 + }
  9 +
  10 + about(isApp) {
6 return api.get('', { 11 return api.get('', {
7 method: 'app.document.config' 12 method: 'app.document.config'
8 }, { 13 }, {
@@ -19,8 +24,7 @@ const about = (isApp) => { @@ -19,8 +24,7 @@ const about = (isApp) => {
19 } 24 }
20 return result; 25 return result;
21 }); 26 });
22 -}; 27 + }
  28 +}
23 29
24 -module.exports = {  
25 - about  
26 -}; 30 +module.exports = aboutModel;