lrj
昨天 9f8395fab13ca4b230a0f7d62636e209745c91d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// 使用内置的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();