feat: 完成9.7线下收款登记与日清

This commit is contained in:
2026-08-26 09:53:48 +08:00
parent dca4bd5a20
commit 825a0448cc
24 changed files with 2663 additions and 6 deletions
@@ -0,0 +1,48 @@
import Foundation
/// 线下收款接口抽象,供生产 API 与测试替身共用。
@MainActor
protocol OfflineCollectionServing: AnyObject {
func statistics(scenicId: Int) async throws -> OfflineCollectionStatisticsResponse
func details(scenicId: Int, date: String) async throws -> OfflineCollectionDetailsResponse
func register(_ request: OfflineCollectionRegisterRequest) async throws -> OfflineCollectionRegisterResponse
func supplement(_ request: OfflineSettlementRequest) async throws -> OfflineSettlementResult
}
/// 线下收款真实网络 API。
@MainActor
final class OfflineCollectionAPI: OfflineCollectionServing {
private let client: APIClient
private let prefix = "/api/yf-handset-app/photog/offline-pay-collect"
init(client: APIClient) {
self.client = client
}
func statistics(scenicId: Int) async throws -> OfflineCollectionStatisticsResponse {
try await client.send(APIRequest(
method: .get,
path: "\(prefix)/statistics",
queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicId))]
))
}
func details(scenicId: Int, date: String) async throws -> OfflineCollectionDetailsResponse {
try await client.send(APIRequest(
method: .get,
path: "\(prefix)/details",
queryItems: [
URLQueryItem(name: "scenic_id", value: String(scenicId)),
URLQueryItem(name: "date", value: date),
]
))
}
func register(_ request: OfflineCollectionRegisterRequest) async throws -> OfflineCollectionRegisterResponse {
try await client.send(APIRequest(method: .post, path: "\(prefix)/register", body: request))
}
func supplement(_ request: OfflineSettlementRequest) async throws -> OfflineSettlementResult {
try await client.send(APIRequest(method: .post, path: "\(prefix)/supplement", body: request))
}
}