Authored by lea guo

服务协议修改

@@ -12,9 +12,8 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model @@ -12,9 +12,8 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model
12 const chatQaModel = require('../models/chatQa'); 12 const chatQaModel = require('../models/chatQa');
13 13
14 exports.qaList = (req, res, next) => { 14 exports.qaList = (req, res, next) => {
15 -  
16 let headerData = headerModel.setNav({ 15 let headerData = headerModel.setNav({
17 - navTitle: '服务与反馈' 16 + navTitle: '服务与反馈',
18 }); 17 });
19 18
20 let responseData = { 19 let responseData = {
@@ -23,22 +22,20 @@ exports.qaList = (req, res, next) => { @@ -23,22 +22,20 @@ exports.qaList = (req, res, next) => {
23 page: 'chat-qa', 22 page: 'chat-qa',
24 title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停', 23 title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停',
25 width750: true, 24 width750: true,
26 - pageFooter: true 25 + pageFooter: true,
27 }; 26 };
28 27
29 - req.ctx(chatQaModel).index({  
30 -  
31 - }).then((result) => {  
32 -  
33 - res.render('chat/chat-qa', Object.assign(result, responseData));  
34 -  
35 - }).catch(next); 28 + req.ctx(chatQaModel)
  29 + .index({})
  30 + .then(result => {
  31 + res.render('chat/chat-qa', Object.assign(result, responseData));
  32 + })
  33 + .catch(next);
36 }; 34 };
37 35
38 exports.qaSearch = (req, res, next) => { 36 exports.qaSearch = (req, res, next) => {
39 -  
40 let headerData = headerModel.setNav({ 37 let headerData = headerModel.setNav({
41 - navTitle: '服务与反馈' 38 + navTitle: '服务与反馈',
42 }); 39 });
43 40
44 let responseData = { 41 let responseData = {
@@ -46,43 +43,46 @@ exports.qaSearch = (req, res, next) => { @@ -46,43 +43,46 @@ exports.qaSearch = (req, res, next) => {
46 module: 'service', 43 module: 'service',
47 page: 'chat-qa', 44 page: 'chat-qa',
48 title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停', 45 title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停',
49 - width750: true 46 + width750: true,
50 }; 47 };
51 48
52 - req.ctx(chatQaModel).qaSearch({  
53 -  
54 - }).then((result) => {  
55 -  
56 - res.render('chat/qa-search', Object.assign(result, responseData));  
57 -  
58 - }).catch(next);  
59 - 49 + req.ctx(chatQaModel)
  50 + .qaSearch({})
  51 + .then(result => {
  52 + res.render('chat/qa-search', Object.assign(result, responseData));
  53 + })
  54 + .catch(next);
60 }; 55 };
61 56
62 exports.keySearch = (req, res, next) => { 57 exports.keySearch = (req, res, next) => {
63 let params = { 58 let params = {
64 - keyword: req.query.keyword 59 + keyword: req.query.keyword,
65 }; 60 };
66 61
67 - req.ctx(chatQaModel).keySearch(params).then(result => {  
68 - res.json(result);  
69 - }).catch(next); 62 + req.ctx(chatQaModel)
  63 + .keySearch(params)
  64 + .then(result => {
  65 + res.json(result);
  66 + })
  67 + .catch(next);
70 }; 68 };
71 69
72 exports.qaDetail = (req, res, next) => { 70 exports.qaDetail = (req, res, next) => {
73 let title = req.query.title || '问题详情'; 71 let title = req.query.title || '问题详情';
74 let id = req.query.id; 72 let id = req.query.id;
75 let headerData = headerModel.setNav({ 73 let headerData = headerModel.setNav({
76 - navTitle: title 74 + navTitle: title,
77 }); 75 });
78 let protocolUrl = ''; 76 let protocolUrl = '';
79 77
80 if (+req.query.sonId === 340) { 78 if (+req.query.sonId === 340) {
81 - protocolUrl = 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货用户服务协议2.pdf'; 79 + protocolUrl =
  80 + 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货用户服务协议0725.pdf';
82 } 81 }
83 82
84 if (+req.query.sonId === 352) { 83 if (+req.query.sonId === 352) {
85 - protocolUrl = 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货隐私条款.pdf'; 84 + protocolUrl =
  85 + 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货隐私条款.pdf';
86 } 86 }
87 87
88 let responseData = { 88 let responseData = {
@@ -93,20 +93,27 @@ exports.qaDetail = (req, res, next) => { @@ -93,20 +93,27 @@ exports.qaDetail = (req, res, next) => {
93 width750: true, 93 width750: true,
94 pageFooter: true, 94 pageFooter: true,
95 isApp: req.yoho.isApp, 95 isApp: req.yoho.isApp,
96 - protocolUrl: protocolUrl 96 + protocolUrl: protocolUrl,
97 }; 97 };
98 98
99 - co(function* () { 99 + co(function*() {
100 let detailData = {}; 100 let detailData = {};
101 101
102 - if (id) { // 有 ID 直接通过 ID 取数据  
103 - let detailApi = yield req.ctx(chatQaModel).getDetailById(req.query.id); 102 + if (id) {
  103 + // 有 ID 直接通过 ID 取数据
  104 + let detailApi = yield req
  105 + .ctx(chatQaModel)
  106 + .getDetailById(req.query.id);
104 107
105 return res.send(` 108 return res.send(`
106 <html> 109 <html>
107 <head> 110 <head>
108 <meta charset="utf-8"> 111 <meta charset="utf-8">
109 - <title>${req.query.keyword || _.get(detailApi, 'data.helpdetail_list[0].caption')}</title> 112 + <title>${req.query.keyword ||
  113 + _.get(
  114 + detailApi,
  115 + 'data.helpdetail_list[0].caption',
  116 + )}</title>
110 <meta name="viewport" 117 <meta name="viewport"
111 content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> 118 content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
112 </head> 119 </head>
@@ -119,7 +126,7 @@ exports.qaDetail = (req, res, next) => { @@ -119,7 +126,7 @@ exports.qaDetail = (req, res, next) => {
119 let params = { 126 let params = {
120 sonId: req.query.sonId, 127 sonId: req.query.sonId,
121 parentId: req.query.parentId, 128 parentId: req.query.parentId,
122 - keyword: req.query.keyword 129 + keyword: req.query.keyword,
123 }; 130 };
124 131
125 detailData = yield req.ctx(chatQaModel).qaDetail(params); 132 detailData = yield req.ctx(chatQaModel).qaDetail(params);