fetch(modify):修复BUG
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m27s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 3m27s
This commit is contained in:
@@ -18,7 +18,11 @@ import type {
|
||||
CardOrder,
|
||||
BaseResponse,
|
||||
PaginationResponse,
|
||||
ListResponse
|
||||
ListResponse,
|
||||
GatewayFlowUsageResponse,
|
||||
GatewayRealnameStatusResponse,
|
||||
GatewayCardStatusResponse,
|
||||
GatewayRealnameLinkResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class CardService extends BaseService {
|
||||
@@ -367,4 +371,62 @@ export class CardService extends BaseService {
|
||||
}): Promise<BaseResponse<any>> {
|
||||
return this.patch('/api/admin/iot-cards/series-binding', data)
|
||||
}
|
||||
|
||||
// ========== IoT卡网关操作相关 ==========
|
||||
|
||||
/**
|
||||
* 查询流量使用
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static getGatewayFlow(iccid: string): Promise<BaseResponse<GatewayFlowUsageResponse>> {
|
||||
return this.get<BaseResponse<GatewayFlowUsageResponse>>(
|
||||
`/api/admin/iot-cards/${iccid}/gateway-flow`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询实名认证状态
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static getGatewayRealname(iccid: string): Promise<BaseResponse<GatewayRealnameStatusResponse>> {
|
||||
return this.get<BaseResponse<GatewayRealnameStatusResponse>>(
|
||||
`/api/admin/iot-cards/${iccid}/gateway-realname`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询卡实时状态
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static getGatewayStatus(iccid: string): Promise<BaseResponse<GatewayCardStatusResponse>> {
|
||||
return this.get<BaseResponse<GatewayCardStatusResponse>>(
|
||||
`/api/admin/iot-cards/${iccid}/gateway-status`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取实名认证链接
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static getRealnameLink(iccid: string): Promise<BaseResponse<GatewayRealnameLinkResponse>> {
|
||||
return this.get<BaseResponse<GatewayRealnameLinkResponse>>(
|
||||
`/api/admin/iot-cards/${iccid}/realname-link`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用物联网卡(复机)
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static startCard(iccid: string): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/iot-cards/${iccid}/start`, {})
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用物联网卡(停机)
|
||||
* @param iccid ICCID
|
||||
*/
|
||||
static stopCard(iccid: string): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(`/api/admin/iot-cards/${iccid}/stop`, {})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,11 @@ import type {
|
||||
DeviceImportTaskQueryParams,
|
||||
DeviceImportTaskListResponse,
|
||||
DeviceImportTaskDetail,
|
||||
BaseResponse
|
||||
BaseResponse,
|
||||
SetSpeedLimitRequest,
|
||||
SwitchCardRequest,
|
||||
SetWiFiRequest,
|
||||
DeviceOperationResponse
|
||||
} from '@/types/api'
|
||||
|
||||
export class DeviceService extends BaseService {
|
||||
@@ -157,4 +161,73 @@ export class DeviceService extends BaseService {
|
||||
}): Promise<BaseResponse<any>> {
|
||||
return this.patch('/api/admin/devices/series-binding', data)
|
||||
}
|
||||
|
||||
// ========== 设备操作相关 ==========
|
||||
|
||||
/**
|
||||
* 重启设备
|
||||
* @param imei 设备号(IMEI)
|
||||
*/
|
||||
static rebootDevice(imei: string): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.post<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-imei/${imei}/reboot`,
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复出厂设置
|
||||
* @param imei 设备号(IMEI)
|
||||
*/
|
||||
static resetDevice(imei: string): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.post<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-imei/${imei}/reset`,
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置限速
|
||||
* @param imei 设备号(IMEI)
|
||||
* @param data 限速参数
|
||||
*/
|
||||
static setSpeedLimit(
|
||||
imei: string,
|
||||
data: SetSpeedLimitRequest
|
||||
): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.put<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-imei/${imei}/speed-limit`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换SIM卡
|
||||
* @param imei 设备号(IMEI)
|
||||
* @param data 切卡参数
|
||||
*/
|
||||
static switchCard(
|
||||
imei: string,
|
||||
data: SwitchCardRequest
|
||||
): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.post<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-imei/${imei}/switch-card`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置WiFi
|
||||
* @param imei 设备号(IMEI)
|
||||
* @param data WiFi参数
|
||||
*/
|
||||
static setWiFi(
|
||||
imei: string,
|
||||
data: SetWiFiRequest
|
||||
): Promise<BaseResponse<DeviceOperationResponse>> {
|
||||
return this.put<BaseResponse<DeviceOperationResponse>>(
|
||||
`/api/admin/devices/by-imei/${imei}/wifi`,
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import type {
|
||||
ShopQueryParams,
|
||||
CreateShopParams,
|
||||
UpdateShopParams,
|
||||
ShopRolesResponse,
|
||||
AssignShopRolesRequest,
|
||||
BaseResponse,
|
||||
PaginationResponse
|
||||
} from '@/types/api'
|
||||
@@ -49,4 +51,38 @@ export class ShopService extends BaseService {
|
||||
static deleteShop(id: number): Promise<BaseResponse> {
|
||||
return this.delete<BaseResponse>(`/api/admin/shops/${id}`)
|
||||
}
|
||||
|
||||
// ========== 店铺默认角色管理 ==========
|
||||
|
||||
/**
|
||||
* 获取店铺默认角色列表
|
||||
* GET /api/admin/shops/{shop_id}/roles
|
||||
* @param shopId 店铺ID
|
||||
*/
|
||||
static getShopRoles(shopId: number): Promise<BaseResponse<ShopRolesResponse>> {
|
||||
return this.get<BaseResponse<ShopRolesResponse>>(`/api/admin/shops/${shopId}/roles`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配店铺默认角色
|
||||
* POST /api/admin/shops/{shop_id}/roles
|
||||
* @param shopId 店铺ID
|
||||
* @param data 角色ID列表
|
||||
*/
|
||||
static assignShopRoles(
|
||||
shopId: number,
|
||||
data: AssignShopRolesRequest
|
||||
): Promise<BaseResponse<ShopRolesResponse>> {
|
||||
return this.post<BaseResponse<ShopRolesResponse>>(`/api/admin/shops/${shopId}/roles`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店铺默认角色
|
||||
* DELETE /api/admin/shops/{shop_id}/roles/{role_id}
|
||||
* @param shopId 店铺ID
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
static deleteShopRole(shopId: number, roleId: number): Promise<BaseResponse> {
|
||||
return this.delete<BaseResponse>(`/api/admin/shops/${shopId}/roles/${roleId}`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user