123456789101112131415161718192021222324252627282930313233343536 |
- // 测试注册接口
- console.log("测试函数:邀请人不存在的情况")
- testRegister({
- mobile: '1234567890',
- code: '123456',
- inviteId: '123'
- });
- console.log("测试函数:邀请人存在的情况")
- testRegister({
- mobile: '1234567890',
- code: '123456',
- inviteId: '1'
- });
- async function testRegister(jsonBody) {
- const requestBody = jsonBody;
- try {
- const response = await fetch('http://localhost:3000/register', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(requestBody),
- });
- const data = await response.json();
- console.log(data);
- } catch (error) {
- console.error('测试注册接口失败:', error);
- }
- }
|