问题分析: 1. 后端Controller路径不一致: - fund-cust: /api/v1/customer (不是/api/v1/cust/customer) - fund-proj: /api/v1/project (不是/api/v1/proj/project) - fund-sys: /api/v1/auth 和 /api/v1/sys/* 两种路径 2. 之前的错误修改导致路径不匹配 解决方案: - 网关: StripPrefix=1 + PrefixPath=/api/v1 - 前端: baseURL=/fund,路径直接对应后端路径 网关路由配置: - fund-sys: /fund/auth/**,/fund/sys/** -> /api/v1/auth/*,/api/v1/sys/* - fund-cust: /fund/customer/** -> /api/v1/customer/* - fund-proj: /fund/project/**,/fund/requirement/** -> /api/v1/project/*,/api/v1/requirement/* - fund-exp: /fund/exp/** -> /api/v1/exp/* - fund-receipt: /fund/receipt/** -> /api/v1/receipt/* - fund-report: /fund/report/** -> /api/v1/report/* - fund-file: /fund/file/** -> /api/v1/file/* 前端API路径规范: - 认证: /auth/login -> /api/v1/auth/login - 用户: /sys/user/page -> /api/v1/sys/user/page - 客户: /customer/page -> /api/v1/customer/page - 项目: /project/page -> /api/v1/project/page - 支出: /exp/expense/page -> /api/v1/exp/expense/page - 收款: /receipt/receivable/page -> /api/v1/receipt/receivable/page - 报表: /report/stats -> /api/v1/report/stats - 文件: /file/upload -> /api/v1/file/upload 修改文件: - fund-gateway/application.yml: 路由配置调整 - TenantGatewayFilter.java: 白名单路径修正 - TokenAuthFilter.java: 白名单路径修正 - fund-admin/src/api/*.ts: 所有API路径修正 - fund-mobile/src/api/index.ts: 所有API路径修正 - FileUpload组件: 上传路径修正
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import { request } from './request'
|
|
|
|
export function getCustomerList(params: { pageNum: number; pageSize: number; customerName?: string; status?: number }) {
|
|
return request.get('/customer/page', { params })
|
|
}
|
|
|
|
export function getCustomerById(id: number) {
|
|
return request.get(`/customer/${id}`)
|
|
}
|
|
|
|
export function createCustomer(data: any) {
|
|
return request.post('/customer', data)
|
|
}
|
|
|
|
export function updateCustomer(id: number, data: any) {
|
|
return request.put(`/customer/${id}`, data)
|
|
}
|
|
|
|
export function deleteCustomer(id: number) {
|
|
return request.delete(`/customer/${id}`)
|
|
}
|
|
|
|
// 联系人相关
|
|
export function getContactList(params: { pageNum: number; pageSize: number; customerId: number }) {
|
|
return request.get('/customer/contact/page', { params })
|
|
}
|
|
|
|
export function createContact(data: any) {
|
|
return request.post('/customer/contact', data)
|
|
}
|
|
|
|
export function updateContact(id: number, data: any) {
|
|
return request.put(`/customer/contact/${id}`, data)
|
|
}
|
|
|
|
export function deleteContact(id: number) {
|
|
return request.delete(`/customer/contact/${id}`)
|
|
}
|
|
|
|
export function setPrimaryContact(customerId: number, contactId: number) {
|
|
return request.put(`/customer/${customerId}/contact/${contactId}/primary`)
|
|
}
|