feat(drone-dock): 对接我的拍摄订单筛选与分页
This commit is contained in:
@@ -5,14 +5,23 @@ protocol DroneDockHomeServing: Sendable {
|
||||
/// 读取当前景区的机巢摘要;门店用于验证本地身份,不作为查询参数。
|
||||
@MainActor
|
||||
func home(scenicID: Int, storeID: Int) async throws -> DroneDockHomeResponse
|
||||
/// 分页读取本人当前景区的全部类型 25 拍摄订单。
|
||||
/// 按履约分类分页读取本人当前景区的类型 25 拍摄订单。
|
||||
@MainActor
|
||||
func orders(scenicID: Int, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse
|
||||
func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse
|
||||
/// 读取本人当前景区当天的成交和确认完成统计。
|
||||
@MainActor
|
||||
func todayStats(scenicID: Int) async throws -> DroneDockHomeToday
|
||||
}
|
||||
|
||||
/// 首页继续读取全部状态;独立订单页显式传递当前筛选。
|
||||
extension DroneDockHomeServing {
|
||||
/// 保留首页的全部订单入口,统一转发到带状态的服务方法。
|
||||
@MainActor
|
||||
func orders(scenicID: Int, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse {
|
||||
try await orders(scenicID: scenicID, status: .all, page: page, pageSize: pageSize)
|
||||
}
|
||||
}
|
||||
|
||||
/// 机巢首页三接口适配,复用统一凭证及业务错误处理,不创建订单或飞行任务。
|
||||
@MainActor
|
||||
final class DroneDockAPI: DroneDockHomeServing {
|
||||
@@ -34,7 +43,7 @@ final class DroneDockAPI: DroneDockHomeServing {
|
||||
}
|
||||
|
||||
/// 张工 orders 由当前登录身份限定归属,不传其他摄影师或门店 ID。
|
||||
func orders(scenicID: Int, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse {
|
||||
func orders(scenicID: Int, status: DroneShootingOrderFilter, page: Int, pageSize: Int) async throws -> DroneDockOrdersResponse {
|
||||
try validateScenic(scenicID)
|
||||
guard page > 0, (1...100).contains(pageSize) else {
|
||||
throw APIError.networkFailed("订单分页参数无效")
|
||||
@@ -42,7 +51,7 @@ final class DroneDockAPI: DroneDockHomeServing {
|
||||
let response: DroneDockOrdersResponse = try await client.send(APIRequest(
|
||||
method: .get, path: orderPrefix + "/orders",
|
||||
queryItems: [URLQueryItem(name: "scenic_id", value: String(scenicID)),
|
||||
URLQueryItem(name: "status", value: "all"),
|
||||
URLQueryItem(name: "status", value: status.apiStatus),
|
||||
URLQueryItem(name: "page", value: String(page)),
|
||||
URLQueryItem(name: "page_size", value: String(pageSize))]
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user