added 新增获取二维码接口
This commit is contained in:
parent
acce7df405
commit
d46b07c64c
|
@ -147,12 +147,9 @@ class BaseClient {
|
|||
if (empty($this->middlewares)) {
|
||||
$this->registerHttpMiddlewares();
|
||||
}
|
||||
|
||||
$response = $this->performRequest($url, $method, $options);
|
||||
|
||||
$this->app->events->dispatch(new Events\HttpResponseCreated($response));
|
||||
|
||||
return $returnRaw ? $response : $this->castResponseToType($response, $this->app->config->get('response_type'));
|
||||
return $this->castResponseToType($response, $this->app->config->get('response_type'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,13 +4,12 @@ namespace EasyTiktok\MiniProgram;
|
|||
|
||||
use EasyTiktok\Kernel\ServiceContainer;
|
||||
use EasyTiktok\Kernel\Traits\ResponseCastable;
|
||||
use EasyTiktok\MiniProgram\Auth\AccessToken;
|
||||
use EasyTiktok\MiniProgram\Base\Client;
|
||||
|
||||
/**
|
||||
* Class Application.
|
||||
* @property Client $base
|
||||
* @property AccessToken $access_token
|
||||
* @property Base\Client $base
|
||||
* @property Auth\AccessToken $access_token
|
||||
* @property QrCode\Client $qr_code
|
||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||
*/
|
||||
class Application extends ServiceContainer {
|
||||
|
@ -22,7 +21,8 @@ class Application extends ServiceContainer {
|
|||
*/
|
||||
protected $providers = [
|
||||
Base\ServiceProvider::class,
|
||||
Auth\ServiceProvider::class
|
||||
Auth\ServiceProvider::class,
|
||||
QrCode\ServiceProvider::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the apiadmin/tiktok.
|
||||
*/
|
||||
|
||||
namespace EasyTiktok\MiniProgram\QrCode;
|
||||
|
||||
use EasyTiktok\Kernel\BaseClient;
|
||||
use EasyTiktok\Kernel\Exceptions\HttpException;
|
||||
use EasyTiktok\Kernel\Exceptions\InvalidConfigException;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Client extends BaseClient {
|
||||
/**
|
||||
* 创建抖音二维码
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws InvalidConfigException
|
||||
* @throws GuzzleException|HttpException
|
||||
*/
|
||||
public function createQr(): array {
|
||||
return $this->httpPostJson('apps/qrcode', [
|
||||
'appname' => 'douyin',
|
||||
'set_icon' => true
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the apiadmin/tiktok.
|
||||
*/
|
||||
|
||||
namespace EasyTiktok\MiniProgram\QrCode;
|
||||
|
||||
use Pimple\Container;
|
||||
use Pimple\ServiceProviderInterface;
|
||||
|
||||
/**
|
||||
* QrCode ServiceProvider.
|
||||
*
|
||||
* @author dysodeng <dysodengs@gmail.com>
|
||||
*/
|
||||
class ServiceProvider implements ServiceProviderInterface {
|
||||
/**
|
||||
* {@inheritdoc}.
|
||||
*/
|
||||
public function register(Container $pimple): void {
|
||||
$pimple['qr_code'] = static function($app) {
|
||||
return new Client($app);
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue