feat: update wallet punch point and report success
This commit is contained in:
@ -22,8 +22,41 @@ protocol WalletServing {
|
||||
}
|
||||
|
||||
@MainActor
|
||||
/// 钱包 API,封装邀请奖励记录所需的最小接口集合。
|
||||
final class WalletAPI: WalletServing {
|
||||
/// 钱包页面服务协议,提供钱包首页、提现和积分兑现所需接口。
|
||||
protocol WalletPageServing: WalletServing {
|
||||
/// 获取提现记录列表。
|
||||
func walletWithdrawList(page: Int, pageSize: Int) async throws -> WalletWithdrawListResponse
|
||||
|
||||
/// 获取收益明细分组列表。
|
||||
func earningDetail(
|
||||
startDate: String,
|
||||
endDate: String,
|
||||
page: Int,
|
||||
pageSize: Int
|
||||
) async throws -> EarningDetailResponse
|
||||
|
||||
/// 获取提现申请页信息。
|
||||
func withdrawInfo() async throws -> WithdrawInfoResponse
|
||||
|
||||
/// 发送提现短信验证码。
|
||||
func withdrawSendSMS() async throws
|
||||
|
||||
/// 提交提现申请。
|
||||
func withdrawApply(amount: String, smsCode: String) async throws
|
||||
|
||||
/// 获取积分概览。
|
||||
func pointOverview(staffId: Int) async throws -> PointOverviewResponse
|
||||
|
||||
/// 提交积分提现申请。
|
||||
func pointWithdrawApply(points: Int, remark: String) async throws
|
||||
|
||||
/// 获取积分提现记录。
|
||||
func pointWithdrawList(status: Int?, page: Int, pageSize: Int) async throws -> PointWithdrawListResponse
|
||||
}
|
||||
|
||||
@MainActor
|
||||
/// 钱包 API,封装钱包首页、提现、邀请奖励和积分兑现接口。
|
||||
final class WalletAPI: WalletPageServing {
|
||||
private let client: APIClient
|
||||
|
||||
/// 初始化钱包 API。
|
||||
@ -64,4 +97,105 @@ final class WalletAPI: WalletServing {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取提现记录列表。
|
||||
func walletWithdrawList(page: Int = 1, pageSize: Int = 10) async throws -> WalletWithdrawListResponse {
|
||||
try await client.send(
|
||||
APIRequest(
|
||||
method: .get,
|
||||
path: "/api/yf-handset-app/photog/wallet/withdraw-list",
|
||||
queryItems: [
|
||||
URLQueryItem(name: "page", value: String(max(page, 1))),
|
||||
URLQueryItem(name: "page_size", value: String(max(pageSize, 1))),
|
||||
]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取收益明细分组列表。
|
||||
func earningDetail(
|
||||
startDate: String,
|
||||
endDate: String,
|
||||
page: Int = 1,
|
||||
pageSize: Int = 10
|
||||
) async throws -> EarningDetailResponse {
|
||||
try await client.send(
|
||||
APIRequest(
|
||||
method: .get,
|
||||
path: "/api/yf-handset-app/photog/wallet/earning-detail",
|
||||
queryItems: [
|
||||
URLQueryItem(name: "start_date", value: startDate),
|
||||
URLQueryItem(name: "end_date", value: endDate),
|
||||
URLQueryItem(name: "page", value: String(max(page, 1))),
|
||||
URLQueryItem(name: "page_size", value: String(max(pageSize, 1))),
|
||||
]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取提现申请页信息。
|
||||
func withdrawInfo() async throws -> WithdrawInfoResponse {
|
||||
try await client.send(
|
||||
APIRequest(method: .get, path: "/api/yf-handset-app/photog/wallet/withdraw-info")
|
||||
)
|
||||
}
|
||||
|
||||
/// 发送提现短信验证码。
|
||||
func withdrawSendSMS() async throws {
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/wallet/withdraw-send-sms",
|
||||
body: EmptyPayload()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 提交提现申请。
|
||||
func withdrawApply(amount: String, smsCode: String) async throws {
|
||||
let request = WithdrawApplyRequest(amount: amount, smsCode: smsCode)
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/wallet/withdraw-apply",
|
||||
body: request
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取积分概览。
|
||||
func pointOverview(staffId: Int) async throws -> PointOverviewResponse {
|
||||
try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/point/overview",
|
||||
queryItems: [URLQueryItem(name: "staff_id", value: String(staffId))],
|
||||
body: EmptyPayload()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 提交积分提现申请。
|
||||
func pointWithdrawApply(points: Int, remark: String = "积分提现申请") async throws {
|
||||
let request = PointWithdrawApplyRequest(points: points, remark: remark)
|
||||
let _: EmptyPayload = try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/point/withdraw/apply",
|
||||
body: request
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/// 获取积分提现记录。
|
||||
func pointWithdrawList(status: Int? = nil, page: Int = 1, pageSize: Int = 10) async throws -> PointWithdrawListResponse {
|
||||
let request = PointWithdrawListRequest(status: status, page: max(page, 1), pageSize: max(pageSize, 1))
|
||||
return try await client.send(
|
||||
APIRequest(
|
||||
method: .post,
|
||||
path: "/api/yf-handset-app/photog/point/withdraw/list",
|
||||
body: request
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user