Browse Source

horseman字段统一改为employees 测试服配送费改为0.01

master
Lemon 5 years ago
parent
commit
8468c88ad2
  1. 8
      app/Controller/v3/HorsemanController.php
  2. 4
      app/Service/v3/Implementations/DistributionPriceService.php
  3. 10
      app/Service/v3/Implementations/HorsemanService.php

8
app/Controller/v3/HorsemanController.php

@ -22,15 +22,15 @@ class HorsemanController extends BaseController
public function setHorsemanCoordinate()
{
$horsemanId = $this->request->input('horseman_id', -1);
$employeesId = $this->request->input('employees_id', -1);
$coordinate = $this->request->input('coordinate', -1);
return $this->success($this->horsemanService->setHorsemanCoordinate($horsemanId,$coordinate));
return $this->success($this->horsemanService->setHorsemanCoordinate($employeesId,$coordinate));
}
public function getHorsemanCoordinate()
{
$horsemanId = $this->request->input('horseman_id', -1);
$coordinate = $this->horsemanService->getHorsemanCoordinate($horsemanId);
$employeesId = $this->request->input('employees_id', -1);
$coordinate = $this->horsemanService->getHorsemanCoordinate($employeesId);
return $this->success(['coordinate' => $coordinate]);
}

4
app/Service/v3/Implementations/DistributionPriceService.php

@ -11,7 +11,9 @@ class DistributionPriceService implements DistributionPriceServiceInterface
{
public function do($distance)
{
if (env('APP_ENV') === 'dev') {
return 0.01;
}
$deliveryDistance = config('distance.delivery_distance');
$deliveryDistance = ceil($deliveryDistance/1000);
$km = ceil($distance/1000);

10
app/Service/v3/Implementations/HorsemanService.php

@ -29,15 +29,15 @@ class HorsemanService implements HorsemanServiceInterface
}
public function getOrderList()
{
return '接入成功';
return OrderMain::query()->where('state',3)->limit(5)->get();
}
/**
* 记录骑手坐标
*/
public function setHorsemanCoordinate($horsemanId,$coordinate){
public function setHorsemanCoordinate($employeesId,$coordinate){
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
if(false === $ssdb->exec('set', SsdbKeys::HORSEMAN_COORDINATE.$horsemanId,$coordinate)) {
if(false === $ssdb->exec('set', SsdbKeys::HORSEMAN_COORDINATE.$employeesId,$coordinate)) {
return false;
}
return true;
@ -46,9 +46,9 @@ class HorsemanService implements HorsemanServiceInterface
/**
* 获取骑手坐标
*/
public function getHorsemanCoordinate($horsemanId){
public function getHorsemanCoordinate($employeesId){
$ssdb = ApplicationContext::getContainer()->get(SSDBTask::class);
$params = $ssdb->exec('get', SsdbKeys::HORSEMAN_COORDINATE.$horsemanId);
$params = $ssdb->exec('get', SsdbKeys::HORSEMAN_COORDINATE.$employeesId);
if ((false === $params) || empty($params)) {
throw new ErrorCodeException(ErrorCode::HORSEMAN_COORDINATE_FAIL, '获取骑手坐标失败');

Loading…
Cancel
Save