Authored by 沈志敏

对外暴露uid

1 { 1 {
2 "name": "yoho-js-sdk", 2 "name": "yoho-js-sdk",
3 - "version": "1.1.6", 3 + "version": "1.1.7",
4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。", 4 "description": "YOHO!前端js的功能封装包,主要用于在活动页面中,对主要功能的封装。",
5 "keywords": [ 5 "keywords": [
6 "YOHO!", 6 "YOHO!",
@@ -25,5 +25,8 @@ export default { @@ -25,5 +25,8 @@ export default {
25 favout: user.favout, 25 favout: user.favout,
26 getMktCode: function(){ 26 getMktCode: function(){
27 return user.getMktCode(); 27 return user.getMktCode();
  28 + },
  29 + getUid: function(){
  30 + return user.uid;
28 } 31 }
29 }; 32 };
@@ -3,9 +3,31 @@ @@ -3,9 +3,31 @@
3 */ 3 */
4 import utils from './utils'; 4 import utils from './utils';
5 5
  6 +const channelMap = {
  7 + 'baidu.com': 100000000000055,
  8 + 'so.com': 100000000000049,
  9 + 'sogou.com': 100000000000053,
  10 + 'bing.com': 100000000000057,
  11 + 'm.sm.cn': 100000000000059,
  12 + 'google.com': 100000000000061
  13 +};
  14 +
  15 +const getMktcBySeo = () => {
  16 + var mktc,
  17 + rf = document.referrer;
  18 +
  19 + for (var domain in channelMap) {
  20 + if (rf.indexOf(domain) > -1) {
  21 + mktc = channelMap[domain];
  22 + break;
  23 + }
  24 + }
  25 + return mktc;
  26 +};
  27 +
6 const getAppPath = () => { 28 const getAppPath = () => {
7 let qs = utils.queryString(); 29 let qs = utils.queryString();
8 - let ct = qs.mkt_code || qs.union_type; 30 + let ct = qs.mkt_code || qs.union_type || getMktcBySeo() || '100000000000349';
9 31
10 delete qs.openapp; // 防止重复打开 32 delete qs.openapp; // 防止重复打开
11 33