选择图片分享功能
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import Foundation
|
||||
|
||||
// 配置类:统一管理API地址、常量等
|
||||
final class Config {
|
||||
// 单例实例,确保全局唯一
|
||||
static let shared = Config()
|
||||
|
||||
// 服务器主机地址(HOST)
|
||||
private let host = "http://jm.rbq.college"
|
||||
|
||||
// 私有初始化方法,防止外部创建实例
|
||||
private init() {}
|
||||
|
||||
// 拼接完整的API地址
|
||||
func apiURL(path: String) -> String {
|
||||
// 处理path开头的斜杠,确保拼接正确
|
||||
let formattedPath = path.starts(with: "/") ? path : "/\(path)"
|
||||
return "\(host)\(formattedPath)"
|
||||
}
|
||||
|
||||
// 常用API路径常量(可选,进一步简化调用)
|
||||
struct Path {
|
||||
static let search = "search/" // 搜索接口
|
||||
static let albumDetail = "album/" // 漫画详情接口
|
||||
static let rankings = "rankings/" // 排行榜接口(如果有)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user