You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.8 KiB
68 lines
1.8 KiB
|
2 months ago
|
const http = require('http');
|
||
|
|
|
||
|
|
const testData = {
|
||
|
|
openid: "oAWdd15xKm5H66TNlmjYtky_Iug8",
|
||
|
|
collaborationid: "chicken",
|
||
|
|
company: "123",
|
||
|
|
province: "北京市",
|
||
|
|
city: "北京市",
|
||
|
|
district: "东城区",
|
||
|
|
detailedaddress: "123",
|
||
|
|
cooperation: "采销联盟合作",
|
||
|
|
phoneNumber: "18482694520",
|
||
|
|
businesslicenseurl: "",
|
||
|
|
proofurl: "",
|
||
|
|
brandurl: "https://my-supplier-photos.oss-cn-chengdu.aliyuncs.com/settlement/brandAuth/1766729271862_BJrCwyOx1Bugaf5545a3f0d4e140bf21f92323555688.png/image/af5545a3f0d4e140bf21f92323555688.png"
|
||
|
|
};
|
||
|
|
|
||
|
|
const postData = JSON.stringify(testData);
|
||
|
|
|
||
|
|
const options = {
|
||
|
|
hostname: 'localhost',
|
||
|
|
port: 3003,
|
||
|
|
path: '/api/settlement/submit',
|
||
|
|
method: 'POST',
|
||
|
|
headers: {
|
||
|
|
'Content-Type': 'application/json',
|
||
|
|
'Content-Length': Buffer.byteLength(postData)
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
console.log('===== 测试立即入驻API =====');
|
||
|
|
console.log('1. 测试数据:', JSON.stringify(testData, null, 2));
|
||
|
|
console.log('2. 发送请求到: http://localhost:3003/api/settlement/submit\n');
|
||
|
|
|
||
|
|
const req = http.request(options, (res) => {
|
||
|
|
let data = '';
|
||
|
|
|
||
|
|
res.on('data', (chunk) => {
|
||
|
|
data += chunk;
|
||
|
|
});
|
||
|
|
|
||
|
|
res.on('end', () => {
|
||
|
|
console.log('3. 响应状态码:', res.statusCode);
|
||
|
|
console.log('4. 响应结果:');
|
||
|
|
try {
|
||
|
|
const result = JSON.parse(data);
|
||
|
|
console.log(JSON.stringify(result, null, 2));
|
||
|
|
|
||
|
|
if (result.success && result.code === 200) {
|
||
|
|
console.log('\n✅ 入驻申请提交成功!');
|
||
|
|
} else {
|
||
|
|
console.log('\n❌ 入驻申请提交失败:', result.message);
|
||
|
|
}
|
||
|
|
} catch (e) {
|
||
|
|
console.log('响应数据:', data);
|
||
|
|
console.log('\n❌ JSON解析失败');
|
||
|
|
}
|
||
|
|
});
|
||
|
|
});
|
||
|
|
|
||
|
|
req.on('error', (e) => {
|
||
|
|
console.error('❌ 请求失败:', e.message);
|
||
|
|
console.error('\n请确保后端服务器已启动: node server-mysql.js');
|
||
|
|
});
|
||
|
|
|
||
|
|
req.write(postData);
|
||
|
|
req.end();
|