接入举报摄影师正式接口

This commit is contained in:
2026-07-08 16:38:15 +08:00
parent 4a78a0c21a
commit 290a01e699
12 changed files with 2586 additions and 218 deletions

View File

@ -0,0 +1,99 @@
//
// WildPhotographerReportAPI.swift
// suixinkan
//
import Foundation
///
@MainActor
protocol WildPhotographerReportServing {
///
func reportTypes() async throws -> WildReportTypeListResponse
///
func submitReport(_ request: WildReportSubmitRequest) async throws
///
func reportList(_ request: WildReportListRequest) async throws -> WildReportListResponse
}
/// API `photog/report`
@MainActor
final class WildPhotographerReportAPI: WildPhotographerReportServing {
private let client: APIClient
/// API
init(client: APIClient) {
self.client = client
}
///
func reportTypes() async throws -> WildReportTypeListResponse {
try await client.send(
APIRequest(method: .get, path: "/api/yf-handset-app/photog/report/types")
)
}
///
func submitReport(_ request: WildReportSubmitRequest) async throws {
let _: EmptyPayload = try await client.send(
APIRequest(
method: .post,
path: "/api/yf-handset-app/photog/report/submit",
body: request
)
)
}
///
func reportList(_ request: WildReportListRequest) async throws -> WildReportListResponse {
try await client.send(
APIRequest(
method: .get,
path: "/api/yf-handset-app/photog/report/list",
queryItems: request.queryItems
)
)
}
}
///
struct WildReportSubmitRequest: Encodable, Equatable {
let scenicId: Int
let reportType: Int
let desc: String
let storeUserId: Int?
let contactPhone: String?
let locationName: String?
let locationAddress: String?
let lat: Double
let lng: Double
let evidences: [WildReportEvidenceRequest]
let paymentScreenshots: [WildReportEvidenceRequest]
enum CodingKeys: String, CodingKey {
case scenicId = "scenic_id"
case reportType = "report_type"
case desc
case storeUserId = "store_user_id"
case contactPhone = "contact_phone"
case locationName = "location_name"
case locationAddress = "location_address"
case lat
case lng
case evidences
case paymentScreenshots = "payment_screenshots"
}
}
///
struct WildReportEvidenceRequest: Encodable, Equatable {
let fileURL: String
let fileType: Int
let fileName: String?
enum CodingKeys: String, CodingKey {
case fileURL = "file_url"
case fileType = "file_type"
case fileName = "file_name"
}
}