重构接口方法和对接账户管理接口

This commit is contained in:
ah--desktop
2025-10-15 23:02:07 +08:00
parent 64ad74c15c
commit 3354f154b1
47 changed files with 625 additions and 382 deletions
@@ -0,0 +1,49 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { CompanyDTO, CompanyVO } from './types';
/**
* 公司管理API
*/
/**
* 分页获取公司列表
*/
export async function getCompanyPageApi(params: PageQueryDTO<CompanyDTO.CompanyFiltersDTO>) {
return requestClient.post<PageResultVO<CompanyVO.CompanyInfoVO>>('/company/page', params);
}
/**
* 创建公司
*/
export async function createCompanyApi(data: CompanyDTO.CreateCompanyDTO) {
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/create', data);
}
/**
* 更新公司
*/
export async function updateCompanyApi(id: number, data: CompanyDTO.UpdateCompanyDTO) {
return requestClient.put<CompanyVO.CompanyInfoVO>(`/company/update/${id}`, data);
}
/**
* 删除公司
*/
export async function deleteCompanyApi(id: number) {
return requestClient.delete<void>(`/company/delete/${id}`);
}
/**
* 上传公司Logo
*/
export async function uploadCompanyLogoApi(file: File) {
const formData = new FormData();
formData.append('file', file);
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/upload-logo', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
@@ -0,0 +1,6 @@
/**
* 公司管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 公司管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,61 @@
/**
* 公司管理模块DTO类型定义
*/
export namespace CompanyDTO {
/** 创建公司参数 */
export interface CreateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 更新公司参数 */
export interface UpdateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo图片ID */
logoImageId?: number;
/** 状态 (0-禁用 1-正常) */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 公司过滤条件 */
export interface CompanyFiltersDTO {
/** 公司名称(模糊查询) */
name?: string;
/** 联系人(模糊查询) */
contactPerson?: string;
/** 联系电话(精确查询) */
contactPhone?: string;
/** 邮箱(精确查询) */
email?: string;
/** 状态 */
status?: number;
/** 过期状态查询 */
expired?: boolean;
}
}
@@ -0,0 +1,35 @@
/**
* 公司管理模块VO类型定义
*/
export namespace CompanyVO {
/** 公司信息 */
export interface CompanyInfoVO {
/** 公司ID */
id: number;
/** 公司名称 */
name: string;
/** 订阅到期时间 */
expiration?: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** logo */
logo?: string;
/** 状态 (0-禁用 1-正常) */
status: number;
/** 订阅到期时间 */
expireTime?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 是否过期 */
expired?: boolean;
}
}