This commit is contained in:
@@ -8,10 +8,14 @@ import type {
|
||||
AccountQueryParams,
|
||||
CreatePlatformAccountParams,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
PaginationResponse,
|
||||
WecomAccountBindingRequest
|
||||
} from '@/types/api'
|
||||
|
||||
export class AccountService extends BaseService {
|
||||
static bindWecom(id: number, data: WecomAccountBindingRequest): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/accounts/${id}/wecom-binding`, data)
|
||||
}
|
||||
// ========== 账号管理 (Account Management) ==========
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
import request from '@/utils/http'
|
||||
import type {
|
||||
BulkPurchaseCreateRequest,
|
||||
BulkPurchaseCreateApiResponse,
|
||||
BulkPurchaseItemsApiResponse,
|
||||
BulkPurchaseTaskListApiResponse,
|
||||
BulkPurchaseTaskApiResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class BulkPurchaseService {
|
||||
static createTask(data: FormData): Promise<BulkPurchaseCreateApiResponse> {
|
||||
static createTask(data: BulkPurchaseCreateRequest): Promise<BulkPurchaseCreateApiResponse> {
|
||||
return request.post<BulkPurchaseCreateApiResponse>({
|
||||
url: '/api/admin/bulk-purchases',
|
||||
url: '/api/admin/asset-package-batch-orders',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
static getTasks(params?: {
|
||||
page?: number
|
||||
page_size?: number
|
||||
status?: number
|
||||
}): Promise<BulkPurchaseTaskListApiResponse> {
|
||||
return request.get<BulkPurchaseTaskListApiResponse>({
|
||||
url: '/api/admin/asset-package-batch-orders',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
static getTask(taskId: number): Promise<BulkPurchaseTaskApiResponse> {
|
||||
return request.get<BulkPurchaseTaskApiResponse>({
|
||||
url: `/api/admin/bulk-purchases/${taskId}`
|
||||
})
|
||||
}
|
||||
|
||||
static getItems(
|
||||
taskId: number,
|
||||
params?: { page?: number; size?: number; status?: string | number }
|
||||
): Promise<BulkPurchaseItemsApiResponse> {
|
||||
return request.get<BulkPurchaseItemsApiResponse>({
|
||||
url: `/api/admin/bulk-purchases/${taskId}/items`,
|
||||
params
|
||||
url: `/api/admin/asset-package-batch-orders/${taskId}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,10 @@ import type {
|
||||
AssetAllocationRecordDetail,
|
||||
BatchSetCardSeriesBindingRequest,
|
||||
BatchSetCardSeriesBindingResponse,
|
||||
BatchUpdateAssetRealnamePolicyRequest
|
||||
BatchUpdateAssetRealnamePolicyRequest,
|
||||
BatchUpdateAssetRealnamePolicyResponse,
|
||||
SpeedTierCode,
|
||||
SetSpeedTierResponse
|
||||
} from '@/types/api'
|
||||
|
||||
type ApiQueryParams = PaginationParams & Record<string, unknown>
|
||||
@@ -57,6 +60,15 @@ interface CardChangeNotice {
|
||||
}
|
||||
|
||||
export class CardService extends BaseService {
|
||||
static setSpeedTier(
|
||||
iccid: string,
|
||||
code: SpeedTierCode
|
||||
): Promise<BaseResponse<SetSpeedTierResponse>> {
|
||||
return this.put<BaseResponse<SetSpeedTierResponse>>(
|
||||
`/api/admin/iot-cards/${encodeURIComponent(iccid)}/speed-tier`,
|
||||
{ code }
|
||||
)
|
||||
}
|
||||
// ========== 号卡商品管理 ==========
|
||||
|
||||
/**
|
||||
@@ -418,8 +430,8 @@ export class CardService extends BaseService {
|
||||
static batchUpdateRealnamePolicy(
|
||||
data: BatchUpdateAssetRealnamePolicyRequest,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(
|
||||
): Promise<BaseResponse<BatchUpdateAssetRealnamePolicyResponse>> {
|
||||
return this.post<BaseResponse<BatchUpdateAssetRealnamePolicyResponse>>(
|
||||
'/api/admin/iot-cards/batch-update-realname-policy',
|
||||
data,
|
||||
config
|
||||
|
||||
@@ -18,13 +18,15 @@ import type {
|
||||
BatchSetDeviceSeriesBindingRequest,
|
||||
BatchSetDeviceSeriesBindingResponse,
|
||||
BatchUpdateAssetRealnamePolicyRequest,
|
||||
BatchUpdateAssetRealnamePolicyResponse,
|
||||
ImportDeviceRequest,
|
||||
ImportDeviceResponse,
|
||||
DeviceImportTaskQueryParams,
|
||||
DeviceImportTaskListResponse,
|
||||
DeviceImportTaskDetail,
|
||||
DeviceBatchAllocationRequest,
|
||||
DeviceBatchAllocationResponse,
|
||||
BaseResponse,
|
||||
SetSpeedLimitRequest,
|
||||
SwitchCardRequest,
|
||||
SetWiFiRequest,
|
||||
DeviceOperationResponse
|
||||
@@ -147,6 +149,15 @@ export class DeviceService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
static createAllocationTask(
|
||||
data: DeviceBatchAllocationRequest
|
||||
): Promise<BaseResponse<DeviceBatchAllocationResponse>> {
|
||||
return this.post<BaseResponse<DeviceBatchAllocationResponse>>(
|
||||
'/api/admin/devices/import/allocations',
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导入任务详情
|
||||
* @param id 任务ID
|
||||
@@ -176,8 +187,8 @@ export class DeviceService extends BaseService {
|
||||
static batchUpdateRealnamePolicy(
|
||||
data: BatchUpdateAssetRealnamePolicyRequest,
|
||||
config?: Record<string, any>
|
||||
): Promise<BaseResponse<void>> {
|
||||
return this.post<BaseResponse<void>>(
|
||||
): Promise<BaseResponse<BatchUpdateAssetRealnamePolicyResponse>> {
|
||||
return this.post<BaseResponse<BatchUpdateAssetRealnamePolicyResponse>>(
|
||||
'/api/admin/devices/batch-update-realname-policy',
|
||||
data,
|
||||
config
|
||||
@@ -208,21 +219,6 @@ export class DeviceService extends BaseService {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置限速
|
||||
* @param imei 设备号(IMEI)
|
||||
* @param data 限速参数
|
||||
*/
|
||||
static setSpeedLimit(
|
||||
imei: string,
|
||||
data: SetSpeedLimitRequest
|
||||
): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.put<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-identifier/${imei}/speed-limit`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换SIM卡
|
||||
* @param imei 设备号(IMEI)
|
||||
|
||||
@@ -5,12 +5,16 @@
|
||||
import { BaseService } from '../BaseService'
|
||||
import type { BaseResponse } from '@/types/api'
|
||||
|
||||
export type ExchangeAssetType = 'iot_card' | 'device'
|
||||
export type ExchangeFlowType = 'shipping' | 'direct'
|
||||
export type ExchangeStatus = 1 | 2 | 3 | 4 | 5
|
||||
|
||||
// 换货单查询参数
|
||||
export interface ExchangeQueryParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
status?: number // 换货状态
|
||||
flow_type?: string // 流程类型(shipping/direct)
|
||||
status?: ExchangeStatus // 换货状态
|
||||
flow_type?: ExchangeFlowType // 流程类型(shipping/direct)
|
||||
old_asset_keyword?: string // 旧资产关键词(ICCID、接入号、虚拟号、IMEI、SN)
|
||||
new_asset_keyword?: string // 新资产关键词(ICCID、接入号、虚拟号、IMEI、SN)
|
||||
created_at_start?: string // 创建时间起始
|
||||
@@ -20,9 +24,9 @@ export interface ExchangeQueryParams {
|
||||
// 创建换货单请求
|
||||
export interface CreateExchangeRequest {
|
||||
exchange_reason: string // 换货原因
|
||||
old_asset_type: string // 旧资产类型 (iot_card 或 device)
|
||||
old_asset_type: ExchangeAssetType // 旧资产类型 (iot_card 或 device)
|
||||
old_identifier: string // 旧资产标识符(ICCID/虚拟号/IMEI/SN)
|
||||
flow_type?: string // 流程类型(shipping/direct),默认 shipping
|
||||
flow_type?: ExchangeFlowType // 流程类型(shipping/direct),默认 shipping
|
||||
new_identifier?: string // 新资产标识符(direct 时必填)
|
||||
migrate_data?: boolean // 是否迁移数据(默认 false)
|
||||
remark?: string // 备注(可选)
|
||||
@@ -33,16 +37,16 @@ export interface ExchangeResponse {
|
||||
id: number
|
||||
exchange_no: string
|
||||
exchange_reason: string
|
||||
old_asset_type: string
|
||||
old_asset_type: ExchangeAssetType
|
||||
old_asset_id: number
|
||||
old_asset_identifier: string
|
||||
new_asset_type?: string | null
|
||||
new_asset_type?: ExchangeAssetType | null
|
||||
new_asset_id?: number | null
|
||||
new_asset_identifier?: string | null
|
||||
status: number // 换货状态(1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)
|
||||
status: ExchangeStatus // 换货状态(1:待填写信息, 2:待发货, 3:已发货待确认, 4:已完成, 5:已取消)
|
||||
status_name?: string
|
||||
status_text: string
|
||||
flow_type: string // 流程类型(shipping/direct)
|
||||
flow_type: ExchangeFlowType // 流程类型(shipping/direct)
|
||||
flow_type_name: string // 流程类型名称
|
||||
shipped_at?: string | null // 发货时间(仅 shipping 发货后有值)
|
||||
completed_at?: string | null // 换货完成时间
|
||||
|
||||
@@ -19,9 +19,10 @@ export class ExportTaskService extends BaseService {
|
||||
}
|
||||
|
||||
static getExportTaskDetail(id: number): Promise<ExportTaskDetailApiResponse> {
|
||||
return this.getOne<ExportTaskDetail>(`/api/admin/export-tasks/${id}`)
|
||||
return this.get<ExportTaskDetailApiResponse>(`/api/admin/export-tasks/${id}`)
|
||||
}
|
||||
|
||||
/** 保留旧页面的取消入口,后端支持时由页面权限控制显示。 */
|
||||
static cancelExportTask(id: number): Promise<CancelExportTaskApiResponse> {
|
||||
return this.post<CancelExportTaskApiResponse>(`/api/admin/export-tasks/${id}/cancel`, {})
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ export { ExportTaskService } from './exportTask'
|
||||
export { OrderPackageInvalidateTaskService } from './orderPackageInvalidateTask'
|
||||
export { BulkPurchaseService } from './bulkPurchase'
|
||||
export { NotificationService } from './notification'
|
||||
export { WecomService } from './wecom'
|
||||
|
||||
// TODO: 按需添加其他业务模块
|
||||
// export { SettingService } from './setting'
|
||||
|
||||
@@ -11,7 +11,7 @@ import type {
|
||||
UpdatePackageStatusRequest,
|
||||
UpdatePackageShelfStatusRequest,
|
||||
BaseResponse,
|
||||
PaginationResponse,
|
||||
PaginationResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class PackageManageService extends BaseService {
|
||||
@@ -68,7 +68,7 @@ export class PackageManageService extends BaseService {
|
||||
* 更新套餐状态
|
||||
* PUT /api/admin/packages/{id}/status
|
||||
* @param id 套餐ID
|
||||
* @param status 状态 (1:启用, 2:禁用)
|
||||
* @param status 状态 (0:禁用, 1:启用)
|
||||
*/
|
||||
static updatePackageStatus(id: number, status: number): Promise<BaseResponse> {
|
||||
const data: UpdatePackageStatusRequest = { status }
|
||||
|
||||
@@ -23,7 +23,12 @@ const triggerBrowserDownload = (downloadUrl: string, fileName: string) => {
|
||||
/**
|
||||
* 文件用途枚举
|
||||
*/
|
||||
export type FilePurpose = 'iot_import' | 'device_import' | 'export' | 'attachment'
|
||||
export type FilePurpose =
|
||||
| 'iot_import'
|
||||
| 'batch_purchase'
|
||||
| 'device_batch_allocation'
|
||||
| 'export'
|
||||
| 'attachment'
|
||||
|
||||
/**
|
||||
* 获取上传 URL 请求参数
|
||||
|
||||
78
src/api/modules/wecom.ts
Normal file
78
src/api/modules/wecom.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { BaseService } from '../BaseService'
|
||||
import type {
|
||||
BaseResponse,
|
||||
WecomAccountBindingRequest,
|
||||
WecomApplication,
|
||||
WecomApplicationListResponse,
|
||||
WecomApplicationQueryParams,
|
||||
WecomApplicationRequest,
|
||||
WecomApplicationResponse,
|
||||
WecomBusinessType,
|
||||
WecomMemberListResponse,
|
||||
WecomMemberQueryParams,
|
||||
WecomSceneListResponse,
|
||||
WecomSceneQueryParams,
|
||||
WecomSceneRequest,
|
||||
WecomSceneResponse,
|
||||
WecomSyncMembersApiResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class WecomService extends BaseService {
|
||||
static getApplications(
|
||||
params?: WecomApplicationQueryParams
|
||||
): Promise<WecomApplicationListResponse> {
|
||||
return this.get<WecomApplicationListResponse>('/api/admin/wecom/applications', params)
|
||||
}
|
||||
|
||||
static saveApplication(data: WecomApplicationRequest): Promise<WecomApplicationResponse> {
|
||||
return this.post<WecomApplicationResponse>('/api/admin/wecom/applications', data)
|
||||
}
|
||||
|
||||
static testApplication(id: number): Promise<BaseResponse<{ success: boolean }>> {
|
||||
return this.post<BaseResponse<{ success: boolean }>>(`/api/admin/wecom/applications/${id}/test`)
|
||||
}
|
||||
|
||||
static syncMembers(id: number): Promise<WecomSyncMembersApiResponse> {
|
||||
return this.post<WecomSyncMembersApiResponse>(
|
||||
`/api/admin/wecom/applications/${id}/members/sync`
|
||||
)
|
||||
}
|
||||
|
||||
static getMembers(
|
||||
id: number,
|
||||
params?: WecomMemberQueryParams
|
||||
): Promise<WecomMemberListResponse> {
|
||||
return this.get<WecomMemberListResponse>(
|
||||
`/api/admin/wecom/applications/${id}/members`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
static setDefaultCreator(id: number, userid: string): Promise<WecomApplicationResponse> {
|
||||
return this.put<WecomApplicationResponse>(
|
||||
`/api/admin/wecom/applications/${id}/default-creator`,
|
||||
{ userid }
|
||||
)
|
||||
}
|
||||
|
||||
static getScenes(params?: WecomSceneQueryParams): Promise<WecomSceneListResponse> {
|
||||
return this.get<WecomSceneListResponse>('/api/admin/wecom/scenes', params)
|
||||
}
|
||||
|
||||
static saveScene(
|
||||
businessType: WecomBusinessType,
|
||||
data: WecomSceneRequest
|
||||
): Promise<WecomSceneResponse> {
|
||||
return this.put<WecomSceneResponse>(`/api/admin/wecom/scenes/${businessType}`, data)
|
||||
}
|
||||
|
||||
static bindAccount(
|
||||
accountId: number,
|
||||
data: WecomAccountBindingRequest
|
||||
): Promise<BaseResponse<WecomApplication>> {
|
||||
return this.put<BaseResponse<WecomApplication>>(
|
||||
`/api/admin/accounts/${accountId}/wecom-binding`,
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user