eee
This commit is contained in:
+12
-24
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user