fix: 新增代理系列授权-建议售价使用套餐
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m38s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m38s
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
import request from '@/utils/http'
|
||||
import { PaginationResponse, BaseResponse } from '@/types/api'
|
||||
import { ArticleType, ArticleCategoryType, ArticleQueryParams } from '@/api/modules'
|
||||
|
||||
// 文章
|
||||
export class ArticleService {
|
||||
// 获取文章列表
|
||||
static getArticleList(params: ArticleQueryParams) {
|
||||
const { page, size, searchVal, year } = params
|
||||
return request.get<PaginationResponse<ArticleType>>({
|
||||
url: `/api/articles/${page}/${size}?title=${searchVal}&year=${year}`
|
||||
})
|
||||
}
|
||||
|
||||
// 获取文章类型
|
||||
static getArticleTypes(params: object) {
|
||||
return request.get<BaseResponse<ArticleCategoryType[]>>({
|
||||
url: '/api/articles/types',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
// 获取文章详情
|
||||
static getArticleDetail(id: number) {
|
||||
return request.get<BaseResponse<ArticleType>>({
|
||||
url: `/api/articles/${id}`
|
||||
})
|
||||
}
|
||||
|
||||
// 新增文章
|
||||
static addArticle(params: any) {
|
||||
return request.post<BaseResponse>({
|
||||
url: '/api/articles/',
|
||||
data: params
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑文章
|
||||
static editArticle(id: number, params: any) {
|
||||
return request.put<BaseResponse>({
|
||||
url: `/api/articles/${id}`,
|
||||
data: params
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import { asyncRoutes } from '@/router/routes/asyncRoutes'
|
||||
import { menuDataToRouter } from '@/router/utils/menuToRouter'
|
||||
import { AppRouteRecord } from '@/types/router'
|
||||
|
||||
interface MenuResponse {
|
||||
menuList: AppRouteRecord[]
|
||||
}
|
||||
|
||||
// 菜单接口
|
||||
export const menuService = {
|
||||
async getMenuList(delay = 300): Promise<MenuResponse> {
|
||||
try {
|
||||
// 模拟接口返回的菜单数据
|
||||
const menuData = asyncRoutes
|
||||
// 处理菜单数据
|
||||
const menuList = menuData.map((route) => menuDataToRouter(route))
|
||||
// 模拟接口延迟
|
||||
await new Promise((resolve) => setTimeout(resolve, delay))
|
||||
|
||||
return { menuList }
|
||||
} catch (error) {
|
||||
throw error instanceof Error ? error : new Error('获取菜单失败')
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/**
|
||||
* 文章相关类型定义
|
||||
*/
|
||||
|
||||
// 文章类型 (新命名规范)
|
||||
export interface Article {
|
||||
id?: number
|
||||
blogClass: string
|
||||
title: string
|
||||
count?: number
|
||||
htmlContent: string
|
||||
createTime: string
|
||||
homeImg: string
|
||||
brief: string
|
||||
typeName?: string
|
||||
status?: number
|
||||
author?: string
|
||||
tags?: string[]
|
||||
}
|
||||
|
||||
// 兼容原有的文章类型命名
|
||||
export interface ArticleType {
|
||||
id?: number
|
||||
blog_class: string
|
||||
title: string
|
||||
count?: number
|
||||
html_content: string
|
||||
create_time: string
|
||||
home_img: string
|
||||
brief: string
|
||||
type_name?: string
|
||||
}
|
||||
|
||||
// 文章分类类型 (新命名规范)
|
||||
export interface ArticleCategory {
|
||||
id: number
|
||||
name: string
|
||||
icon: string
|
||||
count: number
|
||||
description?: string
|
||||
sortOrder?: number
|
||||
}
|
||||
|
||||
// 兼容原有的文章分类类型命名
|
||||
export interface ArticleCategoryType {
|
||||
id: number
|
||||
name: string
|
||||
icon: string
|
||||
count: number
|
||||
}
|
||||
|
||||
// 文章查询参数
|
||||
export interface ArticleQueryParams {
|
||||
page?: number
|
||||
size?: number
|
||||
searchVal?: string
|
||||
year?: string
|
||||
categoryId?: number
|
||||
status?: number
|
||||
}
|
||||
|
||||
// 文章创建/更新参数
|
||||
export interface ArticleFormData {
|
||||
blogClass: string
|
||||
title: string
|
||||
htmlContent: string
|
||||
homeImg: string
|
||||
brief: string
|
||||
author?: string
|
||||
tags?: string[]
|
||||
status?: number
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import type {
|
||||
SuspendResumeRecord,
|
||||
CardOrder,
|
||||
BaseResponse,
|
||||
PaginationParams,
|
||||
PaginationResponse,
|
||||
ListResponse,
|
||||
GatewayRealnameLinkResponse,
|
||||
@@ -24,12 +25,36 @@ import type {
|
||||
ImportIotCardResponse,
|
||||
IotCardImportTask,
|
||||
IotCardImportTaskDetail,
|
||||
IotCardImportTaskQueryParams,
|
||||
StandaloneCardQueryParams,
|
||||
StandaloneIotCard,
|
||||
AllocateStandaloneCardsRequest,
|
||||
AllocateStandaloneCardsResponse,
|
||||
RecallStandaloneCardsRequest,
|
||||
AssetAllocationRecordQueryParams,
|
||||
AssetAllocationRecord,
|
||||
AssetAllocationRecordDetail,
|
||||
BatchSetCardSeriesBindingRequest,
|
||||
BatchSetCardSeriesBindingResponse
|
||||
} from '@/types/api'
|
||||
|
||||
type ApiQueryParams = PaginationParams & Record<string, unknown>
|
||||
|
||||
interface ImportFailureRecord {
|
||||
line?: number
|
||||
row?: number
|
||||
iccid?: string
|
||||
reason: string
|
||||
}
|
||||
|
||||
interface CardChangeNotice {
|
||||
id: string | number
|
||||
iccids: string[]
|
||||
reason: string
|
||||
createTime?: string
|
||||
operatorName?: string
|
||||
}
|
||||
|
||||
export class CardService extends BaseService {
|
||||
// ========== 号卡商品管理 ==========
|
||||
|
||||
@@ -37,7 +62,7 @@ export class CardService extends BaseService {
|
||||
* 获取号卡商品列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getSimCardProducts(params?: any): Promise<PaginationResponse<SimCardProduct>> {
|
||||
static getSimCardProducts(params?: ApiQueryParams): Promise<PaginationResponse<SimCardProduct>> {
|
||||
return this.getPage<SimCardProduct>('/api/simcard-products', params)
|
||||
}
|
||||
|
||||
@@ -95,15 +120,6 @@ export class CardService extends BaseService {
|
||||
return this.getOne<Card>(`/api/cards/iccid/${iccid}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ICCID查询单卡详情(旧接口,已废弃)
|
||||
* @deprecated 使用 AssetService.resolveAsset 替代
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static getIotCardDetailByIccid(iccid: string): Promise<BaseResponse<any>> {
|
||||
return this.getOne<any>(`/api/admin/iot-cards/by-iccid/${iccid}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 网卡操作(充值、停复机、增减流量等)
|
||||
* @param params 操作参数
|
||||
@@ -214,7 +230,7 @@ export class CardService extends BaseService {
|
||||
* 获取导入批次列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getImportBatches(params?: any): Promise<PaginationResponse<CardImportBatch>> {
|
||||
static getImportBatches(params?: ApiQueryParams): Promise<PaginationResponse<CardImportBatch>> {
|
||||
return this.getPage<CardImportBatch>('/api/cards/import-batches', params)
|
||||
}
|
||||
|
||||
@@ -223,7 +239,7 @@ export class CardService extends BaseService {
|
||||
* @param file Excel文件
|
||||
* @param params 额外参数
|
||||
*/
|
||||
static importCards(file: File, params?: Record<string, any>): Promise<BaseResponse> {
|
||||
static importCards(file: File, params?: Record<string, unknown>): Promise<BaseResponse> {
|
||||
return this.upload('/api/cards/import', file, params)
|
||||
}
|
||||
|
||||
@@ -231,15 +247,17 @@ export class CardService extends BaseService {
|
||||
* 获取导入失败记录
|
||||
* @param batchId 批次ID
|
||||
*/
|
||||
static getImportFailures(batchId: string | number): Promise<ListResponse<any>> {
|
||||
return this.getList(`/api/cards/import-batches/${batchId}/failures`)
|
||||
static getImportFailures(batchId: string | number): Promise<ListResponse<ImportFailureRecord>> {
|
||||
return this.getList<ImportFailureRecord>(`/api/cards/import-batches/${batchId}/failures`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量充值记录列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getBatchRechargeRecords(params?: any): Promise<PaginationResponse<BatchRechargeRecord>> {
|
||||
static getBatchRechargeRecords(
|
||||
params?: ApiQueryParams
|
||||
): Promise<PaginationResponse<BatchRechargeRecord>> {
|
||||
return this.getPage<BatchRechargeRecord>('/api/cards/batch-recharge-records', params)
|
||||
}
|
||||
|
||||
@@ -258,7 +276,7 @@ export class CardService extends BaseService {
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getCardChangeApplications(
|
||||
params?: any
|
||||
params?: ApiQueryParams
|
||||
): Promise<PaginationResponse<CardChangeApplication>> {
|
||||
return this.getPage<CardChangeApplication>('/api/card-change-applications', params)
|
||||
}
|
||||
@@ -284,8 +302,10 @@ export class CardService extends BaseService {
|
||||
* 获取换卡通知记录
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getCardChangeNotices(params?: any): Promise<PaginationResponse<any>> {
|
||||
return this.getPage('/api/card-change-notices', params)
|
||||
static getCardChangeNotices(
|
||||
params?: ApiQueryParams
|
||||
): Promise<PaginationResponse<CardChangeNotice>> {
|
||||
return this.getPage<CardChangeNotice>('/api/card-change-notices', params)
|
||||
}
|
||||
|
||||
// ========== ICCID批量导入相关 ==========
|
||||
@@ -302,8 +322,10 @@ export class CardService extends BaseService {
|
||||
* 获取导入任务列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getIotCardImportTasks(params?: any): Promise<PaginationResponse<IotCardImportTask>> {
|
||||
return this.getPage('/api/admin/iot-cards/import-tasks', params)
|
||||
static getIotCardImportTasks(
|
||||
params?: IotCardImportTaskQueryParams
|
||||
): Promise<PaginationResponse<IotCardImportTask>> {
|
||||
return this.getPage<IotCardImportTask>('/api/admin/iot-cards/import-tasks', params)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,16 +352,26 @@ export class CardService extends BaseService {
|
||||
* 批量分配单卡
|
||||
* @param data 分配参数
|
||||
*/
|
||||
static allocateStandaloneCards(data: any): Promise<BaseResponse<any>> {
|
||||
return this.post('/api/admin/iot-cards/standalone/allocate', data)
|
||||
static allocateStandaloneCards(
|
||||
data: Partial<AllocateStandaloneCardsRequest>
|
||||
): Promise<BaseResponse<AllocateStandaloneCardsResponse>> {
|
||||
return this.post<BaseResponse<AllocateStandaloneCardsResponse>>(
|
||||
'/api/admin/iot-cards/standalone/allocate',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量回收单卡
|
||||
* @param data 回收参数
|
||||
*/
|
||||
static recallStandaloneCards(data: any): Promise<BaseResponse<any>> {
|
||||
return this.post('/api/admin/iot-cards/standalone/recall', data)
|
||||
static recallStandaloneCards(
|
||||
data: Partial<RecallStandaloneCardsRequest>
|
||||
): Promise<BaseResponse<AllocateStandaloneCardsResponse>> {
|
||||
return this.post<BaseResponse<AllocateStandaloneCardsResponse>>(
|
||||
'/api/admin/iot-cards/standalone/recall',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
// ========== 资产分配记录相关 ==========
|
||||
@@ -348,16 +380,20 @@ export class CardService extends BaseService {
|
||||
* 获取资产分配记录列表
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getAssetAllocationRecords(params?: any): Promise<PaginationResponse<any>> {
|
||||
return this.getPage('/api/admin/asset-allocation-records', params)
|
||||
static getAssetAllocationRecords(
|
||||
params?: AssetAllocationRecordQueryParams
|
||||
): Promise<PaginationResponse<AssetAllocationRecord>> {
|
||||
return this.getPage<AssetAllocationRecord>('/api/admin/asset-allocation-records', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资产分配记录详情
|
||||
* @param id 记录ID
|
||||
*/
|
||||
static getAssetAllocationRecordDetail(id: number): Promise<BaseResponse<any>> {
|
||||
return this.getOne(`/api/admin/asset-allocation-records/${id}`)
|
||||
static getAssetAllocationRecordDetail(
|
||||
id: number
|
||||
): Promise<BaseResponse<AssetAllocationRecordDetail>> {
|
||||
return this.getOne<AssetAllocationRecordDetail>(`/api/admin/asset-allocation-records/${id}`)
|
||||
}
|
||||
|
||||
// ========== 批量设置卡的套餐系列绑定相关 ==========
|
||||
|
||||
@@ -13,8 +13,6 @@ import type {
|
||||
WithdrawalSettingItem,
|
||||
CreateWithdrawalSettingParams,
|
||||
CommissionRecordQueryParams,
|
||||
MyCommissionRecordPageResult,
|
||||
MyCommissionSummary,
|
||||
SubmitWithdrawalParams,
|
||||
ShopCommissionRecordPageResult,
|
||||
ShopFundSummaryQueryParams,
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* 客户账号管理 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)
|
||||
}
|
||||
}
|
||||
@@ -241,7 +241,7 @@ export class DeviceService extends BaseService {
|
||||
/**
|
||||
* 设置切卡模式
|
||||
* @param identifier 设备标识(虚拟号 / IMEI / SN)
|
||||
* @param switchMode 切卡模式(0=自动切卡,1=手动切卡)
|
||||
* @param data
|
||||
*/
|
||||
static setSwitchMode(
|
||||
identifier: string,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse, PaginationResponse } from '@/types/api'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
|
||||
// 换货单查询参数
|
||||
export interface ExchangeQueryParams {
|
||||
|
||||
@@ -2,21 +2,15 @@
|
||||
* API 服务模块统一导出
|
||||
*/
|
||||
|
||||
// 旧模块(待重构)
|
||||
export * from './article'
|
||||
|
||||
// 新模块
|
||||
export { AuthService } from './auth'
|
||||
export { RoleService } from './role'
|
||||
export { PermissionService } from './permission'
|
||||
export { AccountService } from './account'
|
||||
export { PlatformAccountService } from './platformAccount'
|
||||
export { ShopAccountService } from './shopAccount'
|
||||
export { ShopService } from './shop'
|
||||
export { CardService } from './card'
|
||||
export { CommissionService } from './commission'
|
||||
export { EnterpriseService } from './enterprise'
|
||||
export { CustomerAccountService } from './customerAccount'
|
||||
export { StorageService } from './storage'
|
||||
export { AuthorizationService } from './authorization'
|
||||
export { DeviceService } from './device'
|
||||
|
||||
@@ -10,10 +10,8 @@ import type {
|
||||
UpdatePackageRequest,
|
||||
UpdatePackageStatusRequest,
|
||||
UpdatePackageShelfStatusRequest,
|
||||
SeriesSelectOption,
|
||||
BaseResponse,
|
||||
PaginationResponse,
|
||||
ListResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class PackageManageService extends BaseService {
|
||||
|
||||
@@ -6,23 +6,12 @@ import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
Permission,
|
||||
PermissionTreeNode,
|
||||
PermissionQueryParams,
|
||||
CreatePermissionParams,
|
||||
UpdatePermissionParams,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
BaseResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class PermissionService extends BaseService {
|
||||
/**
|
||||
* 获取权限列表(分页)
|
||||
* GET /api/admin/permissions
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getPermissions(params?: PermissionQueryParams): Promise<PaginationResponse<Permission>> {
|
||||
return this.getPage<Permission>('/api/admin/permissions', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取权限树
|
||||
* GET /api/admin/permissions/tree
|
||||
|
||||
@@ -1,140 +0,0 @@
|
||||
/**
|
||||
* 平台账号相关 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 {
|
||||
PlatformAccountResponse,
|
||||
PlatformAccountQueryParams,
|
||||
CreatePlatformAccountParams,
|
||||
UpdatePlatformAccountParams,
|
||||
ChangePlatformAccountPasswordParams,
|
||||
AssignRolesParams,
|
||||
UpdateAccountStatusParams,
|
||||
PlatformAccountRoleResponse,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class PlatformAccountService extends BaseService {
|
||||
/**
|
||||
* 1. 获取平台账号列表
|
||||
* GET /api/admin/platform-accounts
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getPlatformAccounts(
|
||||
params?: PlatformAccountQueryParams
|
||||
): Promise<PaginationResponse<PlatformAccountResponse>> {
|
||||
return this.getPage<PlatformAccountResponse>('/api/admin/platform-accounts', params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 2. 新增平台账号
|
||||
* POST /api/admin/platform-accounts
|
||||
* @param data 账号数据
|
||||
*/
|
||||
static createPlatformAccount(
|
||||
data: CreatePlatformAccountParams
|
||||
): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
return this.post<BaseResponse<PlatformAccountResponse>>('/api/admin/platform-accounts', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 3. 移除角色
|
||||
* DELETE /api/admin/platform-accounts/{account_id}/roles/{role_id}
|
||||
* @param accountId 账号ID
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
static removeRoleFromPlatformAccount(accountId: number, roleId: number): Promise<BaseResponse> {
|
||||
return this.delete<BaseResponse>(`/api/admin/platform-accounts/${accountId}/roles/${roleId}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 删除平台账号
|
||||
* DELETE /api/admin/platform-accounts/{id}
|
||||
* @param id 账号ID
|
||||
*/
|
||||
static deletePlatformAccount(id: number): Promise<BaseResponse> {
|
||||
return this.remove(`/api/admin/platform-accounts/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 5. 获取平台账号详情
|
||||
* GET /api/admin/platform-accounts/{id}
|
||||
* @param id 账号ID
|
||||
*/
|
||||
static getPlatformAccountDetail(id: number): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
return this.getOne<PlatformAccountResponse>(`/api/admin/platform-accounts/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 6. 编辑平台账号
|
||||
* PUT /api/admin/platform-accounts/{id}
|
||||
* @param id 账号ID
|
||||
* @param data 更新数据
|
||||
*/
|
||||
static updatePlatformAccount(
|
||||
id: number,
|
||||
data: UpdatePlatformAccountParams
|
||||
): Promise<BaseResponse<PlatformAccountResponse>> {
|
||||
return this.put<BaseResponse<PlatformAccountResponse>>(
|
||||
`/api/admin/platform-accounts/${id}`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 7. 修改密码
|
||||
* PUT /api/admin/platform-accounts/{id}/password
|
||||
* @param id 账号ID
|
||||
* @param data 新密码
|
||||
*/
|
||||
static changePlatformAccountPassword(
|
||||
id: number,
|
||||
data: ChangePlatformAccountPasswordParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/platform-accounts/${id}/password`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 8. 获取账号角色
|
||||
* GET /api/admin/platform-accounts/{id}/roles
|
||||
* @param id 账号ID
|
||||
*/
|
||||
static getPlatformAccountRoles(id: number): Promise<BaseResponse<PlatformAccountRoleResponse[]>> {
|
||||
return this.get<BaseResponse<PlatformAccountRoleResponse[]>>(
|
||||
`/api/admin/platform-accounts/${id}/roles`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 9. 分配角色
|
||||
* POST /api/admin/platform-accounts/{id}/roles
|
||||
* @param id 账号ID
|
||||
* @param data 角色ID列表
|
||||
*/
|
||||
static assignRolesToPlatformAccount(id: number, data: AssignRolesParams): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/platform-accounts/${id}/roles`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 10. 启用/禁用账号
|
||||
* PUT /api/admin/platform-accounts/{id}/status
|
||||
* @param id 账号ID
|
||||
* @param data 状态
|
||||
*/
|
||||
static updatePlatformAccountStatus(
|
||||
id: number,
|
||||
data: UpdateAccountStatusParams
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/platform-accounts/${id}/status`, data)
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* 代理账号相关 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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user