Commit 619d60a4c08c42e18559ff92ebad7c4b9c968b99
1 parent
996ee462
3.0 urldecode优化
Showing
1 changed file
with
11 additions
and
3 deletions
utils/request.js
| @@ -686,6 +686,14 @@ module.exports = { | @@ -686,6 +686,14 @@ module.exports = { | ||
| 686 | var token2=""; | 686 | var token2=""; |
| 687 | 687 | ||
| 688 | if(data && Object.keys(data).length>0) { | 688 | if(data && Object.keys(data).length>0) { |
| 689 | + | ||
| 690 | + for(var i in data){ | ||
| 691 | + var item=data[i]; | ||
| 692 | + if (typeof item === 'string') { | ||
| 693 | + data[i]=decodeURIComponent(item); //urldecode | ||
| 694 | + } | ||
| 695 | + } | ||
| 696 | + | ||
| 689 | var req4 =''; | 697 | var req4 =''; |
| 690 | if(is_json){ | 698 | if(is_json){ |
| 691 | req4 = JSON.stringify(data); | 699 | req4 = JSON.stringify(data); |
| @@ -699,12 +707,12 @@ module.exports = { | @@ -699,12 +707,12 @@ module.exports = { | ||
| 699 | } | 707 | } |
| 700 | req4 = JSON.stringify(data, stringifyReplacer); | 708 | req4 = JSON.stringify(data, stringifyReplacer); |
| 701 | } | 709 | } |
| 702 | - console.log(req4+':---token0'); | 710 | + //console.log(req4+':---token0'); |
| 703 | token2 = md5(req4).toUpperCase(); | 711 | token2 = md5(req4).toUpperCase(); |
| 704 | - console.log(name2+':---token1:'+token2); | 712 | + //console.log(name2+':---token1:'+token2); |
| 705 | } | 713 | } |
| 706 | var str=name2.toUpperCase()+token2+now+userkey.token+setting.environment_key; | 714 | var str=name2.toUpperCase()+token2+now+userkey.token+setting.environment_key; |
| 707 | - console.log('---tk_str:'+str); | 715 | + //console.log('---tk_str:'+str); |
| 708 | var tk = md5(str).toUpperCase(); | 716 | var tk = md5(str).toUpperCase(); |
| 709 | return tk; | 717 | return tk; |
| 710 | } | 718 | } |