feat: enhance plan validation, traffic system and email verification

- feat: add plan price validation
- feat: make traffic packages stackable
- feat: add commission and invite info to admin order details
- feat: apply email whitelist to verification code API
- fix: subscription link copy compatibility for non-HTTPS
- fix: resolve route editing 500 error in certain cases
- refactor: restructure traffic reset logic
This commit is contained in:
xboard
2025-06-22 01:18:38 +08:00
parent 7bab761db6
commit 4fe2f35183
34 changed files with 2176 additions and 539 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ use App\Models\Order;
use App\Models\Plan;
use App\Models\User;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class OrderService
{
@@ -67,7 +68,7 @@ class OrderService
}
$this->setSpeedLimit($plan->speed_limit);
$this->setDeviceLimit($plan->device_limit);
$this->setDeviceLimit($plan->device_limit);
if (!$this->user->save()) {
throw new \Exception('用户信息保存失败');
@@ -79,7 +80,7 @@ class OrderService
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
\Log::error($e);
Log::error($e);
throw new ApiException('开通失败');
}
}
@@ -238,7 +239,7 @@ class OrderService
try {
OrderHandleJob::dispatchSync($order->trade_no);
} catch (\Exception $e) {
\Log::error($e);
Log::error($e);
return false;
}
return true;
@@ -305,7 +306,7 @@ class OrderService
private function buyByOneTime(Plan $plan)
{
$this->buyByResetTraffic();
$this->user->transfer_enable = $plan->transfer_enable * 1073741824;
$this->user->transfer_enable += $plan->transfer_enable * 1073741824;
$this->user->plan_id = $plan->id;
$this->user->group_id = $plan->group_id;
$this->user->expired_at = NULL;