From e6fef7870c19548aa0caa539224f7eaa9142d1b9 Mon Sep 17 00:00:00 2001 From: church Date: Thu, 14 Dec 2023 21:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MiniProgram/Base/Client.php | 2 +- src/MiniProgram/Shipping/Client.php | 10 +-- src/MiniProgram/Shipping/ServiceProvider.php | 3 +- src/Work/Wedrive/Client.php | 9 +-- src/Work/Wedrive/FileClient.php | 78 ++++++++++---------- src/Work/Wedrive/ServiceProvider.php | 2 +- src/Work/Wedrive/SpaceClient.php | 51 +++++++------ src/Work/Wedrive/Wedrive.php | 5 +- tests/OpenPlatform/Base/ClientTest.php | 4 +- 9 files changed, 78 insertions(+), 86 deletions(-) diff --git a/src/MiniProgram/Base/Client.php b/src/MiniProgram/Base/Client.php index 3d1e89662..5fec7f3db 100644 --- a/src/MiniProgram/Base/Client.php +++ b/src/MiniProgram/Base/Client.php @@ -35,7 +35,7 @@ public function getPaidUnionid($openid, $options = []) { return $this->httpGet('wxa/getpaidunionid', compact('openid') + $options); } - + /** * Get version info * diff --git a/src/MiniProgram/Shipping/Client.php b/src/MiniProgram/Shipping/Client.php index ef055ab1d..983b4e277 100644 --- a/src/MiniProgram/Shipping/Client.php +++ b/src/MiniProgram/Shipping/Client.php @@ -112,10 +112,8 @@ public function setMsgJumpPath(string $path) */ public function isTradeManaged(string $appID = '') { -// $config = $this->app->getConfig(); - $params = [ - 'appid' => $appID + 'appid' => empty($appID) ? $this->app['config']['app_id'] : $appID ]; return $this->httpPostJson('wxa/sec/order/is_trade_managed', $params); @@ -133,12 +131,10 @@ public function isTradeManaged(string $appID = '') */ public function isTradeCompleted(string $appID = '') { -// $config = $this->app->getConfig(); - $params = [ - 'appid' => $appID + 'appid' => empty($appID) ? $this->app['config']['app_id'] : $appID ]; return $this->httpPostJson('wxa/sec/order/is_trade_management_confirmation_completed', $params); } -} \ No newline at end of file +} diff --git a/src/MiniProgram/Shipping/ServiceProvider.php b/src/MiniProgram/Shipping/ServiceProvider.php index 5769c6c2b..2f7e26b20 100644 --- a/src/MiniProgram/Shipping/ServiceProvider.php +++ b/src/MiniProgram/Shipping/ServiceProvider.php @@ -7,11 +7,10 @@ class ServiceProvider implements ServiceProviderInterface { - public function register(Container $app) { $app['shipping'] = function ($app) { return new Client($app); }; } -} \ No newline at end of file +} diff --git a/src/Work/Wedrive/Client.php b/src/Work/Wedrive/Client.php index 317b753a2..efcd54ba0 100644 --- a/src/Work/Wedrive/Client.php +++ b/src/Work/Wedrive/Client.php @@ -15,21 +15,20 @@ /** * Class Client - * + * * @author lio990527 */ class Client extends BaseClient { - /** * 获取盘专业版信息 - * + * * @param string $userid * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/95856#%E8%8E%B7%E5%8F%96%E7%9B%98%E4%B8%93%E4%B8%9A%E7%89%88%E4%BF%A1%E6%81%AF */ public function proInfo($userid) @@ -44,7 +43,7 @@ public function proInfo($userid) * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/95856#%E8%8E%B7%E5%8F%96%E7%9B%98%E5%AE%B9%E9%87%8F%E4%BF%A1%E6%81%AF */ public function capacity() diff --git a/src/Work/Wedrive/FileClient.php b/src/Work/Wedrive/FileClient.php index 965fb5875..54ed21a4d 100644 --- a/src/Work/Wedrive/FileClient.php +++ b/src/Work/Wedrive/FileClient.php @@ -17,7 +17,7 @@ /** * Class FileClient - * + * * @author lio990527 */ class FileClient extends BaseClient @@ -30,12 +30,12 @@ class FileClient extends BaseClient * @param string $fatherid 父目录fileid, 在根目录时为空间spaceid * @param int $fileType 文件类型, 1:文件夹 3:文档(文档) 4:文档(表格) 6:文档(幻灯片) * @param string $fileName 文件名字 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E6%96%B0%E5%BB%BA%E6%96%87%E4%BB%B6%E6%96%87%E6%A1%A3 */ public function create($userid, $spaceid, $fatherid, $fileType, $fileName) @@ -57,12 +57,12 @@ public function create($userid, $spaceid, $fatherid, $fileType, $fileName) * @param string $userid 操作人userid * @param string $fileid 文件id * @param string $name 新文件名 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E9%87%8D%E5%91%BD%E5%90%8D%E6%96%87%E4%BB%B6 */ public function rename($userid, $fileid, $name) @@ -79,16 +79,16 @@ public function rename($userid, $fileid, $name) /** * 移动文件 * - * @param string $userid + * @param string $userid * @param string|array $fileid 文件fileid * @param string $fatherid 目标目录的fileid * @param boolean $replace 重名时,是否覆盖 false:重名文件进行冲突重命名处理(移动后文件名格式如xxx(1).txt xxx(1).doc等) - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E7%A7%BB%E5%8A%A8%E6%96%87%E4%BB%B6 */ public function move($userid, $fileid, $fatherid, $replace = false) @@ -103,12 +103,12 @@ public function move($userid, $fileid, $fatherid, $replace = false) * * @param string $userid * @param string|array $fileid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E5%88%A0%E9%99%A4%E6%96%87%E4%BB%B6 */ public function delete($userid, $fileid) @@ -127,12 +127,12 @@ public function delete($userid, $fileid) * @param integer $start 查询游标 首次填0, 后续填上一次请求返回的next_start * @param integer $limit 拉取条数 最大1000 * @param integer $sort 列表排序方式 1:名字升序;2:名字降序;3:大小升序;4:大小降序;5:修改时间升序;6:修改时间降序 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E8%8E%B7%E5%8F%96%E6%96%87%E4%BB%B6%E5%88%97%E8%A1%A8 */ public function list($userid, $spaceid, $fatherid = null, $start = 0, $limit = 1000, $sort = 1) @@ -154,12 +154,12 @@ public function list($userid, $spaceid, $fatherid = null, $start = 0, $limit = 1 * * @param string $userid * @param string $fileid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E6%96%87%E4%BB%B6%E4%BF%A1%E6%81%AF */ public function info($userid, $fileid) @@ -175,12 +175,12 @@ public function info($userid, $fileid) * @param string $fatherid 目录id * @param string $fileName 文件名 * @param string $fileContent 文件内容 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6 */ public function upload($userid, $spaceid, $fatherid, $fileName, $fileContent) @@ -202,12 +202,12 @@ public function upload($userid, $spaceid, $fatherid, $fileName, $fileContent) * @param string $userid * @param string $fileid * @param boolean $download 是否直接下载 - * + * * @return \EasyWeChat\Kernel\Http\StreamResponse|\Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93657#%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6 */ public function download($userid, $fileid, $download = false) @@ -230,12 +230,12 @@ public function download($userid, $fileid, $download = false) * * @param string $userid * @param string $fileid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93658#%E8%8E%B7%E5%8F%96%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5 */ public function share($userid, $fileid) @@ -252,12 +252,12 @@ public function share($userid, $fileid) * @param int $auth 权限信息 权限信息 * 普通文档: 1:仅浏览(可下载) 4:仅预览(仅专业版企业可设置);如果不填充此字段为保持原有状态 * 微文档: 1:仅浏览(可下载) 2:可编辑;如果不填充此字段为保持原有状态 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93658#%E5%88%86%E4%BA%AB%E8%AE%BE%E7%BD%AE */ public function setting($userid, $fileid, $authScope, $auth = null) @@ -278,12 +278,12 @@ public function setting($userid, $fileid, $authScope, $auth = null) * @param string $userid * @param string $fileid * @param array $authInfo 添加成员的信息 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93658#%E6%96%B0%E5%A2%9E%E6%88%90%E5%91%98 */ public function aclAdd($userid, $fileid, $authInfo) @@ -299,16 +299,16 @@ public function aclAdd($userid, $fileid, $authInfo) /** * 删除成员 - * + * * @param string $userid * @param string $fileid * @param array $authInfo 删除成员的信息 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93658#%E5%88%A0%E9%99%A4%E6%88%90%E5%91%98 */ public function aclDel($userid, $fileid, $authInfo) diff --git a/src/Work/Wedrive/ServiceProvider.php b/src/Work/Wedrive/ServiceProvider.php index 822d42dda..04723f7cf 100644 --- a/src/Work/Wedrive/ServiceProvider.php +++ b/src/Work/Wedrive/ServiceProvider.php @@ -16,7 +16,7 @@ /** * Class ServiceProvider - * + * * @author lio990527 */ class ServiceProvider implements ServiceProviderInterface diff --git a/src/Work/Wedrive/SpaceClient.php b/src/Work/Wedrive/SpaceClient.php index 6824bd732..da0d500b2 100644 --- a/src/Work/Wedrive/SpaceClient.php +++ b/src/Work/Wedrive/SpaceClient.php @@ -16,12 +16,11 @@ /** * Class SpaceClient - * + * * @author lio990527 */ class SpaceClient extends BaseClient { - /** * 新建空间 * @@ -29,12 +28,12 @@ class SpaceClient extends BaseClient * @param string $spaceName 空间名称 * @param array $authInfo 空间成员权限信息 * @param integer $spaceSubType 空间类型, 0:普通 1:相册 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E6%96%B0%E5%BB%BA%E7%A9%BA%E9%97%B4 */ public function create($userid, $spaceName, $authInfo = [], $spaceSubType = 0) @@ -55,12 +54,12 @@ public function create($userid, $spaceName, $authInfo = [], $spaceSubType = 0) * @param string $userid * @param string $spaceid * @param string $spaceName 重命名后的空间名 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E9%87%8D%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4 */ public function rename($userid, $spaceid, $spaceName) @@ -79,12 +78,12 @@ public function rename($userid, $spaceid, $spaceName) * * @param string $userid * @param string $spaceid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E8%A7%A3%E6%95%A3%E7%A9%BA%E9%97%B4 */ public function dismiss($userid, $spaceid) @@ -97,12 +96,12 @@ public function dismiss($userid, $spaceid) * * @param string $userid * @param string $spaceid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E8%8E%B7%E5%8F%96%E7%A9%BA%E9%97%B4%E7%9B%B8%E5%86%8C%E4%BF%A1%E6%81%AF */ public function info($userid, $spaceid) @@ -115,12 +114,12 @@ public function info($userid, $spaceid) * * @param string $userid * @param string $spaceid - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E8%8E%B7%E5%8F%96%E9%82%80%E8%AF%B7%E9%93%BE%E6%8E%A5 */ public function share($userid, $spaceid) @@ -134,12 +133,12 @@ public function share($userid, $spaceid) * @param string $userid * @param string $spaceid * @param array $settings 设置 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E5%AE%89%E5%85%A8%E8%AE%BE%E7%BD%AE */ public function setting($userid, $spaceid, $settings) @@ -155,12 +154,12 @@ public function setting($userid, $spaceid, $settings) * @param string $userid * @param string $spaceid * @param array $authInfo 被添加的空间成员信息 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E6%B7%BB%E5%8A%A0%E6%88%90%E5%91%98%E9%83%A8%E9%97%A8 */ public function aclAdd($userid, $spaceid, $authInfo) @@ -180,12 +179,12 @@ public function aclAdd($userid, $spaceid, $authInfo) * @param string $userid * @param string $spaceid * @param array $authInfo 被移除的空间成员信息 - * + * * @return \Psr\Http\Message\ResponseInterface|\EasyWeChat\Kernel\Support\Collection|array|object|string - * + * * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException * @throws \GuzzleHttp\Exception\GuzzleException - * + * * @see https://developer.work.weixin.qq.com/document/path/93656#%E6%B7%BB%E5%8A%A0%E6%88%90%E5%91%98%E9%83%A8%E9%97%A8 */ public function aclDel($userid, $spaceid, $authInfo) diff --git a/src/Work/Wedrive/Wedrive.php b/src/Work/Wedrive/Wedrive.php index bb01931f3..eed85dcb6 100644 --- a/src/Work/Wedrive/Wedrive.php +++ b/src/Work/Wedrive/Wedrive.php @@ -15,16 +15,15 @@ /** * Class Wedrive - * + * * @property \EasyWeChat\Work\Wedrive\Client $base * @property \EasyWeChat\Work\Wedrive\SpaceClient $space * @property \EasyWeChat\Work\Wedrive\FileClient $file - * + * * @author lio990527 */ class Wedrive extends Container { - public function __get($key) { return $this->offsetGet($key); diff --git a/tests/OpenPlatform/Base/ClientTest.php b/tests/OpenPlatform/Base/ClientTest.php index 4a8aced11..491325d98 100644 --- a/tests/OpenPlatform/Base/ClientTest.php +++ b/tests/OpenPlatform/Base/ClientTest.php @@ -109,7 +109,7 @@ public function testCreatePreAuthorizationCode() $client->expects() ->httpPostJson('cgi-bin/component/api_create_preauthcode', ['component_appid' => '123456']) ->andReturn('mock-result') - ; + ; $result = $client->createPreAuthorizationCode(); @@ -126,7 +126,7 @@ public function testClearQuota() $client->expects() ->httpPostJson('cgi-bin/component/clear_quota', ['component_appid' => '123456']) ->andReturn('mock-result') - ; + ; $result = $client->clearQuota();