发布球局

This commit is contained in:
筱野
2025-08-23 15:14:37 +08:00
parent e5176f4f5f
commit fb150617c6
34 changed files with 679 additions and 602 deletions

View File

@@ -41,7 +41,7 @@ class HttpService {
constructor() {
// 使用环境配置
this.baseURL = `${envConfig.apiBaseURL}/api/${envConfig.apiVersion}`
this.baseURL = `${envConfig.apiBaseURL}/api/`
this.timeout = envConfig.timeout
this.enableLog = envConfig.enableLog
@@ -77,7 +77,6 @@ class HttpService {
private buildHeaders(config: RequestConfig): Record<string, string> {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
'X-Environment': envConfig.name, // 添加环境标识
...config.headers
}
@@ -211,6 +210,7 @@ class HttpService {
}
try {
console.log(this.buildHeaders(config), 1111);
const requestConfig = {
url: fullUrl,
method: method,

View File

@@ -0,0 +1,38 @@
import httpService from './httpService'
import type { ApiResponse } from './httpService'
// 用户接口
export interface PublishBallData {
title: string,
venue_id: number,
creator_id: number,
game_date: string,
start_time: string,
end_time: string,
max_participants: number,
current_participants: number,
ntrp_level: string,
play_style: string,
description: string,
}
// 响应接口
export interface Response {
code: string
message: string
data: any
}
// 发布球局类
class PublishService {
// 用户登录
async createPersonal(data: PublishBallData): Promise<ApiResponse<Response>> {
return httpService.post('/games/create', data, {
showLoading: true,
loadingText: '发布中...'
})
}
}
// 导出认证服务实例
export default new PublishService()