feat: update wallet punch point and report success

This commit is contained in:
2026-07-09 14:27:18 +08:00
parent 2970f1514b
commit 43e6133c21
34 changed files with 6671 additions and 71 deletions

View File

@ -0,0 +1,84 @@
//
// PunchPointAPI.swift
// suixinkan
//
import Foundation
/// API 便 ViewModel
@MainActor
protocol PunchPointAPIProtocol {
///
func list(scenicAreaId: String, status: Int, page: Int, pageSize: Int) async throws -> PunchPointListResponse
///
func info(id: Int64) async throws -> PunchPointDetail
///
func add(_ request: PunchPointSaveRequest) async throws
///
func edit(_ request: PunchPointSaveRequest) async throws
///
func delete(id: Int64) async throws
}
/// API Android `NetworkApi` `photog/scenic-spot`
@MainActor
final class PunchPointAPI: PunchPointAPIProtocol {
private let client: APIClient
/// API
init(client: APIClient) {
self.client = client
}
///
func list(scenicAreaId: String, status: Int, page: Int, pageSize: Int) async throws -> PunchPointListResponse {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/scenic-spot/list",
queryItems: [
URLQueryItem(name: "scenic_area_id", value: scenicAreaId),
URLQueryItem(name: "status", value: String(status)),
URLQueryItem(name: "page", value: String(max(page, 1))),
URLQueryItem(name: "page_size", value: String(max(pageSize, 1))),
]
)
)
}
///
func info(id: Int64) async throws -> PunchPointDetail {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/scenic-spot/info",
queryItems: [URLQueryItem(name: "id", value: String(id))]
)
)
}
///
func add(_ request: PunchPointSaveRequest) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(method: .post, path: "/api/yf-handset-app/photog/scenic-spot/add", body: request)
)
}
///
func edit(_ request: PunchPointSaveRequest) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(method: .post, path: "/api/yf-handset-app/photog/scenic-spot/edit", body: request)
)
}
///
func delete(id: Int64) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/scenic-spot/delete",
body: PunchPointIDRequest(id: id)
)
)
}
}