Browse Source

Merge branch 'phoenix' of ssh://120.24.33.109:11022/hyzjshwo/lanzu_api_hyperf into phoenix

# Conflicts:
#	app/JsonRpc/OrderService.php
master
weigang 6 years ago
parent
commit
ecf522dcdc
  1. 32
      app/JsonRpc/LocationService.php
  2. 10
      app/JsonRpc/LocationServiceInterface.php
  3. 23
      app/JsonRpc/OrderService.php
  4. 6
      app/Service/v3/Implementations/PaymentService.php
  5. 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);
}

23
app/JsonRpc/OrderService.php

@ -85,15 +85,24 @@ class OrderService implements OrderServiceInterface
Db::beginTransaction();
try {
$this->orderOnlineService->doRefund($global_order_id, $user_id);
$result = $this->orderOnlineService->doRefund($global_order_id, $user_id);
Db::commit();
return [
"status" => 200,
"code" => 0,
"result" => [],
"message" => '处理成功'
];
if ($result['return_code'] == 'SUCCESS' && isset($result['result_code']) && $result['result_code'] == "SUCCESS") {
return [
"status" => 200,
"code" => 0,
"result" => [],
"message" => '处理成功'
];
} else {
return [
"status" => 200,
"code" => -1,
"result" => [],
"message" => $result['err_code_des']
];
}
} catch (\Exception $e) {
Db::rollBack();

6
app/Service/v3/Implementations/PaymentService.php

@ -127,11 +127,7 @@ class PaymentService implements PaymentServiceInterface
'notify_url' => config('wechat.notify_url.refund'),
]
);
if ($result['return_code']=="SUCCESS"&&isset($result['result_code'])&&$result['result_code']=="SUCCESS"){
return true;
}else{
throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, '[退款失败]'.$result['err_code_des']);
}
return $result;
} catch (\Exception $e) {
$this->log->event(LogLabel::ORDER_PAYMENT_LOG, ['payment_do_exception_msg' => $e->getMessage()]);
throw new ErrorCodeException(ErrorCode::PAYMENT_FAIL, '[退款失败]'.$e->getMessage());

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