This commit is contained in:
36
app/JsonRpc/BaseService.php
Normal file
36
app/JsonRpc/BaseService.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* * Time: 下午1:56
|
||||
* 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 App\Service\JsonRpcResponse;
|
||||
use Hyperf\Di\Annotation\Inject;
|
||||
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午1:56
|
||||
* 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.
|
||||
*/
|
||||
abstract class BaseService
|
||||
{
|
||||
#[Inject]
|
||||
protected JsonRpcResponse $response;
|
||||
}
|
27
app/JsonRpc/InventoryService.php
Normal file
27
app/JsonRpc/InventoryService.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Author: ykxiao
|
||||
* Date: 2025/6/5
|
||||
* Time: 下午1:45
|
||||
* 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\RpcServer\Annotation\RpcService;
|
||||
|
||||
#[RpcService(name: 'InventoryService', server: 'jsonrpc-http', protocol: 'jsonrpc-http', publishTo: 'nacos')]
|
||||
class InventoryService extends BaseService implements InventoryServiceInterface
|
||||
{
|
||||
public function addInventory(array $data): void
|
||||
{
|
||||
|
||||
}
|
||||
}
|
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:46
|
||||
* 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;
|
||||
}
|
Reference in New Issue
Block a user