Files
one-pipe-system/src/api/modules/customerAccount.ts
sexygoat 2c6fe4375b
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m1s
fetch(modify):修复API的URL
2026-02-03 10:04:59 +08:00

75 lines
2.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 客户账号管理 API (企业账号)
*
* @deprecated 此 API 已废弃,请使用统一的 AccountService 代替
* @see AccountService - 统一账号管理接口 (/api/admin/accounts)
*
* 迁移说明:
* - 所有账号类型统一使用 /api/admin/accounts 接口
* - 通过 user_type 参数区分账号类型 (2=平台, 3=代理, 4=企业)
* - customer-accounts 已改名为 enterprise企业账号
* - 详见docs/迁移指南.md
*/
import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'
import type {
CustomerAccountItem,
CustomerAccountPageResult,
CustomerAccountQueryParams,
CreateCustomerAccountParams,
UpdateCustomerAccountParams,
UpdateCustomerAccountPasswordParams,
UpdateCustomerAccountStatusParams
} from '@/types/api/customerAccount'
export class CustomerAccountService extends BaseService {
/**
* 查询客户账号列表
*/
static getCustomerAccounts(
params?: CustomerAccountQueryParams
): Promise<BaseResponse<CustomerAccountPageResult>> {
return this.get<BaseResponse<CustomerAccountPageResult>>('/api/admin/customer-accounts', params)
}
/**
* 新增代理商账号
*/
static createCustomerAccount(
data: CreateCustomerAccountParams
): Promise<BaseResponse<CustomerAccountItem>> {
return this.post<BaseResponse<CustomerAccountItem>>('/api/admin/customer-accounts', data)
}
/**
* 编辑账号
*/
static updateCustomerAccount(
id: number,
data: UpdateCustomerAccountParams
): Promise<BaseResponse<CustomerAccountItem>> {
return this.put<BaseResponse<CustomerAccountItem>>(`/api/admin/customer-accounts/${id}`, data)
}
/**
* 修改账号密码
*/
static updateCustomerAccountPassword(
id: number,
data: UpdateCustomerAccountPasswordParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/password`, data)
}
/**
* 修改账号状态
*/
static updateCustomerAccountStatus(
id: number,
data: UpdateCustomerAccountStatusParams
): Promise<BaseResponse> {
return this.put<BaseResponse>(`/api/admin/customer-accounts/${id}/status`, data)
}
}