feat: 支持配置微信用户已通关关卡
This commit is contained in:
@@ -40,11 +40,11 @@ export async function POST(request: NextRequest) {
|
||||
}
|
||||
|
||||
const body = await request.json()
|
||||
const { imageUrl, answer, hint1, hint2, hint3 } = body
|
||||
const { image1Url, image1Description, image2Url, image2Description, answer, punchline, hint1, hint2, hint3 } = body
|
||||
|
||||
if (!imageUrl || !answer) {
|
||||
if (!image1Url || !image2Url || !answer) {
|
||||
return NextResponse.json(
|
||||
{ error: 'imageUrl and answer are required' },
|
||||
{ error: 'image1Url, image2Url and answer are required' },
|
||||
{ status: 400 }
|
||||
)
|
||||
}
|
||||
@@ -59,8 +59,12 @@ export async function POST(request: NextRequest) {
|
||||
const level = await prisma.level.create({
|
||||
data: {
|
||||
id: uuidv4(),
|
||||
imageUrl,
|
||||
image1Url,
|
||||
image1Description: image1Description || null,
|
||||
image2Url,
|
||||
image2Description: image2Description || null,
|
||||
answer,
|
||||
punchline: punchline || null,
|
||||
hint1: hint1 || null,
|
||||
hint2: hint2 || null,
|
||||
hint3: hint3 || null,
|
||||
@@ -90,7 +94,7 @@ export async function PUT(request: NextRequest) {
|
||||
}
|
||||
|
||||
const body = await request.json()
|
||||
const { id, imageUrl, answer, hint1, hint2, hint3 } = body
|
||||
const { id, image1Url, image1Description, image2Url, image2Description, answer, punchline, hint1, hint2, hint3 } = body
|
||||
|
||||
if (!id) {
|
||||
return NextResponse.json({ error: 'id is required' }, { status: 400 })
|
||||
@@ -99,8 +103,12 @@ export async function PUT(request: NextRequest) {
|
||||
const level = await prisma.level.update({
|
||||
where: { id },
|
||||
data: {
|
||||
imageUrl,
|
||||
image1Url,
|
||||
image1Description: image1Description || null,
|
||||
image2Url,
|
||||
image2Description: image2Description || null,
|
||||
answer,
|
||||
punchline: punchline || null,
|
||||
hint1: hint1 || null,
|
||||
hint2: hint2 || null,
|
||||
hint3: hint3 || null,
|
||||
|
||||
Reference in New Issue
Block a user