AdService.php 839 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace App\JsonRpc;
  3. use Hyperf\RpcClient\AbstractServiceClient;
  4. class AdService extends AbstractServiceClient implements AdServiceInterface
  5. {
  6. /**
  7. * 定义对应服务提供者的服务名称
  8. * @var string
  9. */
  10. protected string $serviceName = 'AdService';
  11. /**
  12. * 定义对应服务提供者的服务协议
  13. * @var string
  14. */
  15. protected string $protocol = 'jsonrpc-http';
  16. /**
  17. * @param string $name
  18. * @param string $url
  19. * @return mixed|string
  20. */
  21. public function createAd(string $name, string $url)
  22. {
  23. return $this->__request(__FUNCTION__, compact('name', 'url'));
  24. }
  25. /**
  26. * @param int $id
  27. * @return array|mixed
  28. */
  29. public function getAdInfo(int $id)
  30. {
  31. return $this->__request(__FUNCTION__, compact('id'));
  32. }
  33. }