Authored by huangyCode

md5方法

  1 +import md5 from '../vendors/md5';
1 import Promise from '../vendors/es6-promise'; 2 import Promise from '../vendors/es6-promise';
2 import objectAssign from '../vendors/object-assign'; 3 import objectAssign from '../vendors/object-assign';
3 import trimObject from '../utils/trimObject'; 4 import trimObject from '../utils/trimObject';
@@ -64,6 +65,7 @@ function request(method = 'GET') { @@ -64,6 +65,7 @@ function request(method = 'GET') {
64 return getPrivateKey() 65 return getPrivateKey()
65 .then(key => { 66 .then(key => {
66 return new Promise(function (resolve, reject) { 67 return new Promise(function (resolve, reject) {
  68 +
67 let app = getApp(); 69 let app = getApp();
68 if (params && !params.hasOwnProperty('uid')) { 70 if (params && !params.hasOwnProperty('uid')) {
69 let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : 0; 71 let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : 0;
@@ -85,7 +87,6 @@ function request(method = 'GET') { @@ -85,7 +87,6 @@ function request(method = 'GET') {
85 } 87 }
86 params.udid = udid; 88 params.udid = udid;
87 } 89 }
88 -  
89 let body = _createBody(params); 90 let body = _createBody(params);
90 let queryStrigPair = _signParam(body, true); 91 let queryStrigPair = _signParam(body, true);
91 let data = ''; 92 let data = '';
@@ -354,6 +355,7 @@ function _signParam(params,opt) { @@ -354,6 +355,7 @@ function _signParam(params,opt) {
354 355
355 allParams = trimObject(allParams); // 去除首尾空格 356 allParams = trimObject(allParams); // 去除首尾空格
356 let paramsPair = queryString.stringify(allParams, {encode: false}); 357 let paramsPair = queryString.stringify(allParams, {encode: false});
  358 + debugger
357 let client_secret = md5(paramsPair); 359 let client_secret = md5(paramsPair);
358 360
359 delete allParams.private_key; 361 delete allParams.private_key;