lib/rock_fintech/sign/sign.rb in rock_fintech-0.7.0 vs lib/rock_fintech/sign/sign.rb in rock_fintech-0.8.0
- old
+ new
@@ -21,17 +21,20 @@
if v.kind_of?(Hash) # 如果是 hash 接着 serialize
data[k] = serialize(v)
elsif v.kind_of?(Array)
if v[0].kind_of?(Hash) # 如果是 hash 数组对元素接着 serialize
v.each_with_index{ |ele, index|
- v[index] = ele.to_json #serialize(ele)
+ ele.delete('sign')
+ ele.delete(:sign)
+ ele = Hash[ele.sort]
+ v[index] = ele.map{|k,v| "#{k}=#{v}"}.join('&')
}
+ data[k] = v.join('&')
else # 如果是普通元素数组
data[k] = v.join('&')
end
end
}
-
data.map{|k,v| "#{k}=#{v}"}.join('&')
end # serialize
end
end