mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-13 07:59:20 +00:00
Code variables type declaration
This commit is contained in:
@@ -4,23 +4,23 @@ namespace App\Http\Controllers\User;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Response;
|
||||
|
||||
class InvoiceController extends Controller
|
||||
{
|
||||
public function index(Request $request): \Illuminate\Http\Response
|
||||
public function index(Request $request): View
|
||||
{ // 订单列表
|
||||
return Response::view('user.invoices', [
|
||||
return view('user.invoices', [
|
||||
'orderList' => auth()->user()->orders()->with(['goods', 'payment'])->orderByDesc('id')->paginate(10)->appends($request->except('page')),
|
||||
'prepaidPlan' => Order::userPrepay()->exists(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function show(string $sn): \Illuminate\Http\Response
|
||||
public function show(string $sn): View
|
||||
{ // 订单明细
|
||||
return Response::view('user.invoiceDetail', ['order' => Order::uid()->whereSn($sn)->with(['goods', 'coupon'])->firstOrFail()]);
|
||||
return view('user.invoiceDetail', ['order' => Order::uid()->whereSn($sn)->with(['goods', 'coupon'])->firstOrFail()]);
|
||||
}
|
||||
|
||||
public function activate(): JsonResponse
|
||||
@@ -29,22 +29,22 @@ class InvoiceController extends Controller
|
||||
if ($activePlan) {
|
||||
if ($activePlan->expired()) { // 关闭先前套餐后,新套餐自动运行
|
||||
if (Order::userActivePlan()->exists()) {
|
||||
return Response::json(['status' => 'success', 'message' => trans('common.active_item', ['attribute' => trans('common.success')])]);
|
||||
return response()->json(['status' => 'success', 'message' => trans('common.active_item', ['attribute' => trans('common.success')])]);
|
||||
}
|
||||
|
||||
return Response::json(['status' => 'success', 'message' => trans('common.close')]);
|
||||
return response()->json(['status' => 'success', 'message' => trans('common.close')]);
|
||||
}
|
||||
} else {
|
||||
$prepaidPlan = Order::userPrepay()->first();
|
||||
if ($prepaidPlan) { // 关闭先前套餐后,新套餐自动运行
|
||||
if ($prepaidPlan->complete()) {
|
||||
return Response::json(['status' => 'success', 'message' => trans('common.active_item', ['attribute' => trans('common.success')])]);
|
||||
return response()->json(['status' => 'success', 'message' => trans('common.active_item', ['attribute' => trans('common.success')])]);
|
||||
}
|
||||
|
||||
return Response::json(['status' => 'success', 'message' => trans('common.close')]);
|
||||
return response()->json(['status' => 'success', 'message' => trans('common.close')]);
|
||||
}
|
||||
}
|
||||
|
||||
return Response::json(['status' => 'fail', 'message' => trans('common.failed_item', ['attribute' => trans('common.close')])]);
|
||||
return response()->json(['status' => 'fail', 'message' => trans('common.failed_item', ['attribute' => trans('common.close')])]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user