|
|
@@ -482,17 +482,30 @@ class API extends AbstractAPI
|
|
|
$params['nonce_str'] = uniqid();
|
|
|
$params = array_filter($params);
|
|
|
@file_put_contents('quanju2.txt', json_encode($this->getSignkey($api))."-微信支付失败9\r\n", 8);
|
|
|
- ksort($params);
|
|
|
- foreach ($params as $key => $value) {
|
|
|
+ $params2 = [
|
|
|
+ 'appid' => 'wxc249a20cfeed19cd',
|
|
|
+ 'mch_id' => '1731458899',
|
|
|
+ 'nonce_str' => 'test123456',
|
|
|
+ 'body' => 'test',
|
|
|
+ 'out_trade_no' => 'test' . time(),
|
|
|
+ 'total_fee' => 1,
|
|
|
+ 'spbill_create_ip' => '127.0.0.1',
|
|
|
+ 'notify_url' => 'http://gcshop.qiniu1314.com/api/wechat/notify',
|
|
|
+ 'trade_type' => 'JSAPI',
|
|
|
+ 'openid' => 'o4h8g2NHKRUxkKw3ZKcDjZq0RojA'
|
|
|
+ ];
|
|
|
+ ksort($params2);
|
|
|
+// ksort($params);
|
|
|
+ foreach ($params2 as $key => $value) {
|
|
|
$cleanValue = preg_replace('/\s+/', ' ', trim($value));
|
|
|
if ($value !== $cleanValue) {
|
|
|
file_put_contents('quanju2.txt', "参数 {$key} 包含隐藏字符\n原始: '" . $value . "'\n清理: '" . $cleanValue . "'\n", FILE_APPEND);
|
|
|
}
|
|
|
}
|
|
|
- $params['sign'] = generate_sign($params, $this->getSignkey($api), 'md5');
|
|
|
- @file_put_contents('quanju2.txt', json_encode($params)."-微信支付失败7\r\n", 8);
|
|
|
+ $params2['sign'] = generate_sign($params2, $this->getSignkey($api), 'md5');
|
|
|
+ @file_put_contents('quanju2.txt', json_encode($params2)."-微信支付失败7\r\n", 8);
|
|
|
$options = array_merge([
|
|
|
- 'body' => XML::build($params),
|
|
|
+ 'body' => XML::build($params2),
|
|
|
], $options);
|
|
|
@file_put_contents('quanju2.txt', json_encode($options)."-微信支付失败10\r\n", 8);
|
|
|
$response = $this->getHttp()->request($api, $method, $options);
|