接口调用说明-修改开单信息.md
4.63 KB
修改开单信息接口调用说明
接口信息
- 接口地址:
PUT /api/Extend/lqkdkdjlb/UpdateBillingInfo - 请求方式:
PUT - Content-Type:
application/json - 需要认证: 是(需要在Header中携带Authorization token)
请求参数
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| id | string | 是 | 开单记录ID |
| scwj | List | 否 | 上传文件列表(不传则不更新) |
| F_FIleUrl | string | 否 | 方案其他文件URL(不传则不更新) |
| Bz | string | 否 | 备注(不传则不更新) |
| Jj | string | 否 | 简介(不传则不更新) |
注意: 至少需要提供一个要更新的字段(scwj、F_FIleUrl、Bz或Jj)
响应格式
成功响应 (200)
{
"code": 200,
"msg": "更新成功",
"data": {
"id": "开单记录ID",
"updatedFields": ["Bz", "Jj"]
}
}
错误响应
{
"code": 400,
"msg": "错误信息",
"data": null
}
调用示例
JavaScript/Axios 示例
import axios from 'axios';
// 更新备注和简介
const updateBillingInfo = async (billingId, remark, description) => {
try {
const token = localStorage.getItem('token'); // 从本地存储获取token
const response = await axios.put(
'/api/Extend/lqkdkdjlb/UpdateBillingInfo',
{
id: billingId,
Bz: remark, // 备注
Jj: description // 简介
},
{
headers: {
'Authorization': token,
'Content-Type': 'application/json'
}
}
);
if (response.data.code === 200) {
console.log('更新成功', response.data.data);
return response.data;
} else {
console.error('更新失败', response.data.msg);
throw new Error(response.data.msg);
}
} catch (error) {
console.error('请求失败', error);
throw error;
}
};
// 使用示例
updateBillingInfo('759263766553560325', '这是备注信息', '这是简介信息');
只更新备注
const updateRemark = async (billingId, remark) => {
const response = await axios.put(
'/api/Extend/lqkdkdjlb/UpdateBillingInfo',
{
id: billingId,
Bz: remark
},
{
headers: {
'Authorization': localStorage.getItem('token'),
'Content-Type': 'application/json'
}
}
);
return response.data;
};
只更新简介
const updateDescription = async (billingId, description) => {
const response = await axios.put(
'/api/Extend/lqkdkdjlb/UpdateBillingInfo',
{
id: billingId,
Jj: description
},
{
headers: {
'Authorization': localStorage.getItem('token'),
'Content-Type': 'application/json'
}
}
);
return response.data;
};
同时更新文件、备注和简介
const updateAll = async (billingId, files, remark, description, fileUrl) => {
const response = await axios.put(
'/api/Extend/lqkdkdjlb/UpdateBillingInfo',
{
id: billingId,
scwj: files, // 文件列表
F_FIleUrl: fileUrl, // 方案其他文件URL
Bz: remark, // 备注
Jj: description // 简介
},
{
headers: {
'Authorization': localStorage.getItem('token'),
'Content-Type': 'application/json'
}
}
);
return response.data;
};
cURL 示例
# 更新备注和简介
curl -X PUT "http://localhost:2011/api/Extend/lqkdkdjlb/UpdateBillingInfo" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "759263766553560325",
"Bz": "这是备注信息",
"Jj": "这是简介信息"
}'
# 只更新备注
curl -X PUT "http://localhost:2011/api/Extend/lqkdkdjlb/UpdateBillingInfo" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "759263766553560325",
"Bz": "这是备注信息"
}'
# 只更新简介
curl -X PUT "http://localhost:2011/api/Extend/lqkdkdjlb/UpdateBillingInfo" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "759263766553560325",
"Jj": "这是简介信息"
}'
注意事项
- 服务重启: 修改代码后需要重启后端服务才能生效
- Token获取: 需要先调用登录接口获取token
- 字段可选: 所有字段都是可选的,只需要传入要更新的字段即可
- 至少一个字段: 必须至少提供一个要更新的字段,否则会返回错误
错误码说明
200: 更新成功400: 参数错误或开单记录不存在500: 服务器错误