Files
kiri-wchat/wx/Token.php
T

30 lines
633 B
PHP
Raw Permalink Normal View History

2019-10-25 15:20:09 +08:00
<?php
2020-03-05 12:41:49 +08:00
namespace wchat\wx;
2019-10-25 15:20:09 +08:00
2022-09-09 16:42:55 +08:00
use wchat\common\Result;
2020-09-10 17:25:46 +08:00
2022-09-09 16:42:55 +08:00
class Token extends SmallProgram
2019-10-25 15:20:09 +08:00
{
2023-11-14 00:45:54 +08:00
/**
* @return Result
*/
public function token(): Result
{
$query = ['grant_type' => 'client_credential'];
if ($this->payConfig->typeIsApp()) {
$query['appid'] = $this->payConfig->pay->wx->appId;
$query['secret'] = $this->payConfig->pay->wx->appSecret;
} else {
$query['appid'] = $this->payConfig->appId;
$query['secret'] = $this->payConfig->appSecret;
2023-11-07 15:13:11 +08:00
}
2023-11-14 12:39:28 +08:00
return $this->get('api.weixin.qq.com', 'cgi-bin/token', $query);
2023-11-14 00:45:54 +08:00
}
2019-11-11 18:14:47 +08:00
2019-10-25 15:20:09 +08:00
}