| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- //
- // MOHttpManager.swift
- // MiMoLive
- //
- // Created by OneeChan on 2025/9/28.
- //
- import Foundation
- // MARK: =========== About PK V2 ============
- //PK-连线-结算
- let kNetPath_Code_PkV2Settle = "/live/pk/v2/settlement"
- //PK-连线-查询pk-连线房间信息
- let kNetPath_Code_PkV2RoomInfo = "/live/pk/v2/room/info"
- //PK-连线 - 匹配
- let kNetPath_Code_PkV2Match = "/live/pk/v2/match"
- //PK-连线-连线转PK
- let kNetPath_Code_PkV2LinkToPk = "/live/pk/v2/link_to_pk"
- //PK-连线-设置
- let kNetPath_Code_PkV2ConfigSet = "/live/pk/v2/link/config/set"
- //PK-连线-设置查询
- let kNetPath_Code_PkV2ConfigGet = "/live/pk/v2/link/config/get"
- //PK-连线-关闭连线-入参:pk连线房间id
- let kNetPath_Code_PkV2LinkClose = "/live/pk/v2/link/close"
- //PK-连线-邀请 - 发送邀请-参数是房间id
- let kNetPath_Code_PkV2InviteSend = "/live/pk/v2/invite/send"
- //PK-连线-邀请 - 列表
- let kNetPath_Code_PkV2InviteList = "/live/pk/v2/invite/list"
- //PK-连线-邀请 - 处理邀请
- let kNetPath_Code_PkV2InviteHandler = "/live/pk/v2/invite/handler"
- //PK-连线 - PK贡献榜
- let kNetPath_Code_PKV2Contribute = "/live/pk/v2/contribute"
- //PK-连线 - PK历史记录
- let kNetPath_Code_PKV2History = "/live/pk/v2/record"
- // PK-连线-清理连线数值
- let kNetPath_PkV2ClearBean = "/live/pk/v2/link/clean/value"
- // PK-连线- 连线中房主设置
- let kNetPath_PkV2SetLineConfig = "/live/pk/v2/link/ing/set"
- // PK-连线-关闭pk-投降
- let kNetPath_PkV2Surrender = "/live/pk/v2/surrender"
- // PK-连线 - 声音控制
- let kNetPath_PkV2SoundControl = "/live/pk/v2/sound/control"
- // MARK: About PK V2
- extension MOHttpManager {
- /// PK-连线-查询pk-连线房间信息
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func getLineRoomInfo(_ roomId: String, handler: @escaping (MOLivePkLinkRoomInfoVo?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2RoomInfo, params: ["id": roomId], handler: handler)
- }
- /// PK-连线 - 匹配
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func matchLine(_ roomId: String, _ lineType: LineType, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2Match, params: ["roomId": roomId, "matchType": lineType.rawValue, "cancel": false], handler: handler)
- }
- func cancelMatch(_ roomId: String, _ lineType: LineType, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2Match, params: ["roomId": roomId, "matchType": lineType.rawValue, "cancel": true], handler: handler)
- }
- /// PK-连线-连线转PK
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func startPk(_ lineRoomId: String, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2LinkToPk, params: ["id": lineRoomId], handler: handler)
- }
-
- /// PK-连线-设置查询
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func getLinePkConfig(handler: @escaping (MOLivePkLinkConfigVo?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2ConfigGet, params: [:], handler: handler)
- }
- /// PK-连线-设置
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func updateLinePkConfig(duration: Int, canAcceptPk: Bool,
- magnifyMySelf: Bool, canAcceptLink: Bool,
- handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2ConfigSet,
- params: [
- "duration": duration,
- "canAcceptPk": canAcceptPk,
- "magnifyMySelf": magnifyMySelf,
- "canAcceptLink": canAcceptLink
- ],
- handler: handler)
- }
- /// PK-连线-关闭连线-入参:pk连线房间id
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func closeLine(_ lineRoomId: String, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2LinkClose, params: ["id": lineRoomId], handler: handler)
- }
- /// PK-连线-邀请 - 发送邀请-参数是房间id
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func inviteLine(_ roomId: String, _ peerRoomId: String, _ lineType: LineType, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2InviteSend, params: ["roomId": roomId, "toRoomId": peerRoomId, "type": lineType.rawValue], handler: handler)
- }
- /// PK-连线-邀请 - 列表
- func getLineInviteList(next: String, size: Int, searchKey: String,
- handler: @escaping (MONextVOLivePkLinkInviteVO?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2InviteList,
- params: ["type": 2, "searchKey": searchKey, "page": ["next": next, "size": size]],
- handler: handler)
- }
- func getLinePkInviteList(next: String, size: Int, searchKey: String,
- handler: @escaping (MONextVOLivePkLinkInviteVO?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2InviteList,
- params: ["type": 1, "searchKey": searchKey, "page": ["next": next, "size": size]],
- handler: handler)
- }
-
- /// PK-连线-邀请 - 处理邀请
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func responseLineInvite(_ inviteId: String, _ accept: Bool, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2InviteHandler, params: ["inviteId": inviteId, "agree": accept], handler: handler)
- }
-
- /// PK-连线-PK贡献榜
- func getLinePkContributeList(_ campCode: String, _ next: String, _ size: Int, handler: @escaping (MOLivePkContributeVO?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PKV2Contribute,
- params: ["campCode": campCode, "page": ["next": next, "size": size]],
- handler: handler)
- }
-
- /// PK-连线-结算
- /// - Parameters:
- /// - params: 参数
- /// - block: 回调
- func settlePk(_ linkRoomId: String, _ pkMatchId: String, handler: @escaping (MORtmPkV2Status?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PkV2Settle, params: ["pkLinkRoomId": linkRoomId, "pkMatchId": pkMatchId], handler: handler)
- }
-
- /// PK-连线- PK历史记录
- func getLinePkHistory(historyType: LinePkHistoryType, next: String, size: Int, handler: @escaping (MONextVOLivePkV2RecordVo?, String?) -> Void) {
- sendPostRequest(path: kNetPath_Code_PKV2History,
- params: ["type": historyType.rawValue, "page": ["next": next, "size": size]],
- handler: handler)
- }
-
- /// PK-连线-清理连线数值
- func cleanLineRoomBeans(_ linkRoomId: String, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_PkV2ClearBean, params: ["id": linkRoomId], handler: handler)
- }
-
- /// PK-连线- 连线中房主设置
- func updateLineRoomConfig(_ lineRoomId: String, showValue: Bool,
- allowJoin: Bool, allowInvite: Bool,
- handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_PkV2SetLineConfig,
- params: [
- "pkLinkRoomId": lineRoomId,
- "showValue": showValue,
- "allowJoin": allowJoin,
- "allowInvite": allowInvite
- ],
- handler: handler)
- }
-
- /// PK-连线-关闭pk-投降
- func surrenderPk(_ pkMatchId: String, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_PkV2Surrender, params: ["id": pkMatchId], handler: handler)
- }
-
- /// PK-连线 - 声音控制
- func updateSoundControl(_ lineRoomId: String, userIds: [String], mute: Bool, forAll: Bool, handler: @escaping (String?) -> Void) {
- sendPostRequest(path: kNetPath_PkV2SoundControl,
- params: [
- "pkLinkRoomId": lineRoomId,
- "userIds": userIds,
- "mute": mute,
- "forAll": forAll
- ],
- handler: handler)
- }
- }
|