// // OperatingAreaAPI.swift // suixinkan // // Created by Codex on 2026/6/25. // import Foundation /// 运营区域服务协议,定义店铺和景区管理员两类围栏数据接口。 @MainActor protocol OperatingAreaServing { /// store营业Area相关逻辑。 func storeBusinessArea(storeId: Int) async throws -> ListPayload /// scenicAdmin营业Area相关逻辑。 func scenicAdminBusinessArea(scenicId: Int) async throws -> ListPayload } @MainActor /// 运营区域 API,封装运营区域只读围栏接口。 final class OperatingAreaAPI { private let client: APIClient /// 初始化运营区域 API,并注入共享网络客户端。 init(client: APIClient) { self.client = client } /// 获取当前店铺的运营区域围栏。 func storeBusinessArea(storeId: Int) async throws -> ListPayload { 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 { 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 {}