From cadc1485835c163cbb8fc96aea72c9b49514f691 Mon Sep 17 00:00:00 2001 From: Kegongteng Date: Fri, 4 Apr 2025 13:26:18 +0800 Subject: [PATCH] Update route.ts --- app/random-410/route.ts | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/app/random-410/route.ts b/app/random-410/route.ts index 323ea29..ed697c5 100644 --- a/app/random-410/route.ts +++ b/app/random-410/route.ts @@ -1,21 +1,10 @@ import { type NextRequest, NextResponse } from "next/server" export async function GET(request: NextRequest) { - // 随机选择图片源 - const isSourceOne = Math.random() < 0.5 // 50% 概率选择第一个图片源 - - let randomId: number - let randomImageUrl: string - - if (isSourceOne) { - // 第一个图片源,随机数范围为 0-60(含60) - randomId = Math.floor(Math.random() * 61) - randomImageUrl = `https://zh.yuazhi.cn/at410/random/${randomId}.jpg` - } else { - // 第二个图片源,随机数范围为 0-40(含40) - randomId = Math.floor(Math.random() * 41) - randomImageUrl = `https://zh.yuazhi.cn/at410/random/2-${randomId}.jpg` - } + // 生成1到50之间的随机ID + const randomId = Math.floor(Math.random() * 100) + 1 + // 构建随机图片URL + const randomImageUrl = `https://zh.yuazhi.cn/at410/random/${randomId}.jpg` // 重定向到随机图片 return NextResponse.redirect(randomImageUrl)