将最低部署版本降至 iOS 16,以 ObservableObject 替换 @Observable,新增导航与 UI 兼容层,并补充登录冒烟 UI 测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
55 lines
1.6 KiB
Swift
55 lines
1.6 KiB
Swift
//
|
||
// PaymentAPI.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/22.
|
||
//
|
||
|
||
import Foundation
|
||
import Combine
|
||
|
||
/// 收款模块服务协议,定义收款码和收款记录接口能力。
|
||
@MainActor
|
||
protocol PaymentServing {
|
||
/// 获取当前景区的静态收款码和动态收款码基础 URL。
|
||
func payCode(scenicId: Int) async throws -> PayCodeResponse
|
||
|
||
/// 获取当前景区的扫码收款记录。
|
||
func paymentCollectionRecords(scenicId: Int) async throws -> PaymentCollectionRecordResponse
|
||
}
|
||
|
||
@MainActor
|
||
/// 收款 API,封装首页“收款”模块需要的网络请求。
|
||
final class PaymentAPI {
|
||
private let client: APIClient
|
||
|
||
/// 初始化收款 API,并注入共享网络客户端。
|
||
init(client: APIClient) {
|
||
self.client = client
|
||
}
|
||
|
||
/// 获取当前景区的静态收款码和动态收款码基础 URL。
|
||
func payCode(scenicId: Int) async throws -> PayCodeResponse {
|
||
try await client.send(
|
||
APIRequest(
|
||
method: .get,
|
||
path: "/api/yf-handset-app/photog/pay-code",
|
||
queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicId))]
|
||
)
|
||
)
|
||
}
|
||
|
||
/// 获取当前景区的扫码收款记录。
|
||
func paymentCollectionRecords(scenicId: Int) async throws -> PaymentCollectionRecordResponse {
|
||
try await client.send(
|
||
APIRequest(
|
||
method: .get,
|
||
path: "/api/yf-handset-app/photog/order/photo-scan-order-list",
|
||
queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicId))]
|
||
)
|
||
)
|
||
}
|
||
}
|
||
|
||
extension PaymentAPI: PaymentServing {}
|