Authored by ccbikai(👎🏻🍜)

唤起 app 传入 yasvd

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 * 移动端尝试打开 app 2 * 移动端尝试打开 app
3 */ 3 */
4 const qs = require('yoho-qs'); 4 const qs = require('yoho-qs');
  5 +const cookie = require('yoho-cookie');
5 6
6 const u = navigator.userAgent; 7 const u = navigator.userAgent;
7 const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer); 8 const isFromYOHO = /m\.yohobuy\.com/i.test(document.referrer);
@@ -57,11 +58,16 @@ const canOpenApp = () => { @@ -57,11 +58,16 @@ const canOpenApp = () => {
57 const getAppPath = () => { 58 const getAppPath = () => {
58 let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}'; 59 let appPath = document.getElementById('main-wrap').dataset.apppath || 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.home","params":{"gender":"1","channel":"2"}}';
59 let ct = qs.mkt_code || qs.union_type || getMktcBySeo() || '100000000000349'; 60 let ct = qs.mkt_code || qs.union_type || getMktcBySeo() || '100000000000349';
  61 + let clientId = cookie.get('_yasvd');
60 62
61 if (ct) { 63 if (ct) {
62 appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&'); 64 appPath = appPath.replace('goapp?', 'goapp?ct=' + ct + '&');
63 } 65 }
64 66
  67 + if (clientId) {
  68 + appPath = appPath.replace('goapp?', 'goapp?client_id=' + clientId + '&');
  69 + }
  70 +
65 return appPath; 71 return appPath;
66 }; 72 };
67 73