update: rename order/detail api

This commit is contained in:
tokumeikoi 2022-02-07 15:47:06 +08:00
parent 4305e3a246
commit adc9e9e241
3 changed files with 6 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class OrderController extends Controller
]); ]);
} }
public function details(Request $request) public function detail(Request $request)
{ {
$order = Order::where('user_id', $request->session()->get('id')) $order = Order::where('user_id', $request->session()->get('id'))
->where('trade_no', $request->input('trade_no')) ->where('trade_no', $request->input('trade_no'))
@ -60,6 +60,9 @@ class OrderController extends Controller
if (!$order['plan']) { if (!$order['plan']) {
abort(500, __('Subscription plan does not exist')); abort(500, __('Subscription plan does not exist'));
} }
if ($order->surplus_order_ids) {
$order['surplus_orders'] = Order::whereIn(id, $order->surplus_order_ids)->get();
}
return response([ return response([
'data' => $order 'data' => $order
]); ]);

View File

@ -25,7 +25,7 @@ class UserRoute
$router->post('/order/save', 'User\\OrderController@save'); $router->post('/order/save', 'User\\OrderController@save');
$router->post('/order/checkout', 'User\\OrderController@checkout'); $router->post('/order/checkout', 'User\\OrderController@checkout');
$router->get ('/order/check', 'User\\OrderController@check'); $router->get ('/order/check', 'User\\OrderController@check');
$router->get ('/order/details', 'User\\OrderController@details'); $router->get ('/order/detail', 'User\\OrderController@detail');
$router->get ('/order/fetch', 'User\\OrderController@fetch'); $router->get ('/order/fetch', 'User\\OrderController@fetch');
$router->get ('/order/getPaymentMethod', 'User\\OrderController@getPaymentMethod'); $router->get ('/order/getPaymentMethod', 'User\\OrderController@getPaymentMethod');
$router->post('/order/cancel', 'User\\OrderController@cancel'); $router->post('/order/cancel', 'User\\OrderController@cancel');

File diff suppressed because one or more lines are too long