Codex Assistant
昨天 c8dffd157cd8b62023b26e62a0b92c152d959423
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
// 直接查询特定参赛人的详情数据
const axios = require('axios');
 
async function checkPlayerDetail(playerId) {
  const detailQuery = `
    query GetActivityPlayerDetail($id: ID!) {
      activityPlayerDetail(id: $id) {
        id
        projectName
        playerInfo {
          id
          name
          gender
          education
          birthday
        }
        regionInfo {
          name
        }
      }
    }
  `;
 
  try {
    const detailResponse = await axios.post('http://localhost:8080/api/graphql', {
      query: detailQuery,
      variables: { id: playerId }
    }, {
      headers: {
        'Content-Type': 'application/json'
      }
    });
 
    if (detailResponse.data.errors) {
      console.log('  详情查询错误:', detailResponse.data.errors);
      return;
    }
 
    const detail = detailResponse.data.data?.activityPlayerDetail;
    if (!detail) {
      console.log('  未找到详情数据');
      return;
    }
 
    console.log('  详情数据:');
    console.log(`    姓名: ${detail.playerInfo.name}`);
    console.log(`    性别 (原始): ${detail.playerInfo.gender} (${typeof detail.playerInfo.gender})`);
    console.log(`    学历 (原始): "${detail.playerInfo.education}" (${typeof detail.playerInfo.education})`);
    console.log(`    生日: ${detail.playerInfo.birthday}`);
    console.log(`    地区: ${detail.regionInfo?.name}`);
 
    // 测试性别转换逻辑
    let genderText = '未填写';
    if (detail.playerInfo.gender === 0) genderText = '女';
    if (detail.playerInfo.gender === 1) genderText = '男';
    console.log(`    性别转换结果: ${genderText}`);
 
    // 测试学历处理逻辑
    const education = detail.playerInfo.education || '';
    console.log(`    学历长度: ${education.length}`);
    console.log(`    学历处理结果: ${education || '未填写'}`);
    
    // 检查问题
    if (detail.playerInfo.gender === 1 && genderText === '女') {
      console.log(`    ❌ 性别转换错误: 应该是男,但显示为女`);
    }
    if (detail.playerInfo.education && detail.playerInfo.education.trim() && (education || '未填写') === '未填写') {
      console.log(`    ❌ 学历显示错误: 有学历但显示为未填写`);
    }
    
    // 检查当前的getGenderText函数逻辑
    console.log(`    当前getGenderText逻辑测试:`);
    console.log(`      gender === 0 ? '女' : gender === 1 ? '男' : '未填写'`);
    const currentLogic = detail.playerInfo.gender === 0 ? '女' : detail.playerInfo.gender === 1 ? '男' : '未填写';
    console.log(`      结果: ${currentLogic}`);
 
  } catch (error) {
    console.log(`  查询详情失败: ${error.message}`);
  }
}
 
async function checkSpecificPlayerData() {
  try {
    // 先查询参赛人列表
    const listQuery = `
      query {
        activityPlayerApplications(page: 1, size: 20) {
          content {
            id
            playerName
            projectName
            phone
            state
          }
        }
      }
    `;
 
    console.log('=== 查询参赛人列表 ===');
    const listResponse = await axios.post('http://localhost:8080/api/graphql', {
      query: listQuery
    }, {
      headers: {
        'Content-Type': 'application/json'
      }
    });
 
    if (listResponse.data.errors) {
      console.log('列表查询错误:', listResponse.data.errors);
      return;
    }
 
    const applications = listResponse.data.data?.activityPlayerApplications?.content || [];
    
    if (applications.length === 0) {
      console.log('没有找到参赛人数据');
      return;
    }
 
    console.log(`找到 ${applications.length} 个参赛人,开始查询详情...`);
 
    // 查询每个参赛人的详情
     for (let i = 0; i < Math.min(applications.length, 10); i++) {
      const app = applications[i];
      console.log(`\n=== 参赛人 ${i + 1} (ID: ${app.id}) ===`);
      console.log(`  姓名: ${app.playerName}`);
      console.log(`  项目名: ${app.projectName}`);
      console.log(`  状态: ${app.state}`);
 
      // 查询详情
       await checkPlayerDetail(app.id);
     }
 
  } catch (error) {
    console.error('查询失败:', error.message);
  }
}
 
checkSpecificPlayerData();