代码拉取完成,页面将自动刷新
特别注意,服务名称首字母必须大写
<?php
namespace addons\diandi_hotel;
use common\rpc\AddonsRpcService;
class rpc extends AddonsRpcService
{
public function serviceName(): string
{
return 'Diandi_hotel'; //首字母必须大写
}
}
<?php
namespace addons\diandi_hotel\rpc;
use addons\diandi_hotel\models\Rpc\ceshiRpcModel;
use common\models\DdUser;
use common\rpc\BaseAbstractServiceModule;
//use common\rpc\model\DdUser;
use EasySwoole\FastDb\FastDb;
use Exception;
class Device extends BaseAbstractServiceModule
{
public static string $moduleName = 'Device';
function moduleName(): string
{
return 'Device';
}
function authOptional(): array
{
return [];
}
/**
* @throws Exception
*/
function ceshi()
{
$result = DdUser::findRecord(11)->asArray();
$this->response()->setMsg(['a'=>1221,'b'=>$result]);
}
}
端口为rpc启动的时候配置的端口
http://ip:8080/diandi_hotel/device/ceshi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。