This commit is contained in:
2025-03-17 11:27:07 +08:00
parent 7a7f432006
commit 5febeca83f
6805 changed files with 6 additions and 6 deletions

View File

@@ -0,0 +1,67 @@
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\MiniProgram\Plugin;
use EasyWeChat\Kernel\BaseClient;
/**
* Class Client.
*
* @author mingyoung <mingyoungcheung@gmail.com>
*/
class Client extends BaseClient
{
/**
* @param string $appId
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function apply($appId)
{
return $this->httpPostJson('wxa/plugin', [
'action' => 'apply',
'plugin_appid' => $appId,
]);
}
/**
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function list()
{
return $this->httpPostJson('wxa/plugin', [
'action' => 'list',
]);
}
/**
* @param string $appId
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function unbind($appId)
{
return $this->httpPostJson('wxa/plugin', [
'action' => 'unbind',
'plugin_appid' => $appId,
]);
}
}

View File

@@ -0,0 +1,86 @@
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\MiniProgram\Plugin;
use EasyWeChat\Kernel\BaseClient;
/**
* Class DevClient.
*
* @author her-cat <i@her-cat.com>
*/
class DevClient extends BaseClient
{
/**
* Get users.
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function getUsers(int $page = 1, int $size = 10)
{
return $this->httpPostJson('wxa/devplugin', [
'action' => 'dev_apply_list',
'page' => $page,
'num' => $size,
]);
}
/**
* Agree to use plugin.
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function agree(string $appId)
{
return $this->httpPostJson('wxa/devplugin', [
'action' => 'dev_agree',
'appid' => $appId,
]);
}
/**
* Refuse to use plugin.
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function refuse(string $reason)
{
return $this->httpPostJson('wxa/devplugin', [
'action' => 'dev_refuse',
'reason' => $reason,
]);
}
/**
* Delete rejected applications.
*
* @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
*
* @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
* @throws \GuzzleHttp\Exception\GuzzleException
*/
public function delete()
{
return $this->httpPostJson('wxa/devplugin', [
'action' => 'dev_delete',
]);
}
}

View File

@@ -0,0 +1,40 @@
<?php
/*
* This file is part of the overtrue/wechat.
*
* (c) overtrue <i@overtrue.me>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace EasyWeChat\MiniProgram\Plugin;
use Pimple\Container;
use Pimple\ServiceProviderInterface;
/**
* Class ServiceProvider.
*
* @author mingyoung <mingyoungcheung@gmail.com>
*/
class ServiceProvider implements ServiceProviderInterface
{
/**
* Registers services on the given container.
*
* This method should only be used to configure services and parameters.
* It should not get services.
*/
public function register(Container $app)
{
$app['plugin'] = function ($app) {
return new Client($app);
};
$app['plugin_dev'] = function ($app) {
return new DevClient($app);
};
}
}