onlineService.js
1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* 个人中心在线客服
* @author: zxr<xiaoru.zhang@yoho.cn>
* @date: 2016/09/02
*/
'use strict';
const onlineModel = require('../models/onlineService');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const _ = require('lodash');
const helpers = global.yoho.helpers;
const getOnlineServiceInfo = (req, res, next) => {
let serviceUrl = _.get(req.app.locals.wap, 'clientService.new', false) ?
helpers.urlFormat('/service/im') :
'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=';
onlineModel.getOnlineServiceInfo().then((result) => {
res.render('online-service', {
module: 'home',
page: 'online-service',
pageHeader: _.assign(headerModel.setNav({
navTitle: '在线客服'
}), {
navBtn: false
}),
title: '在线客服',
pageFooter: true,
service: result,
serviceUrl: serviceUrl
});
}).catch(next);
};
const getOnlineServiceDetail = (req, res, next) => {
let cateId = parseInt(req.query.cateInfo, 10);
let title = req.query.cateInfo.substring(req.query.cateInfo.indexOf('_') + 1);
onlineModel.getOnlineServiceDetail(cateId).then((result) => {
res.render('online-service-detail', {
module: 'home',
page: 'online-service',
pageHeader: _.assign(headerModel.setNav({
navTitle: title
}), {
navBtn: false
}),
title: title,
pageFooter: true,
service: result
});
}).catch(next);
};
module.exports = {
getOnlineServiceInfo,
getOnlineServiceDetail
};