Browse Source

获取骑行距离

master
lanzu_qinsheng 5 years ago
parent
commit
9a825f4bb3
  1. 32
      app/JsonRpc/LocationService.php
  2. 10
      app/JsonRpc/LocationServiceInterface.php
  3. 1
      config/autoload/dependencies.php

32
app/JsonRpc/LocationService.php

@ -0,0 +1,32 @@
<?php
namespace App\JsonRpc;
use Hyperf\Di\Annotation\Inject;
use Hyperf\RpcServer\Annotation\RpcService;
/**
*@RpcService(name="LocationService", protocol="jsonrpc-http", server="jsonrpc-http", publishTo="")
* Class LocationService
* @package App\JsonRpc
*/
class LocationService implements LocationServiceInterface
{
/**
* @Inject
* @var \App\Service\v3\Interfaces\LocationServiceInterface
*/
protected $locationService;
/**
* @param $lng1
* @param $lat1
* @param $lng2
* @param $lat2
*/
public function getDistanceByTencent($lng1, $lat1, $lng2, $lat2)
{
// TODO: Implement getDistanceByTencent() method.
return $this->locationService->getDistanceByTencent($lng1, $lat1, $lng2, $lat2);
}
}

10
app/JsonRpc/LocationServiceInterface.php

@ -0,0 +1,10 @@
<?php
namespace App\JsonRpc;
interface LocationServiceInterface
{
public function getDistanceByTencent($lng1, $lat1, $lng2, $lat2);
}

1
config/autoload/dependencies.php

@ -80,4 +80,5 @@ return [
\App\Service\v3\Interfaces\SmsServiceInterface::class => \App\Service\v3\Implementations\SmsAliService::class,
\App\Service\v3\Interfaces\AttachmentServiceInterface::class => \App\Service\v3\Implementations\AttachmentService::class,
\App\JsonRpc\PrintServiceInterface::class => \App\JsonRpc\FeieService::class,
\App\JsonRpc\LocationServiceInterface::class => \App\JsonRpc\LocationService::class,
];
Loading…
Cancel
Save