import request from '@/utils/request' export interface ThirdPartyDbConfig { id?: number name: string dbType: string host: string port: number database: string username: string password: string enabled: number connectionTimeout?: number remark?: string createTime?: string updateTime?: string } export interface InventoryResult { barcode: string found: boolean quantity: number availableQty?: number skuId?: string itemId?: string name?: string lockQty?: number canPublish?: boolean message?: string } /** * 获取所有第三方数据库配置 */ export const getAllConfigs = () => { return request.get('/third-party-db/configs') } /** * 获取配置详情 */ export const getConfigById = (id: number) => { return request.get(`/third-party-db/configs/${id}`) } /** * 获取启用的配置 */ export const getEnabledConfig = () => { return request.get('/third-party-db/configs/enabled') } /** * 创建配置 */ export const createConfig = (config: ThirdPartyDbConfig) => { return request.post('/third-party-db/configs', config) } /** * 更新配置 */ export const updateConfig = (id: number, config: ThirdPartyDbConfig) => { return request.put(`/third-party-db/configs/${id}`, config) } /** * 删除配置 */ export const deleteConfig = (id: number) => { return request.delete(`/third-party-db/configs/${id}`) } /** * 测试数据库连接 */ export const testConnection = (config: ThirdPartyDbConfig) => { return request.post('/third-party-db/configs/test', config) } /** * 查询商品库存 */ export const checkInventory = (barcode: string) => { return request.get(`/third-party-db/inventory/${barcode}`) } /** * 检查库存是否满足发布任务条件 */ export const checkInventoryForTask = (barcode: string) => { return request.get(`/third-party-db/inventory/check-for-task/${barcode}`) }