Files
kiri-wchat/qq/Account.php
T

48 lines
1.0 KiB
PHP
Raw Normal View History

2019-10-25 15:20:09 +08:00
<?php
/**
* Created by PhpStorm.
* User: whwyy
* Date: 2018/4/19 0019
* Time: 16:12
*/
2020-03-05 12:41:49 +08:00
namespace wchat\qq;
2019-10-25 15:20:09 +08:00
2020-03-05 12:41:49 +08:00
use wchat\common\Result;
2019-10-25 15:20:09 +08:00
2019-11-11 18:14:47 +08:00
class Account extends SmallProgram
2019-10-25 15:20:09 +08:00
{
2022-09-09 16:42:55 +08:00
2023-11-14 01:08:06 +08:00
/**
* @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';
2023-11-14 12:39:28 +08:00
return $this->get('api.q.qq.com', '/sns/jscode2session', $param);
}
/**
* @param string $code
* @return Result
*/
public function appLogin(string $code): Result
{
$param['appid'] = $this->payConfig->appId;
$param['secret'] = $this->payConfig->appSecret;
$param['js_code'] = $code;
$param['grant_type'] = 'authorization_code';
$this->host = 'graph.qq.com';
return $this->get('api.q.qq.com', '/user/get_user_info', $param);
2023-11-14 01:08:06 +08:00
}
2019-10-25 15:20:09 +08:00
}