feat: 添加项目基础文件和依赖管理
新增.gitignore、Podfile和Podfile.lock文件以管理项目依赖,添加README.md文件提供项目简介和安装步骤,创建NIMSessionManager、ClientConfig、LogManager和NetworkManager等管理类以支持网络请求和日志记录功能,更新AppDelegate和ContentView以集成NIM SDK和实现用户登录功能。
This commit is contained in:
@@ -15,9 +15,9 @@ struct AppConfig {
|
||||
static var baseURL: String {
|
||||
switch current {
|
||||
case .development:
|
||||
return "https://dev-api.yourdomain.com/v1"
|
||||
return "http://beta.api.molistar.xyz"
|
||||
case .production:
|
||||
return "https://api.yourdomain.com/v1"
|
||||
return "https://api.hfighting.com"
|
||||
}
|
||||
}
|
||||
|
||||
|
32
yana/Configs/ClientConfig.swift
Normal file
32
yana/Configs/ClientConfig.swift
Normal file
@@ -0,0 +1,32 @@
|
||||
import Foundation
|
||||
|
||||
final class ClientConfig {
|
||||
static let shared = ClientConfig()
|
||||
private init() {}
|
||||
|
||||
func initializeClient() {
|
||||
print("开始初始化客户端")
|
||||
|
||||
NetworkManager.shared.enhancedRequest(
|
||||
path: "client/init",
|
||||
method: .get,
|
||||
responseType: Data.self
|
||||
) { result in
|
||||
switch result {
|
||||
case .success(let response):
|
||||
print("初始化成功,状态码:\(response.statusCode)")
|
||||
if let data = response.data {
|
||||
do {
|
||||
let json = try JSONSerialization.jsonObject(with: data)
|
||||
print("响应数据:\(json)")
|
||||
} catch {
|
||||
print("JSON解析失败:\(error)")
|
||||
}
|
||||
}
|
||||
|
||||
case .failure(let error):
|
||||
print("初始化失败:\(error.localizedDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user