This commit is contained in:
37
app/JsonRpc/EasyAppServiceConsumer.php
Normal file
37
app/JsonRpc/EasyAppServiceConsumer.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/4
|
||||
* Time: 上午10:11
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
use Hyperf\RpcClient\AbstractServiceClient;
|
||||
|
||||
class EasyAppServiceConsumer extends AbstractServiceClient implements EasyAppServiceInterface
|
||||
{
|
||||
// 定义对应服务提供者的服务名
|
||||
protected string $serviceName = 'EasyAppService';
|
||||
|
||||
// 定义对应服务提供者的服务协议
|
||||
protected string $protocol = 'jsonrpc-http';
|
||||
|
||||
/**
|
||||
* 获取客户端IP信息
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getClientIpInfo(array $params): array
|
||||
{
|
||||
return $this->__request(__FUNCTION__, $params);
|
||||
}
|
||||
}
|
26
app/JsonRpc/EasyAppServiceInterface.php
Normal file
26
app/JsonRpc/EasyAppServiceInterface.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/4
|
||||
* Time: 上午10:10
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
interface EasyAppServiceInterface
|
||||
{
|
||||
/**
|
||||
* 获取客户端IP信息
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function getClientIpInfo(array $params): array;
|
||||
}
|
33
app/JsonRpc/InventoryServiceConsumer.php
Normal file
33
app/JsonRpc/InventoryServiceConsumer.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午1:58
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
use Hyperf\RpcClient\AbstractServiceClient;
|
||||
|
||||
class InventoryServiceConsumer extends AbstractServiceClient implements InventoryServiceInterface
|
||||
{
|
||||
protected string $serviceName = 'InventoryService';
|
||||
|
||||
protected string $protocol = 'jsonrpc-http';
|
||||
|
||||
/**
|
||||
* 新增库存-手动单条.
|
||||
*/
|
||||
public function addInventory(array $data): void
|
||||
{
|
||||
$this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
}
|
26
app/JsonRpc/InventoryServiceInterface.php
Normal file
26
app/JsonRpc/InventoryServiceInterface.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午1:58
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
interface InventoryServiceInterface
|
||||
{
|
||||
/**
|
||||
* 新增库存-手动单条.
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function addInventory(array $data): void;
|
||||
}
|
86
app/JsonRpc/UserAuthServiceConsumer.php
Normal file
86
app/JsonRpc/UserAuthServiceConsumer.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/3
|
||||
* Time: 下午8:36
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
use Hyperf\RpcClient\AbstractServiceClient;
|
||||
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/3
|
||||
* Time: 下午8:37
|
||||
* Description: 用户服务。
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
class UserAuthServiceConsumer extends AbstractServiceClient implements UserAuthServiceInterface
|
||||
{
|
||||
protected string $serviceName = 'UserAuthService';
|
||||
|
||||
protected string $protocol = 'jsonrpc-http';
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userLogin(array $data): array
|
||||
{
|
||||
return $this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户.
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function addUser(array $data): void
|
||||
{
|
||||
$this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userInfoByToken(array $data): array
|
||||
{
|
||||
return $this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加角色.
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function addRole(array $data): void
|
||||
{
|
||||
$this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户列表.
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userList(array $data): array
|
||||
{
|
||||
return $this->__request(__FUNCTION__, $data);
|
||||
}
|
||||
}
|
52
app/JsonRpc/UserAuthServiceInterface.php
Normal file
52
app/JsonRpc/UserAuthServiceInterface.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/3
|
||||
* Time: 下午8:35
|
||||
* Description:
|
||||
*
|
||||
* (c) ykxiao <yk_9001@hotmail.com>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\JsonRpc;
|
||||
|
||||
interface UserAuthServiceInterface
|
||||
{
|
||||
/**
|
||||
* 用户登录
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userLogin(array $data): array;
|
||||
|
||||
/**
|
||||
* 新增用户.
|
||||
*/
|
||||
public function addUser(array $data): void;
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userInfoByToken(array $data): array;
|
||||
|
||||
/**
|
||||
* 添加角色.
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
public function addRole(array $data): void;
|
||||
|
||||
/**
|
||||
* 获取用户列表.
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
public function userList(array $data): array;
|
||||
}
|
Reference in New Issue
Block a user