PublicRpcService.php 572 B

12345678910111213141516171819
  1. <?php
  2. namespace App\JsonRpc;
  3. use App\Model\District;
  4. use Hyperf\RpcServer\Annotation\RpcService;
  5. use App\Tools\Result;
  6. #[RpcService(name: "PublicRpcService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
  7. class PublicRpcService implements PublicRpcServiceInterface
  8. {
  9. /**
  10. * @param array $data
  11. * @return array
  12. */
  13. public function getDistrictList(array $data): array
  14. {
  15. $result = District::where($data)->orderBy("code","asc")->get();
  16. return $result?Result::success($result->toArray()):Result::error("没有查到数据");
  17. }
  18. }