Authored by lea guo

服务协议修改

... ... @@ -12,9 +12,8 @@ const headerModel = require('../../../doraemon/models/header'); // 头部model
const chatQaModel = require('../models/chatQa');
exports.qaList = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '服务与反馈'
navTitle: '服务与反馈',
});
let responseData = {
... ... @@ -23,22 +22,20 @@ exports.qaList = (req, res, next) => {
page: 'chat-qa',
title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停',
width750: true,
pageFooter: true
pageFooter: true,
};
req.ctx(chatQaModel).index({
}).then((result) => {
req.ctx(chatQaModel)
.index({})
.then(result => {
res.render('chat/chat-qa', Object.assign(result, responseData));
}).catch(next);
})
.catch(next);
};
exports.qaSearch = (req, res, next) => {
let headerData = headerModel.setNav({
navTitle: '服务与反馈'
navTitle: '服务与反馈',
});
let responseData = {
... ... @@ -46,43 +43,46 @@ exports.qaSearch = (req, res, next) => {
module: 'service',
page: 'chat-qa',
title: '服务与反馈 | Yoho!Buy有货 | 潮流购物逛不停',
width750: true
width750: true,
};
req.ctx(chatQaModel).qaSearch({
}).then((result) => {
req.ctx(chatQaModel)
.qaSearch({})
.then(result => {
res.render('chat/qa-search', Object.assign(result, responseData));
}).catch(next);
})
.catch(next);
};
exports.keySearch = (req, res, next) => {
let params = {
keyword: req.query.keyword
keyword: req.query.keyword,
};
req.ctx(chatQaModel).keySearch(params).then(result => {
req.ctx(chatQaModel)
.keySearch(params)
.then(result => {
res.json(result);
}).catch(next);
})
.catch(next);
};
exports.qaDetail = (req, res, next) => {
let title = req.query.title || '问题详情';
let id = req.query.id;
let headerData = headerModel.setNav({
navTitle: title
navTitle: title,
});
let protocolUrl = '';
if (+req.query.sonId === 340) {
protocolUrl = 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货用户服务协议2.pdf';
protocolUrl =
'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货用户服务协议0725.pdf';
}
if (+req.query.sonId === 352) {
protocolUrl = 'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货隐私条款.pdf';
protocolUrl =
'https://cdn.yoho.cn/yohobuy/pdf/YOHO!BUY有货隐私条款.pdf';
}
let responseData = {
... ... @@ -93,20 +93,27 @@ exports.qaDetail = (req, res, next) => {
width750: true,
pageFooter: true,
isApp: req.yoho.isApp,
protocolUrl: protocolUrl
protocolUrl: protocolUrl,
};
co(function* () {
co(function*() {
let detailData = {};
if (id) { // 有 ID 直接通过 ID 取数据
let detailApi = yield req.ctx(chatQaModel).getDetailById(req.query.id);
if (id) {
// 有 ID 直接通过 ID 取数据
let detailApi = yield req
.ctx(chatQaModel)
.getDetailById(req.query.id);
return res.send(`
<html>
<head>
<meta charset="utf-8">
<title>${req.query.keyword || _.get(detailApi, 'data.helpdetail_list[0].caption')}</title>
<title>${req.query.keyword ||
_.get(
detailApi,
'data.helpdetail_list[0].caption',
)}</title>
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
</head>
... ... @@ -119,7 +126,7 @@ exports.qaDetail = (req, res, next) => {
let params = {
sonId: req.query.sonId,
parentId: req.query.parentId,
keyword: req.query.keyword
keyword: req.query.keyword,
};
detailData = yield req.ctx(chatQaModel).qaDetail(params);
... ...