59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\JsonRpc;
|
|
|
|
use Hyperf\RpcClient\AbstractServiceClient;
|
|
use Hyperf\HttpServer\Contract\RequestInterface;
|
|
|
|
class UserExternalServiceConsumer extends AbstractServiceClient implements UserExternalServiceInterface
|
|
{
|
|
/**
|
|
* 定义对应服务提供者的服务名称
|
|
* @var string
|
|
*/
|
|
protected $serviceName = 'UserExternalService';
|
|
|
|
/**
|
|
* 获取用户信息
|
|
*
|
|
* @param string $openid
|
|
* @param array $field
|
|
* @return array
|
|
*/
|
|
public function getUserInfo(string $openid, array $field = []) : array
|
|
{
|
|
return $this->__request(__FUNCTION__, compact('openid', 'field'));
|
|
}
|
|
|
|
/**
|
|
* 通过微信授权新建用户
|
|
*
|
|
* @param string $openid
|
|
* @return array
|
|
*/
|
|
public function wechatNewUser(string $openid) : array
|
|
{
|
|
return $this->__request(__FUNCTION__, compact('openid'));
|
|
}
|
|
|
|
/**
|
|
* 获取紧急联系人关系列表
|
|
*
|
|
* @return array
|
|
*/
|
|
public function getEmergencyContactKinshipList() : array
|
|
{
|
|
return $this->__request(__FUNCTION__, []);
|
|
}
|
|
|
|
/**
|
|
* 保存紧急联系人
|
|
*
|
|
* @param RequestInterface $request
|
|
* @return array
|
|
*/
|
|
public function addEmergencyContact(RequestInterface $request) : array
|
|
{
|
|
return $this->__request(__FUNCTION__, $request->all());
|
|
}
|
|
} |