fix: 将微信配置改成支付配置
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m41s
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 4m41s
This commit is contained in:
80
src/api/modules/paymentSettings.ts
Normal file
80
src/api/modules/paymentSettings.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* 支付配置管理 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`)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user