This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* 微信支付配置管理 API
|
||||
* 支付配置管理 API
|
||||
*/
|
||||
|
||||
import { BaseService } from '../BaseService'
|
||||
@@ -12,6 +12,8 @@ import type {
|
||||
UpdateWechatConfigRequest
|
||||
} from '@/types/api/wechatConfig'
|
||||
|
||||
const PAYMENT_CONFIG_BASE_URL = '/api/admin/wechat-configs'
|
||||
|
||||
export class WechatConfigService extends BaseService {
|
||||
/**
|
||||
* 获取支付配置列表
|
||||
@@ -19,21 +21,21 @@ export class WechatConfigService extends BaseService {
|
||||
static getWechatConfigs(
|
||||
params?: WechatConfigQueryParams
|
||||
): Promise<BaseResponse<WechatConfigListResponse>> {
|
||||
return this.get<BaseResponse<WechatConfigListResponse>>('/api/admin/wechat-configs', params)
|
||||
return this.get<BaseResponse<WechatConfigListResponse>>(PAYMENT_CONFIG_BASE_URL, params)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付配置详情
|
||||
*/
|
||||
static getWechatConfigById(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.get<BaseResponse<WechatConfig>>(`/api/admin/wechat-configs/${id}`)
|
||||
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建支付配置
|
||||
*/
|
||||
static createWechatConfig(data: CreateWechatConfigRequest): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>('/api/admin/wechat-configs', data)
|
||||
return this.post<BaseResponse<WechatConfig>>(PAYMENT_CONFIG_BASE_URL, data)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -43,34 +45,34 @@ export class WechatConfigService extends BaseService {
|
||||
id: number,
|
||||
data: UpdateWechatConfigRequest
|
||||
): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.put<BaseResponse<WechatConfig>>(`/api/admin/wechat-configs/${id}`, data)
|
||||
return this.put<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`, data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除支付配置
|
||||
*/
|
||||
static deleteWechatConfig(id: number): Promise<BaseResponse<void>> {
|
||||
return this.delete<BaseResponse<void>>(`/api/admin/wechat-configs/${id}`)
|
||||
return this.delete<BaseResponse<void>>(`${PAYMENT_CONFIG_BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活支付配置
|
||||
*/
|
||||
static activateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>(`/api/admin/wechat-configs/${id}/activate`)
|
||||
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/activate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停用支付配置
|
||||
*/
|
||||
static deactivateWechatConfig(id: number): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.post<BaseResponse<WechatConfig>>(`/api/admin/wechat-configs/${id}/deactivate`)
|
||||
return this.post<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/${id}/deactivate`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前生效的支付配置
|
||||
*/
|
||||
static getActiveWechatConfig(): Promise<BaseResponse<WechatConfig>> {
|
||||
return this.get<BaseResponse<WechatConfig>>('/api/admin/wechat-configs/active')
|
||||
return this.get<BaseResponse<WechatConfig>>(`${PAYMENT_CONFIG_BASE_URL}/active`)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user