This commit is contained in:
xl
2023-11-14 01:08:06 +08:00
parent 0d8ddfef54
commit a6a2a0f472
11 changed files with 691 additions and 762 deletions
+12 -24
View File
@@ -14,30 +14,18 @@ use wchat\common\Result;
class Account extends SmallProgram
{
/**
* @param string $code
* @return Result
*/
public function login(string $code): Result
{
$param['appid'] = $this->config->getAppid();
$param['secret'] = $this->config->getAppsecret();
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
/**
* @param string $code
* @return Result
*/
public function login(string $code): Result
{
$param['appid'] = $this->payConfig->appId;
$param['secret'] = $this->payConfig->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
$client = new Client('api.q.qq.com', 443, true);
$client->withHeader(['Content-Type' => 'application/json']);
$proxyHost = $this->getConfig()->getProxyHost();
$proxyPort = $this->getConfig()->getProxyPort();
if (!empty($proxyHost) && $proxyPort > 0) {
$client->withProxyHost($proxyHost)->withProxyPort($proxyPort);
}
$client->get('sns/jscode2session', $param);
$client->close();
return Result::init($client);
}
return $this->get('/sns/jscode2session', $param);
}
}