fix: 微信配置
All checks were successful
构建并部署前端到测试环境 / build-and-deploy (push) Successful in 5m39s

This commit is contained in:
sexygoat
2026-05-22 16:07:47 +08:00
parent b364fb4aec
commit 878d93a865
10 changed files with 994 additions and 633 deletions

View File

@@ -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`)
}
}