This commit is contained in:
@@ -14,6 +14,16 @@ import type {
|
||||
UpdateEnterpriseStatusParams,
|
||||
CreateEnterpriseResponse
|
||||
} from '@/types/api/enterprise'
|
||||
import type {
|
||||
AllocateCardsRequest,
|
||||
AllocateCardsResponse,
|
||||
AllocateCardsPreviewRequest,
|
||||
AllocateCardsPreviewResponse,
|
||||
EnterpriseCardListParams,
|
||||
EnterpriseCardPageResult,
|
||||
RecallCardsRequest,
|
||||
RecallCardsResponse
|
||||
} from '@/types/api/enterpriseCard'
|
||||
|
||||
export class EnterpriseService extends BaseService {
|
||||
/**
|
||||
@@ -63,4 +73,88 @@ export class EnterpriseService extends BaseService {
|
||||
): Promise<BaseResponse> {
|
||||
return this.put<BaseResponse>(`/api/admin/enterprises/${id}/status`, data)
|
||||
}
|
||||
|
||||
// ========== 企业卡授权相关 ==========
|
||||
|
||||
/**
|
||||
* 授权卡给企业
|
||||
* @param enterpriseId 企业ID
|
||||
* @param data 授权请求数据
|
||||
*/
|
||||
static allocateCards(
|
||||
enterpriseId: number,
|
||||
data: AllocateCardsRequest
|
||||
): Promise<BaseResponse<AllocateCardsResponse>> {
|
||||
return this.post<BaseResponse<AllocateCardsResponse>>(
|
||||
`/api/admin/enterprises/${enterpriseId}/allocate-cards`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡授权预检
|
||||
* @param enterpriseId 企业ID
|
||||
* @param data 预检请求数据
|
||||
*/
|
||||
static previewAllocateCards(
|
||||
enterpriseId: number,
|
||||
data: AllocateCardsPreviewRequest
|
||||
): Promise<BaseResponse<AllocateCardsPreviewResponse>> {
|
||||
return this.post<BaseResponse<AllocateCardsPreviewResponse>>(
|
||||
`/api/admin/enterprises/${enterpriseId}/allocate-cards/preview`,
|
||||
data
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取企业卡列表
|
||||
* @param enterpriseId 企业ID
|
||||
* @param params 查询参数
|
||||
*/
|
||||
static getEnterpriseCards(
|
||||
enterpriseId: number,
|
||||
params?: EnterpriseCardListParams
|
||||
): Promise<BaseResponse<EnterpriseCardPageResult>> {
|
||||
return this.get<BaseResponse<EnterpriseCardPageResult>>(
|
||||
`/api/admin/enterprises/${enterpriseId}/cards`,
|
||||
params
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 复机卡
|
||||
* @param enterpriseId 企业ID
|
||||
* @param cardId 卡ID
|
||||
*/
|
||||
static resumeCard(enterpriseId: number, cardId: number): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(
|
||||
`/api/admin/enterprises/${enterpriseId}/cards/${cardId}/resume`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停机卡
|
||||
* @param enterpriseId 企业ID
|
||||
* @param cardId 卡ID
|
||||
*/
|
||||
static suspendCard(enterpriseId: number, cardId: number): Promise<BaseResponse> {
|
||||
return this.post<BaseResponse>(
|
||||
`/api/admin/enterprises/${enterpriseId}/cards/${cardId}/suspend`
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 回收卡授权
|
||||
* @param enterpriseId 企业ID
|
||||
* @param data 回收请求数据
|
||||
*/
|
||||
static recallCards(
|
||||
enterpriseId: number,
|
||||
data: RecallCardsRequest
|
||||
): Promise<BaseResponse<RecallCardsResponse>> {
|
||||
return this.post<BaseResponse<RecallCardsResponse>>(
|
||||
`/api/admin/enterprises/${enterpriseId}/recall-cards`,
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user