CrawlerService.php 626 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\JsonRpc;
  3. use App\Model\Article;
  4. use App\Model\OldModel\Article as OLDArticle;
  5. use Hyperf\RpcServer\Annotation\RpcService;
  6. use App\Tools\Result;
  7. #[RpcService(name: "CrawlerService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
  8. class CrawlerService implements CrawlerServiceInterface
  9. {
  10. /**
  11. * @param array $data
  12. * @return array
  13. */
  14. public function sendCrawler(array $data): array
  15. {
  16. $result = Article::get();
  17. $b = OLDArticle::get();
  18. $a = [
  19. 'old'=>$b,
  20. 'new'=>$result
  21. ];
  22. return Result::success($a);
  23. }
  24. }