Skip to content

Commit

Permalink
增加新接口
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Jan 6, 2024
1 parent 13ef2dd commit d52d8cd
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"hyperf/event": "^3.1",
"hyperf/framework": "^3.1",
"hyperf/rpc-multiplex": "^3.1",
"hyperf/support": "^3.1"
"hyperf/support": "^3.1",
"jetbrains/phpstorm-attributes": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
Expand Down
18 changes: 18 additions & 0 deletions src/Constant/OAuthType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace GeminiD\PltCommon\Constant;

enum OAuthType: int
{
case WECHAT_MINI_APP = 0;
}
6 changes: 6 additions & 0 deletions src/RPC/User/UserInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@

namespace GeminiD\PltCommon\RPC\User;

use GeminiD\PltCommon\Constant\OAuthType;
use JetBrains\PhpStorm\ArrayShape;

interface UserInterface
{
public const NAME = 'UserUserInterface';

public function ping(): bool;

#[ArrayShape(['id' => 'int'])]
public function firstByCode(string $code, string $appid, int|OAuthType $type = OAuthType::WECHAT_MINI_APP);
}
32 changes: 32 additions & 0 deletions tests/Cases/UserTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/

namespace HyperfTest\Cases;

use GeminiD\PltCommon\Constant\OAuthType;
use Hyperf\Codec\Json;

/**
* @internal
* @coversNothing
*/
class UserTest extends AbstractTestCase
{
public function testOAuth()
{
$json = [
'type' => OAuthType::WECHAT_MINI_APP,
];

$this->assertTrue(is_array(Json::decode(Json::encode($json))));
}
}

0 comments on commit d52d8cd

Please sign in to comment.