Merge branch 'release/customer-service'
Showing
11 changed files
with
115 additions
and
62 deletions
@@ -99,6 +99,7 @@ try { | @@ -99,6 +99,7 @@ try { | ||
99 | const errorHanlder = require('./doraemon/middleware/error-handler'); | 99 | const errorHanlder = require('./doraemon/middleware/error-handler'); |
100 | const setPageInfo = require('./doraemon/middleware/set-pageinfo'); | 100 | const setPageInfo = require('./doraemon/middleware/set-pageinfo'); |
101 | const pageCache = require('./doraemon/middleware/page-cache'); | 101 | const pageCache = require('./doraemon/middleware/page-cache'); |
102 | + const secretSwitch = require('./doraemon/middleware/secret-switch'); | ||
102 | 103 | ||
103 | // YOHO 前置中间件 | 104 | // YOHO 前置中间件 |
104 | app.use(subDomain()); | 105 | app.use(subDomain()); |
@@ -109,7 +110,7 @@ try { | @@ -109,7 +110,7 @@ try { | ||
109 | app.use(user()); | 110 | app.use(user()); |
110 | app.use(seo()); | 111 | app.use(seo()); |
111 | app.use(setPageInfo()); | 112 | app.use(setPageInfo()); |
112 | - | 113 | + app.use(secretSwitch()); |
113 | app.use(pageCache()); | 114 | app.use(pageCache()); |
114 | require('./dispatch')(app); | 115 | require('./dispatch')(app); |
115 | 116 |
apps/common/controllers/secret-switch.js
0 → 100644
1 | +/** | ||
2 | + * 设置cache controller | ||
3 | + * @author: xiaoxiao<xiaoxiao.hao@yoho.cn> | ||
4 | + * @date: 2016/12/21 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | +const cache = global.yoho.cache; | ||
9 | + | ||
10 | +const index = (req, res, next) => { | ||
11 | + const param = req.query['com.yohobuy.customerservice.enabled']; | ||
12 | + let status = param === 'true'; | ||
13 | + | ||
14 | + cache.set('customerServiceSwitch', status, 0).then(result => { | ||
15 | + res.json(result); | ||
16 | + }).catch(next); | ||
17 | + | ||
18 | +}; | ||
19 | + | ||
20 | +module.exports = { | ||
21 | + index | ||
22 | +}; |
@@ -13,6 +13,7 @@ var multipart = require('connect-multiparty'); | @@ -13,6 +13,7 @@ var multipart = require('connect-multiparty'); | ||
13 | var multipartMiddleware = multipart(); | 13 | var multipartMiddleware = multipart(); |
14 | 14 | ||
15 | const rvCtrl = require(`${cRoot}/recent-view`); | 15 | const rvCtrl = require(`${cRoot}/recent-view`); |
16 | +const cache = require(`${cRoot}/secret-switch`); | ||
16 | const uploadCtrl = require(`${cRoot}/upload`); | 17 | const uploadCtrl = require(`${cRoot}/upload`); |
17 | const erp2goods = require(`${cRoot}/erp2goods`); | 18 | const erp2goods = require(`${cRoot}/erp2goods`); |
18 | const getBanner = require(`${cRoot}/getBanner`); | 19 | const getBanner = require(`${cRoot}/getBanner`); |
@@ -24,6 +25,8 @@ router.post('/upload/image', multipartMiddleware, uploadCtrl.uploadImg); | @@ -24,6 +25,8 @@ router.post('/upload/image', multipartMiddleware, uploadCtrl.uploadImg); | ||
24 | 25 | ||
25 | router.get('/erp2goods', erp2goods.find); | 26 | router.get('/erp2goods', erp2goods.find); |
26 | 27 | ||
28 | +router.get('/secret-switch', cache.index); // 设置cache | ||
29 | + | ||
27 | router.get('/getbanner', getBanner.index); | 30 | router.get('/getbanner', getBanner.index); |
28 | 31 | ||
29 | router.get('/passport', passport.index); | 32 | router.get('/passport', passport.index); |
@@ -34,44 +34,51 @@ const bindController = require(`${cRoot}/3party-bind`); | @@ -34,44 +34,51 @@ const bindController = require(`${cRoot}/3party-bind`); | ||
34 | // const AddressController = require(`${cRoot}/address`); | 34 | // const AddressController = require(`${cRoot}/address`); |
35 | // const GiftController = require(`${cRoot}/gift`); | 35 | // const GiftController = require(`${cRoot}/gift`); |
36 | 36 | ||
37 | -const homeNav = [ | ||
38 | - { | ||
39 | - title: '交易管理', | ||
40 | - subNav: [ | ||
41 | - {name: '我的订单', href: '/home/orders', catchs: ['/home/orders', '/home/index']}, | ||
42 | - {name: '我的收藏', href: '/home/favorite'}, | ||
43 | - {name: '我的有货币', href: '/home/currency'}, | ||
44 | - {name: '我的红包', href: '/home/redenvelopes'}, | ||
45 | - {name: '我的优惠券', href: '/home/coupons'}, | ||
46 | - {name: '我的VIP', href: '/home/vip'} | ||
47 | - ] | ||
48 | - }, | ||
49 | - { | ||
50 | - title: '服务中心', | ||
51 | - subNav: [ | ||
52 | - {name: '我的退/换货', href: '/home/returns'}, | ||
53 | - {name: '我的咨询', href: '/home/consult'}, | ||
54 | - {name: '我的评论', href: '/home/comment'}, | ||
55 | - | ||
56 | - /* {name: '我的投诉', href: '/home/complaints'}, */ | ||
57 | - {name: '我的信息', href: '/home/message', count: 0}, | ||
58 | - {name: '在线客服', href: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409', isBlank: true} | ||
59 | - ] | ||
60 | - }, | ||
61 | - { | ||
62 | - title: '个人信息管理', | ||
63 | - subNav: [ | ||
64 | - {name: '编辑个人资料', href: '/home/user'}, | ||
65 | - {name: '账号安全', href: '/home/account'}, | ||
66 | - {name: '地址管理', href: '/home/address'}, | ||
67 | - {name: '兑换礼品卡', href: '/home/gift'} | ||
68 | - ] | ||
69 | - } | ||
70 | -]; | ||
71 | - | ||
72 | -const getActiveNav = (req)=>{ | ||
73 | - | ||
74 | - let mHomeNav = _.cloneDeep(homeNav); | 37 | +const homeNav = (req, res) => { |
38 | + return [ | ||
39 | + { | ||
40 | + title: '交易管理', | ||
41 | + subNav: [ | ||
42 | + {name: '我的订单', href: '/home/orders', catchs: ['/home/orders', '/home/index']}, | ||
43 | + {name: '我的收藏', href: '/home/favorite'}, | ||
44 | + {name: '我的有货币', href: '/home/currency'}, | ||
45 | + {name: '我的红包', href: '/home/redenvelopes'}, | ||
46 | + {name: '我的优惠券', href: '/home/coupons'}, | ||
47 | + {name: '我的VIP', href: '/home/vip'} | ||
48 | + ] | ||
49 | + }, | ||
50 | + { | ||
51 | + title: '服务中心', | ||
52 | + subNav: [ | ||
53 | + {name: '我的退/换货', href: '/home/returns'}, | ||
54 | + {name: '我的咨询', href: '/home/consult'}, | ||
55 | + {name: '我的评论', href: '/home/comment'}, | ||
56 | + | ||
57 | + /* {name: '我的投诉', href: '/home/complaints'}, */ | ||
58 | + {name: '我的信息', href: '/home/message', count: 0}, | ||
59 | + { | ||
60 | + name: '在线客服', | ||
61 | + href: res.locals.customerServiceSwitch ? | ||
62 | + '/service/client' : 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409', | ||
63 | + isBlank: true | ||
64 | + } | ||
65 | + ] | ||
66 | + }, | ||
67 | + { | ||
68 | + title: '个人信息管理', | ||
69 | + subNav: [ | ||
70 | + {name: '编辑个人资料', href: '/home/user'}, | ||
71 | + {name: '账号安全', href: '/home/account'}, | ||
72 | + {name: '地址管理', href: '/home/address'}, | ||
73 | + {name: '兑换礼品卡', href: '/home/gift'} | ||
74 | + ] | ||
75 | + } | ||
76 | + ]; | ||
77 | +} | ||
78 | + | ||
79 | +const getActiveNav = (req, res)=>{ | ||
80 | + | ||
81 | + let mHomeNav = _.cloneDeep(homeNav(req, res)); | ||
75 | 82 | ||
76 | return mHomeNav.map((item) => { | 83 | return mHomeNav.map((item) => { |
77 | item.subNav = item.subNav.map((nav) => { | 84 | item.subNav = item.subNav.map((nav) => { |
@@ -101,7 +108,7 @@ const getActiveNav = (req)=>{ | @@ -101,7 +108,7 @@ const getActiveNav = (req)=>{ | ||
101 | 108 | ||
102 | const getHomeNav = (req, res, next) => { | 109 | const getHomeNav = (req, res, next) => { |
103 | res.locals.path = [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}]; | 110 | res.locals.path = [{href: helpers.urlFormat('/'), name: 'YOHO!BUY 有货首页'}, {name: '个人中心'}]; |
104 | - res.locals.homeNav = getActiveNav(req); | 111 | + res.locals.homeNav = getActiveNav(req, res); |
105 | res.locals.userThumb = '//img10.static.yhbimg.com/headimg/' + | 112 | res.locals.userThumb = '//img10.static.yhbimg.com/headimg/' + |
106 | '2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'; | 113 | '2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'; |
107 | next(); | 114 | next(); |
@@ -301,8 +301,8 @@ const _getSkuDataByProductBaseInfo = (data) => { | @@ -301,8 +301,8 @@ const _getSkuDataByProductBaseInfo = (data) => { | ||
301 | goodsGroup.total = 0; | 301 | goodsGroup.total = 0; |
302 | goodsGroup.thumbs = []; | 302 | goodsGroup.thumbs = []; |
303 | goodsGroup.size = []; | 303 | goodsGroup.size = []; |
304 | - if(goodsGroup.title.length > 20){ | ||
305 | - goodsGroup.title = goodsGroup.title.substr(0,20) + '...'; | 304 | + if (goodsGroup.title.length > 20) { |
305 | + goodsGroup.title = goodsGroup.title.substr(0, 20) + '...'; | ||
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 |
@@ -10,6 +10,7 @@ | @@ -10,6 +10,7 @@ | ||
10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> | 10 | <meta name="apple-mobile-web-app-status-bar-style" content="black" /> |
11 | <meta content="telephone=no" name="format-detection" /> | 11 | <meta content="telephone=no" name="format-detection" /> |
12 | <meta content="email=no" name="format-detection" /> | 12 | <meta content="email=no" name="format-detection" /> |
13 | + <meta name="renderer" content="webkit"> | ||
13 | {{#if devEnv}} | 14 | {{#if devEnv}} |
14 | <link rel="stylesheet" href="//localhost:5002/css/index.css"> | 15 | <link rel="stylesheet" href="//localhost:5002/css/index.css"> |
15 | {{^}} | 16 | {{^}} |
@@ -21,19 +21,16 @@ module.exports = { | @@ -21,19 +21,16 @@ module.exports = { | ||
21 | // api: 'http://api-test3.yohops.com:9999/', | 21 | // api: 'http://api-test3.yohops.com:9999/', |
22 | // service: 'http://service-test3.yohops.com:9999/', | 22 | // service: 'http://service-test3.yohops.com:9999/', |
23 | // | 23 | // |
24 | - // api: 'http://api.yoho.cn/', | ||
25 | - // service: 'http://service.yoho.cn/', | ||
26 | - | ||
27 | - api: 'http://192.168.102.205:8080/gateway/', | ||
28 | - | ||
29 | - // api: 'http://dev-api.yohops.com:9999/', | ||
30 | - service: 'http://dev-service.yohops.com:9999/', | 24 | + api: 'http://api.yoho.cn/', |
25 | + service: 'http://service.yoho.cn/', | ||
31 | 26 | ||
27 | + // api: 'http://192.168.102.205:8080/gateway/', | ||
28 | + // service: 'http://dev-service.yohops.com:9999/', | ||
32 | search: 'http://192.168.102.216:8080/yohosearch/', | 29 | search: 'http://192.168.102.216:8080/yohosearch/', |
33 | 30 | ||
34 | - imSocket: 'ws://socket.yohobuy.com:10240', | ||
35 | - imCs: 'http://im.yohobuy.com/api', | ||
36 | - imServer: 'http://im.yohobuy.com/server' | 31 | + imSocket: 'wss://imsocket.yohobuy.com:443', |
32 | + imCs: 'https://imhttp.yohobuy.com/api', | ||
33 | + imServer: 'https://imhttp.yohobuy.com/server' | ||
37 | }, | 34 | }, |
38 | subDomains: { | 35 | subDomains: { |
39 | host: '.yohobuy.com', | 36 | host: '.yohobuy.com', |
doraemon/middleware/secret-switch.js
0 → 100644
1 | +const logger = global.yoho.logger; | ||
2 | + | ||
3 | +const secretSwitch = () => { | ||
4 | + return (req, res, next) => { | ||
5 | + // 获取客服开关,读cache | ||
6 | + global.yoho.cache.get('customerServiceSwitch').then(result => { | ||
7 | + Object.assign(res.locals, { | ||
8 | + customerServiceSwitch: result || false | ||
9 | + }); | ||
10 | + next(); | ||
11 | + }).catch((err) => { | ||
12 | + logger.error(err); | ||
13 | + next(); | ||
14 | + }); | ||
15 | + }; | ||
16 | +}; | ||
17 | + | ||
18 | +module.exports = secretSwitch; |
@@ -189,7 +189,7 @@ | @@ -189,7 +189,7 @@ | ||
189 | </div> | 189 | </div> |
190 | <div class="left"> | 190 | <div class="left"> |
191 | <span class="iconfont rgbf"></span> | 191 | <span class="iconfont rgbf"></span> |
192 | - <a href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409" target="_blank"> | 192 | + <a href="{{#if customerServiceSwitch}}/service/client{{else}}http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409{{/if}}" target="_blank"> |
193 | <span class="red">便捷</span> | 193 | <span class="red">便捷</span> |
194 | <span class="rgbf">在线客服</span> | 194 | <span class="rgbf">在线客服</span> |
195 | </a> | 195 | </a> |
@@ -51,8 +51,9 @@ var tipTpl = require('hbs/service/tip.hbs'), | @@ -51,8 +51,9 @@ var tipTpl = require('hbs/service/tip.hbs'), | ||
51 | var processInfo = { | 51 | var processInfo = { |
52 | scrollLoad: false, | 52 | scrollLoad: false, |
53 | manual: false, | 53 | manual: false, |
54 | - promoter: 1, // 评论发起者 1:客户自己 2:客服 | ||
55 | - savedEval: false // 是否保存过评论 | 54 | + completeClose: false, // 评价完成后关闭 |
55 | + promoter: 1, // 评论发起者 1:客户自己 2:客服 | ||
56 | + savedEval: false // 是否保存过评论 | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | var key, | 59 | var key, |
@@ -513,9 +514,12 @@ function pageInit() { | @@ -513,9 +514,12 @@ function pageInit() { | ||
513 | /** | 514 | /** |
514 | * 显示评价弹框 | 515 | * 显示评价弹框 |
515 | */ | 516 | */ |
516 | - function showEvalModal(isclose) { | 517 | + function showEvalModal(cptClose) { |
517 | var $evalModal = $('#makeEvaluation'); | 518 | var $evalModal = $('#makeEvaluation'); |
518 | 519 | ||
520 | + // 评价完成后关闭 | ||
521 | + processInfo.completeClose = cptClose; | ||
522 | + | ||
519 | // 没有接入人工 | 523 | // 没有接入人工 |
520 | if (!processInfo.manual) { | 524 | if (!processInfo.manual) { |
521 | return; | 525 | return; |
@@ -552,11 +556,6 @@ function pageInit() { | @@ -552,11 +556,6 @@ function pageInit() { | ||
552 | if (res && res.code === 200) { | 556 | if (res && res.code === 200) { |
553 | // 评价原因 | 557 | // 评价原因 |
554 | len && discontentHtml(len, data); | 558 | len && discontentHtml(len, data); |
555 | - | ||
556 | - if (isclose) { | ||
557 | - // 评价完成后,是否关闭窗口 | ||
558 | - window.close(); | ||
559 | - } | ||
560 | } | 559 | } |
561 | $evalModal.modal('show'); | 560 | $evalModal.modal('show'); |
562 | } | 561 | } |
@@ -937,6 +936,11 @@ function pageInit() { | @@ -937,6 +936,11 @@ function pageInit() { | ||
937 | socketConfCM.type = allRTs.EVAL_NOTICE; | 936 | socketConfCM.type = allRTs.EVAL_NOTICE; |
938 | socketConfCM.uuid = uuid.v4(); | 937 | socketConfCM.uuid = uuid.v4(); |
939 | socketChat.send(socketConfCM); | 938 | socketChat.send(socketConfCM); |
939 | + | ||
940 | + // 完成后关闭 | ||
941 | + if (processInfo.completeClose) { | ||
942 | + window.close(); | ||
943 | + } | ||
940 | } | 944 | } |
941 | }, | 945 | }, |
942 | error: function() { | 946 | error: function() { |
-
Please register or login to post a comment