Integrate高德 SDK with simulator-safe build flags, add map views for operating area and punch points, refactor main tabs and key feature screens to UIKit with Diffable lists, and document Swift concurrency defaults in AGENTS.md. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.6 KiB
Swift
53 lines
1.6 KiB
Swift
//
|
||
// OperatingAreaAPI.swift
|
||
// suixinkan
|
||
//
|
||
// Created by Codex on 2026/6/25.
|
||
//
|
||
|
||
import Foundation
|
||
|
||
/// 运营区域服务协议,定义店铺和景区管理员两类围栏数据接口。
|
||
@MainActor
|
||
protocol OperatingAreaServing {
|
||
/// store营业Area相关逻辑。
|
||
func storeBusinessArea(storeId: Int) async throws -> ListPayload<OperatingAreaItem>
|
||
/// scenicAdmin营业Area相关逻辑。
|
||
func scenicAdminBusinessArea(scenicId: Int) async throws -> ListPayload<OperatingAreaItem>
|
||
}
|
||
|
||
@MainActor
|
||
/// 运营区域 API,封装运营区域只读围栏接口。
|
||
final class OperatingAreaAPI {
|
||
private let client: APIClient
|
||
|
||
/// 初始化运营区域 API,并注入共享网络客户端。
|
||
init(client: APIClient) {
|
||
self.client = client
|
||
}
|
||
|
||
/// 获取当前店铺的运营区域围栏。
|
||
func storeBusinessArea(storeId: Int) async throws -> ListPayload<OperatingAreaItem> {
|
||
try await client.send(
|
||
APIRequest(
|
||
method: .get,
|
||
path: "/api/app/store/business-area",
|
||
queryItems: [URLQueryItem(name: "store_id", value: String(storeId))]
|
||
)
|
||
)
|
||
}
|
||
|
||
/// 获取景区管理员视角下的运营区域围栏。
|
||
func scenicAdminBusinessArea(scenicId: Int) async throws -> ListPayload<OperatingAreaItem> {
|
||
try await client.send(
|
||
APIRequest(
|
||
method: .get,
|
||
path: "/api/app/scenic-admin/business-area",
|
||
queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicId))]
|
||
)
|
||
)
|
||
}
|
||
}
|
||
|
||
extension OperatingAreaAPI: OperatingAreaServing {}
|