75 lines
2.1 KiB
TypeScript
75 lines
2.1 KiB
TypeScript
/**
|
||
* 客户账号管理 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)
|
||
}
|
||
}
|