diff --git a/app/JsonRpc/OrdersService.php b/app/JsonRpc/OrdersService.php index e12d9d5..68cc52e 100644 --- a/app/JsonRpc/OrdersService.php +++ b/app/JsonRpc/OrdersService.php @@ -129,7 +129,7 @@ class OrdersService implements OrdersServiceInterface * @param $note * @return array */ - public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id=null, $order_goods_id=null) + public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id='', $order_goods_id='') { Db::beginTransaction(); @@ -168,7 +168,7 @@ class OrdersService implements OrdersServiceInterface // 子订单 $orderChild = null; if ($order_child_id) { - $orderChild = Order::query()->with('store:user_id')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first(); + $orderChild = Order::query()->with('store')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first(); } // 订单商品 @@ -222,13 +222,14 @@ class OrdersService implements OrdersServiceInterface ]); throw new ErrorCodeException(ErrorCode::ORDER_REFUND_FAIL); } + // 开始退款 $config = config('wxpay'); $app = Factory::payment($config); $app['guzzle_handler'] = CoroutineHandler::class; $result = $app->refund->byOutTradeNumber( $orderMain->global_order_id, - $orderMain->global_order_id, + $orderMain->global_order_id.$order_child_id.$order_goods_id, bcmul($orderMain->money, 100, 0), bcmul($refundAmount, 100, 0), [ diff --git a/app/Middleware/Auth/ApiMiddleware.php b/app/Middleware/Auth/ApiMiddleware.php index 271d20c..f419fa6 100644 --- a/app/Middleware/Auth/ApiMiddleware.php +++ b/app/Middleware/Auth/ApiMiddleware.php @@ -9,6 +9,7 @@ use App\TaskWorker\SSDBTask; use Hashids\Hashids; use Hyperf\HttpServer\Contract\RequestInterface as HttpRequest; use Hyperf\HttpServer\Contract\ResponseInterface as HttpResponse; +use Hyperf\HttpServer\Router\Router; use Hyperf\Utils\ApplicationContext; use Psr\Container\ContainerInterface; use Psr\Http\Message\ResponseInterface; @@ -42,6 +43,21 @@ class ApiMiddleware implements MiddlewareInterface public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { + + // 拦截v1路由 + // $routePath = $this->request->getPathInfo(); + // $routePath = explode('/', $routePath); + // if ($routePath[1] == 'v1') { + // $content = [ + // "status" => 'ok', + // "code" => 99999, + // "result" => [], + // "message" => '服务已停止升级,稍后请升级更新小程序(如不能自动更新,请删除小程序后重新进入小程序)' + // ]; + // + // return $this->response->json($content); + // } + // 签名校验 # 获取参数 diff --git a/app/Service/v3/Implementations/DistributionPriceService.php b/app/Service/v3/Implementations/DistributionPriceService.php index 83edd1a..d175935 100644 --- a/app/Service/v3/Implementations/DistributionPriceService.php +++ b/app/Service/v3/Implementations/DistributionPriceService.php @@ -11,6 +11,7 @@ class DistributionPriceService implements DistributionPriceServiceInterface { public function do($distance) { + return 0; $deliveryDistance = config('distance.delivery_distance'); $deliveryDistance = ceil($deliveryDistance/1000); $km = ceil($distance/1000); diff --git a/app/Service/v3/Implementations/PaymentService.php b/app/Service/v3/Implementations/PaymentService.php index b94e236..68b33a7 100644 --- a/app/Service/v3/Implementations/PaymentService.php +++ b/app/Service/v3/Implementations/PaymentService.php @@ -60,7 +60,7 @@ class PaymentService implements PaymentServiceInterface $payMoney = bcmul((string)$orderMain->money, 100, 0); if (env('APP_ENV') != 'prod' && $orderMain->type == OrderType::ONLINE) { - $payMoney = 1; + // $payMoney = 1; } $user = User::select('openid')->find($userId);