From 342415d1db3eacc43531d697090adab0eff64e63 Mon Sep 17 00:00:00 2001 From: Beta Soft Date: Mon, 9 Nov 2020 09:26:07 +0800 Subject: [PATCH 1/3] OrderAssign: fixes can not assign two year & three year plan Signed-off-by: Beta Soft --- app/Http/Requests/Admin/OrderAssign.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Requests/Admin/OrderAssign.php b/app/Http/Requests/Admin/OrderAssign.php index a6262fcf..b06c672c 100644 --- a/app/Http/Requests/Admin/OrderAssign.php +++ b/app/Http/Requests/Admin/OrderAssign.php @@ -17,7 +17,7 @@ class OrderAssign extends FormRequest 'plan_id' => 'required', 'email' => 'required', 'total_amount' => 'required', - 'cycle' => 'required|in:month_price,quarter_price,half_year_price,year_price,onetime_price,reset_price' + 'cycle' => 'required|in:month_price,quarter_price,half_year_price,year_price,two_year_price,three_year_price,onetime_price,reset_price' ]; } From 2b5ef08fe077afb0ce301b35066f52c748087016 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 18 Nov 2020 04:56:27 -0500 Subject: [PATCH 2/3] Fix alterid --- app/Http/Controllers/Server/PoseidonController.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Server/PoseidonController.php b/app/Http/Controllers/Server/PoseidonController.php index 81e7c7a1..a64d0d91 100644 --- a/app/Http/Controllers/Server/PoseidonController.php +++ b/app/Http/Controllers/Server/PoseidonController.php @@ -45,12 +45,11 @@ class PoseidonController extends Controller $user->v2ray_user = [ "uuid" => $user->uuid, "email" => sprintf("%s@v2board.user", $user->uuid), - "alter_id" => $user->v2ray_alter_id, - "level" => $user->v2ray_level, + "alter_id" => $server->alter_id, + "level" => 0, ]; unset($user['uuid']); - unset($user['v2ray_alter_id']); - unset($user['v2ray_level']); + unset($user['email']); array_push($result, $user); } From d2bce02d4e644204cc947ec7f81b90e455e72b64 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 18 Nov 2020 05:10:32 -0500 Subject: [PATCH 3/3] Add ETag for caching --- .../Controllers/Server/PoseidonController.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Server/PoseidonController.php b/app/Http/Controllers/Server/PoseidonController.php index a64d0d91..d926cab3 100644 --- a/app/Http/Controllers/Server/PoseidonController.php +++ b/app/Http/Controllers/Server/PoseidonController.php @@ -135,9 +135,23 @@ class PoseidonController extends Controller } protected function success($data) { + $req = request(); + // Only for "GET" method + if (!$req->isMethod('GET') || !$data) { + return response([ + 'msg' => 'ok', + 'data' => $data, + ]); + } + + $etag = sha1(json_encode($data)); + if ($etag == $req->header("IF-NONE-MATCH")) { + return response(null, 304); + } + return response([ 'msg' => 'ok', 'data' => $data, - ]); + ])->header('ETAG', $etag); } }