From e7402c02a3250a6e87731320a3d4be75bfd2ab95 Mon Sep 17 00:00:00 2001 From: lanzu_qinsheng <334039090@qq.com> Date: Fri, 11 Sep 2020 09:49:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=80=80=E6=AC=BE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/JsonRpc/OrderService.php | 29 ++++++++++++------- .../v3/Implementations/PaymentService.php | 6 +--- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/JsonRpc/OrderService.php b/app/JsonRpc/OrderService.php index 0e662a1..1f49932 100644 --- a/app/JsonRpc/OrderService.php +++ b/app/JsonRpc/OrderService.php @@ -81,15 +81,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(); @@ -109,11 +118,11 @@ class OrderService implements OrderServiceInterface * 退款:2-0.2=1.8元 * @param $user_id *用户ID * @param $global_order_id *全局总订单ID - * @param $child_order_id *主订单ID, - * @param $order_goods_id *订单商品ID + * @param $child_order_id *主订单ID, + * @param $order_goods_id *订单商品ID * @param $note */ - public function onlineSingleRefund($user_id, $note, $global_order_id, $child_order_id=null, $order_goods_id=null) + public function onlineSingleRefund($user_id, $note, $global_order_id, $child_order_id = null, $order_goods_id = null) { if (!$user_id || !$global_order_id || !$note) { $this->log->event(LogLabel::ORDER_REFUND_LOG, [ diff --git a/app/Service/v3/Implementations/PaymentService.php b/app/Service/v3/Implementations/PaymentService.php index d447fa8..e979635 100644 --- a/app/Service/v3/Implementations/PaymentService.php +++ b/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()); From 9a825f4bb382e55683d4b08fe6349cf032c8e301 Mon Sep 17 00:00:00 2001 From: lanzu_qinsheng <334039090@qq.com> Date: Fri, 11 Sep 2020 11:18:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=AA=91=E8=A1=8C?= =?UTF-8?q?=E8=B7=9D=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/JsonRpc/LocationService.php | 32 ++++++++++++++++++++++++ app/JsonRpc/LocationServiceInterface.php | 10 ++++++++ config/autoload/dependencies.php | 1 + 3 files changed, 43 insertions(+) create mode 100644 app/JsonRpc/LocationService.php create mode 100644 app/JsonRpc/LocationServiceInterface.php diff --git a/app/JsonRpc/LocationService.php b/app/JsonRpc/LocationService.php new file mode 100644 index 0000000..bb9358f --- /dev/null +++ b/app/JsonRpc/LocationService.php @@ -0,0 +1,32 @@ +locationService->getDistanceByTencent($lng1, $lat1, $lng2, $lat2); + } +} \ No newline at end of file diff --git a/app/JsonRpc/LocationServiceInterface.php b/app/JsonRpc/LocationServiceInterface.php new file mode 100644 index 0000000..cf076bb --- /dev/null +++ b/app/JsonRpc/LocationServiceInterface.php @@ -0,0 +1,10 @@ + \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, ];