87 lines
2.4 KiB
TypeScript
87 lines
2.4 KiB
TypeScript
/**
|
||
* 代理账号相关 API - 匹配后端实际接口
|
||
*
|
||
* @deprecated 此 API 已废弃,请使用统一的 AccountService 代替
|
||
* @see AccountService - 统一账号管理接口 (/api/admin/accounts)
|
||
*
|
||
* 迁移说明:
|
||
* - 所有账号类型统一使用 /api/admin/accounts 接口
|
||
* - 通过 user_type 参数区分账号类型 (2=平台, 3=代理, 4=企业)
|
||
* - 详见:docs/迁移指南.md
|
||
*/
|
||
|
||
import { BaseService } from '../BaseService'
|
||
import type {
|
||
ShopAccountResponse,
|
||
ShopAccountQueryParams,
|
||
CreateShopAccountParams,
|
||
UpdateShopAccountParams,
|
||
UpdateShopAccountPasswordParams,
|
||
UpdateShopAccountStatusParams,
|
||
BaseResponse,
|
||
PaginationResponse
|
||
} from '@/types/api'
|
||
|
||
export class ShopAccountService extends BaseService {
|
||
/**
|
||
* 获取代理账号列表
|
||
* GET /api/admin/shop-accounts
|
||
* @param params 查询参数
|
||
*/
|
||
static getShopAccounts(
|
||
params?: ShopAccountQueryParams
|
||
): Promise<PaginationResponse<ShopAccountResponse>> {
|
||
return this.getPage<ShopAccountResponse>('/api/admin/shop-accounts', params)
|
||
}
|
||
|
||
/**
|
||
* 创建代理账号
|
||
* POST /api/admin/shop-accounts
|
||
* @param data 代理账号数据
|
||
*/
|
||
static createShopAccount(
|
||
data: CreateShopAccountParams
|
||
): Promise<BaseResponse<ShopAccountResponse>> {
|
||
return this.post<BaseResponse<ShopAccountResponse>>('/api/admin/shop-accounts', data)
|
||
}
|
||
|
||
/**
|
||
* 更新代理账号
|
||
* PUT /api/admin/shop-accounts/{id}
|
||
* @param id 账号ID
|
||
* @param data 更新数据
|
||
*/
|
||
static updateShopAccount(
|
||
id: number,
|
||
data: UpdateShopAccountParams
|
||
): Promise<BaseResponse<ShopAccountResponse>> {
|
||
return this.put<BaseResponse<ShopAccountResponse>>(`/api/admin/shop-accounts/${id}`, data)
|
||
}
|
||
|
||
/**
|
||
* 重置代理账号密码
|
||
* PUT /api/admin/shop-accounts/{id}/password
|
||
* @param id 账号ID
|
||
* @param data 密码数据
|
||
*/
|
||
static updateShopAccountPassword(
|
||
id: number,
|
||
data: UpdateShopAccountPasswordParams
|
||
): Promise<BaseResponse> {
|
||
return this.put<BaseResponse>(`/api/admin/shop-accounts/${id}/password`, data)
|
||
}
|
||
|
||
/**
|
||
* 启用/禁用代理账号
|
||
* PUT /api/admin/shop-accounts/{id}/status
|
||
* @param id 账号ID
|
||
* @param data 状态数据
|
||
*/
|
||
static updateShopAccountStatus(
|
||
id: number,
|
||
data: UpdateShopAccountStatusParams
|
||
): Promise<BaseResponse> {
|
||
return this.put<BaseResponse>(`/api/admin/shop-accounts/${id}/status`, data)
|
||
}
|
||
}
|