// 使用内置的fetch API (Node.js 18+)
|
|
const GRAPHQL_URL = 'http://localhost:8080/api/graphql';
|
|
// 查询最新的报名记录
|
async function verifyRegistration() {
|
console.log('验证最新的报名记录...');
|
|
const query = `
|
query {
|
activities {
|
id
|
name
|
description
|
}
|
}
|
`;
|
|
try {
|
const response = await fetch(GRAPHQL_URL, {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
body: JSON.stringify({ query })
|
});
|
|
const result = await response.json();
|
console.log('活动列表查询成功');
|
|
// 查询活动注册申请记录
|
const registrationQuery = `
|
query {
|
activityPlayerApplications(activityId: 55, page: 0, size: 10) {
|
id
|
playerName
|
activityName
|
phone
|
applyTime
|
state
|
}
|
}
|
`;
|
|
console.log('\n查询活动55的注册申请记录...');
|
const registrationResponse = await fetch(GRAPHQL_URL, {
|
method: 'POST',
|
headers: {
|
'Content-Type': 'application/json',
|
},
|
body: JSON.stringify({
|
query: registrationQuery
|
})
|
});
|
|
const registrationData = await registrationResponse.json();
|
console.log('注册申请记录查询结果:', JSON.stringify(registrationData, null, 2));
|
|
if (registrationData.data && registrationData.data.activityPlayerApplications) {
|
const applications = registrationData.data.activityPlayerApplications;
|
console.log(`\n找到 ${applications.length} 个注册申请记录:`);
|
|
applications.forEach((app, index) => {
|
console.log(`\n申请记录 ${index + 1}:`);
|
console.log(` ID: ${app.id}`);
|
console.log(` 选手姓名: ${app.playerName}`);
|
console.log(` 活动名称: ${app.activityName}`);
|
console.log(` 联系电话: ${app.phone}`);
|
console.log(` 申请时间: ${app.applyTime}`);
|
console.log(` 状态: ${app.state}`);
|
});
|
|
// 显示最新的注册记录
|
if (applications.length > 0) {
|
const latestApp = applications[applications.length - 1];
|
console.log(`\n最新申请记录详情:`);
|
console.log(` 申请ID: ${latestApp.id}`);
|
console.log(` 选手姓名: ${latestApp.playerName}`);
|
console.log(` 联系电话: ${latestApp.phone}`);
|
console.log(` 申请时间: ${latestApp.applyTime}`);
|
console.log(` 状态: ${latestApp.state} (1=待审核, 2=进行中, 3=结束)`);
|
}
|
} else {
|
console.log('未找到注册申请记录或查询失败');
|
}
|
|
} catch (error) {
|
console.error('验证失败:', error);
|
}
|
}
|
|
verifyRegistration();
|