|
@@ -3,29 +3,13 @@ import axios from 'axios';
|
|
|
const API_BASE_URL = 'http://your-device-api-url.com'; // 替换为实际的设备 API URL
|
|
const API_BASE_URL = 'http://your-device-api-url.com'; // 替换为实际的设备 API URL
|
|
|
|
|
|
|
|
export const deviceApi = {
|
|
export const deviceApi = {
|
|
|
- getDeviceInfo: async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- const response = await axios.get(`${API_BASE_URL}/GetDeviceInfo`);
|
|
|
|
|
- return response.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('获取设备信息失败:', error);
|
|
|
|
|
- throw error;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
-
|
|
|
|
|
- getAllPersons: async () => {
|
|
|
|
|
- try {
|
|
|
|
|
- const response = await axios.get(`${API_BASE_URL}/GetAllPersons`);
|
|
|
|
|
- return response.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('获取所有会友信息失败:', error);
|
|
|
|
|
- throw error;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // 其他方法保持不变...
|
|
|
|
|
|
|
|
addPerson: async (personInfo) => {
|
|
addPerson: async (personInfo) => {
|
|
|
try {
|
|
try {
|
|
|
|
|
+ console.log('Sending request to add person:', personInfo); // 调试日志
|
|
|
const response = await axios.post(`${API_BASE_URL}/AddPerson`, personInfo);
|
|
const response = await axios.post(`${API_BASE_URL}/AddPerson`, personInfo);
|
|
|
|
|
+ console.log('Response from add person:', response.data); // 调试日志
|
|
|
return response.data;
|
|
return response.data;
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('添加会友失败:', error);
|
|
console.error('添加会友失败:', error);
|
|
@@ -33,15 +17,5 @@ export const deviceApi = {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- getAttendanceRecords: async (startTime, endTime) => {
|
|
|
|
|
- try {
|
|
|
|
|
- const response = await axios.get(`${API_BASE_URL}/GetAttendanceRecords`, {
|
|
|
|
|
- params: { startTime, endTime }
|
|
|
|
|
- });
|
|
|
|
|
- return response.data;
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- console.error('获取考勤记录失败:', error);
|
|
|
|
|
- throw error;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 其他方法保持不变...
|
|
|
};
|
|
};
|