|
|
|
|
@ -114,7 +114,6 @@ class AliPay
|
|
|
|
|
|
|
|
|
|
public function getAliPay()
|
|
|
|
|
{
|
|
|
|
|
$client = new \GuzzleHttp\Client();
|
|
|
|
|
// $request = $client->createRequest('POST', "https://mbillexprod.alipay.com/enterprise/tradeListQuery.json", ['headers' => [
|
|
|
|
|
// 'Accept' => 'application/json, text/javascript',
|
|
|
|
|
// 'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
@ -134,80 +133,83 @@ class AliPay
|
|
|
|
|
// 'pageSize=20&pageNum=1&sortTarget=gmtCreate&order=descend&sortType=0&' .
|
|
|
|
|
// '_input_charset=gbk&ctoken=' . $this->getCookieName('ctoken')]);
|
|
|
|
|
|
|
|
|
|
$request = $client->createRequest('POST', "https://mbillexprod.alipay.com/enterprise/fundAccountDetail.json", ['headers' => [
|
|
|
|
|
'Accept' => 'application/json, text/javascript',
|
|
|
|
|
'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
'Accept-Language' => 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
|
|
|
|
'Connection' => 'keep-alive',
|
|
|
|
|
'Content-Length' => '295',
|
|
|
|
|
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('AliPay_Cookie'),
|
|
|
|
|
'Host' => 'mbillexprod.alipay.com',
|
|
|
|
|
'Origin' => 'https://mbillexprod.alipay.com',
|
|
|
|
|
'Referer' => 'https://mbillexprod.alipay.com/enterprise/fundAccountDetail.htm',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36',
|
|
|
|
|
'X-Requested-With' => 'XMLHttpRequest'
|
|
|
|
|
], 'body' => 'queryEntrance=1&billUserId=' . $this->getCookieName('uid') .
|
|
|
|
|
'&showType=1&type=&precisionQueryKey=tradeNo&' .
|
|
|
|
|
'startDateInput=' . date('Y-m-d', strtotime('-1 day')) . '+00%3A00%3A00&endDateInput=' . date('Y-m-d') . '+23%3A59%3A59&' .
|
|
|
|
|
'pageSize=20&pageNum=1&sortTarget=tradeTime&order=descend&sortType=0&' .
|
|
|
|
|
'_input_charset=gbk&ctoken=' . $this->getCookieName('ctoken')]);
|
|
|
|
|
return iconv('GBK', 'UTF-8', $client->send($request)->getBody()->getContents());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getWxSyncKey()
|
|
|
|
|
{
|
|
|
|
|
$client = new \GuzzleHttp\Client();
|
|
|
|
|
$request = $client->createRequest('POST', "https://" . $this->getConfig('WxPay_Url') . "/cgi-bin/mmwebwx-bin/webwxinit?r=695888609",
|
|
|
|
|
['headers' => [
|
|
|
|
|
$html = (new \GuzzleHttp\Client())
|
|
|
|
|
->request('POST', "https://mbillexprod.alipay.com/enterprise/fundAccountDetail.json", ['headers' => [
|
|
|
|
|
'Accept' => 'application/json, text/javascript',
|
|
|
|
|
'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
'Accept-Language' => 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
|
|
|
|
'Connection' => 'keep-alive',
|
|
|
|
|
'Content-Length' => '295',
|
|
|
|
|
'Content-Type' => 'application/json;charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('WxPay_Cookie'),
|
|
|
|
|
'Host' => $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Origin' => 'https://' . $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Referer' => 'https://' . $this->getConfig('WxPay_Url') . '/',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
|
|
|
|
|
], 'body' => '{"BaseRequest":{"Uin":' . $this->getCookieName('wxuin', $this->getConfig('WxPay_Cookie')) .
|
|
|
|
|
',"Sid":"' . $this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . '","Skey":' .
|
|
|
|
|
'"","DeviceID":"e453731506754000"}}'
|
|
|
|
|
]);
|
|
|
|
|
$json = $client->send($request)->getBody()->getContents();
|
|
|
|
|
$data = json_decode($json, true);
|
|
|
|
|
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('AliPay_Cookie'),
|
|
|
|
|
'Host' => 'mbillexprod.alipay.com',
|
|
|
|
|
'Origin' => 'https://mbillexprod.alipay.com',
|
|
|
|
|
'Referer' => 'https://mbillexprod.alipay.com/enterprise/fundAccountDetail.htm',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36',
|
|
|
|
|
'X-Requested-With' => 'XMLHttpRequest'
|
|
|
|
|
], 'body' => 'queryEntrance=1&billUserId=' . $this->getCookieName('uid') .
|
|
|
|
|
'&showType=1&type=&precisionQueryKey=tradeNo&' .
|
|
|
|
|
'startDateInput=' . date('Y-m-d', strtotime('-1 day')) . '+00%3A00%3A00&endDateInput=' . date('Y-m-d') . '+23%3A59%3A59&' .
|
|
|
|
|
'pageSize=20&pageNum=1&sortTarget=tradeTime&order=descend&sortType=0&' .
|
|
|
|
|
'_input_charset=gbk&ctoken=' . $this->getCookieName('ctoken')])
|
|
|
|
|
->getBody();
|
|
|
|
|
return iconv('GBK', 'UTF-8', $html->getContents());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getWxSyncKey()
|
|
|
|
|
{
|
|
|
|
|
$html = (new \GuzzleHttp\Client())
|
|
|
|
|
->request('POST', "https://" . $this->getConfig('WxPay_Url') . "/cgi-bin/mmwebwx-bin/webwxinit?r=695888609",
|
|
|
|
|
['headers' => [
|
|
|
|
|
'Accept' => 'application/json, text/javascript',
|
|
|
|
|
'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
'Accept-Language' => 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
|
|
|
|
'Connection' => 'keep-alive',
|
|
|
|
|
'Content-Length' => '295',
|
|
|
|
|
'Content-Type' => 'application/json;charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('WxPay_Cookie'),
|
|
|
|
|
'Host' => $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Origin' => 'https://' . $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Referer' => 'https://' . $this->getConfig('WxPay_Url') . '/',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
|
|
|
|
|
], 'body' => '{"BaseRequest":{"Uin":' . $this->getCookieName('wxuin', $this->getConfig('WxPay_Cookie')) .
|
|
|
|
|
',"Sid":"' . $this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . '","Skey":' .
|
|
|
|
|
'"","DeviceID":"e453731506754000"}}'
|
|
|
|
|
])
|
|
|
|
|
->getBody();
|
|
|
|
|
$data = json_decode($html->getContents(), true);
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function getWxPay()
|
|
|
|
|
{
|
|
|
|
|
$client = new \GuzzleHttp\Client();
|
|
|
|
|
if (!$this->getConfig('WxPay_SyncKey') || preg_match('/"Count"\:0/', $this->getConfig('WxPay_SyncKey'))) {
|
|
|
|
|
$syncJson = $this->getWxSyncKey();
|
|
|
|
|
if ($syncJson['BaseResponse']['Ret'] > 0) return json_encode($syncJson, true);
|
|
|
|
|
$sync = json_encode($syncJson['SyncKey']);
|
|
|
|
|
} else $sync = $this->getConfig('WxPay_SyncKey');
|
|
|
|
|
$request = $client->createRequest('POST', "https://" . $this->getConfig('WxPay_Url') . "/cgi-bin/mmwebwx-bin/webwxsync?sid=" .
|
|
|
|
|
$this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . "&skey=",
|
|
|
|
|
['headers' => [
|
|
|
|
|
'Accept' => 'application/json, text/javascript',
|
|
|
|
|
'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
'Accept-Language' => 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
|
|
|
|
'Connection' => 'keep-alive',
|
|
|
|
|
'Content-Length' => '295',
|
|
|
|
|
'Content-Type' => 'application/json;charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('WxPay_Cookie'),
|
|
|
|
|
'Host' => $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Origin' => 'https://' . $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Referer' => 'https://' . $this->getConfig('WxPay_Url') . '/',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
|
|
|
|
|
], 'body' => '{"BaseRequest":{"Uin":' . $this->getCookieName('wxuin', $this->getConfig('WxPay_Cookie')) .
|
|
|
|
|
',"Sid":"' . $this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . '","Skey":"' .
|
|
|
|
|
'","DeviceID":"e453731506754000"},"SyncKey":' . $sync .
|
|
|
|
|
',"rr":' . rand(100000000, 999999999) . '}'
|
|
|
|
|
]);
|
|
|
|
|
$data = $client->send($request)->getBody()->getContents();
|
|
|
|
|
$html = (new \GuzzleHttp\Client())
|
|
|
|
|
->request('POST', "https://" . $this->getConfig('WxPay_Url') . "/cgi-bin/mmwebwx-bin/webwxsync?sid=" .
|
|
|
|
|
$this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . "&skey=",
|
|
|
|
|
['headers' => [
|
|
|
|
|
'Accept' => 'application/json, text/javascript',
|
|
|
|
|
'Accept-Encoding' => 'gzip, deflate, br',
|
|
|
|
|
'Accept-Language' => 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
|
|
|
|
|
'Connection' => 'keep-alive',
|
|
|
|
|
'Content-Length' => '295',
|
|
|
|
|
'Content-Type' => 'application/json;charset=UTF-8',
|
|
|
|
|
'Cookie' => $this->getConfig('WxPay_Cookie'),
|
|
|
|
|
'Host' => $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Origin' => 'https://' . $this->getConfig('WxPay_Url'),
|
|
|
|
|
'Referer' => 'https://' . $this->getConfig('WxPay_Url') . '/',
|
|
|
|
|
'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
|
|
|
|
|
], 'body' => '{"BaseRequest":{"Uin":' . $this->getCookieName('wxuin', $this->getConfig('WxPay_Cookie')) .
|
|
|
|
|
',"Sid":"' . $this->getCookieName('wxsid', $this->getConfig('WxPay_Cookie')) . '","Skey":"' .
|
|
|
|
|
'","DeviceID":"e453731506754000"},"SyncKey":' . $sync .
|
|
|
|
|
',"rr":' . rand(100000000, 999999999) . '}'
|
|
|
|
|
])
|
|
|
|
|
->getBody();
|
|
|
|
|
$data = $html->getContents();
|
|
|
|
|
$this->setConfig('WxPay_SyncKey', json_encode(json_decode($data, true)['SyncKey']));
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|