Files
one-pipe-system/src/api/modules/paymentSettings.ts
luo 4c0207c6e6
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m41s
fix: 将微信配置改成支付配置
2026-07-10 18:09:19 +08:00

81 lines
2.3 KiB
TypeScript

/**
* 支付配置管理 API
*/
import { BaseService } from '../BaseService'
import type { BaseResponse } from '@/types/api'
import type {
PaymentSettings,
PaymentSettingsQueryParams,
PaymentSettingsListResponse,
CreatePaymentSettingsRequest,
UpdatePaymentSettingsRequest
} from '@/types/api/paymentSettings'
const PAYMENT_SETTINGS_BASE_URL = '/api/admin/wechat-configs'
export class PaymentSettingsService extends BaseService {
/**
* 获取支付配置列表
*/
static getPaymentSettings(
params?: PaymentSettingsQueryParams
): Promise<BaseResponse<PaymentSettingsListResponse>> {
return this.get<BaseResponse<PaymentSettingsListResponse>>(PAYMENT_SETTINGS_BASE_URL, params)
}
/**
* 获取支付配置详情
*/
static getPaymentSettingsById(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
}
/**
* 创建支付配置
*/
static createPaymentSettings(
data: CreatePaymentSettingsRequest
): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(PAYMENT_SETTINGS_BASE_URL, data)
}
/**
* 更新支付配置
*/
static updatePaymentSettings(
id: number,
data: UpdatePaymentSettingsRequest
): Promise<BaseResponse<PaymentSettings>> {
return this.put<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`, data)
}
/**
* 删除支付配置
*/
static deletePaymentSettings(id: number): Promise<BaseResponse<void>> {
return this.delete<BaseResponse<void>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}`)
}
/**
* 激活支付配置
*/
static activatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/activate`)
}
/**
* 停用支付配置
*/
static deactivatePaymentSettings(id: number): Promise<BaseResponse<PaymentSettings>> {
return this.post<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/${id}/deactivate`)
}
/**
* 获取当前生效的支付配置
*/
static getActivePaymentSettings(): Promise<BaseResponse<PaymentSettings>> {
return this.get<BaseResponse<PaymentSettings>>(`${PAYMENT_SETTINGS_BASE_URL}/active`)
}
}