123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536 |
- //
- // XYChatAPIManager.m
- // Starbuds
- //
- // Created by 翟玉磊 on 2020/3/23.
- // Copyright © 2020 翟玉磊. All rights reserved.
- //
- #import "XYChatAPIManager.h"
- /// 发送视频单聊请求
- static NSString * const CHAT_SEND_SINGLE_CHAT_REQUEST = @"api-app/v1/chat/sendSingleChatRequest";
- /// 取消视频单聊请求
- static NSString * const CHAT_CANCEL_SINGLE_CHAT_REQUEST = @"api-app/v1/chat/cancelSingleChatRequest";
- /// 处理视频单聊请求
- static NSString * const CHAT_DECIDE_SINGLE_CHAT_REQUEST = @"api-app/v1/chat/decideSingleChatRequest";
- /// 获取单聊推荐列表
- static NSString * const CHAT_GET_SINGLE_CHAT_SUGGEST_LIST = @"api-app/v1/chat/getSingleChatSuggestList";
- /// 获取单聊主播列表
- static NSString * const CHAT_GET_SINGLE_CHAT_LIST = @"api-app/v1/chat/getSingleChatList";
- /// 中止单聊
- static NSString * const CHAT_STOP_SINGLE_CHAT = @"api-app/v1/chat/stopSingleChat";
- /// 单聊结束评价
- static NSString * const CHAT_EVALUATE_SINGLE_CHAT = @"api-app/v1/chat/evaluateSingleChat";
- /// 获取单聊评价标签
- static NSString * const CHAT_GET_SINGLE_CHAT_EVALUATE_TAGS = @"api-app/v1/config/getSingleChatEvaluateTags";
- /// 随机获取单聊主播列表
- static NSString * const CHAT_GET_SINGLE_CHAT_RANDOM = @"api-app/v1/chat/getSingleChatRandom";
- /// 获取单聊记录详情
- static NSString * const CHAT_GET_SINGLE_CHAT_HIS_INFO = @"api-app/v1/chat/getSingleChatHisInfo";
- /// 刷新单聊提醒
- static NSString * const CHAT_REFRESH_SINGLE_CHAT_REMIND = @"api-app/v1/chat/refreshSingleChatRemind";
- /// 获取单聊主播详情
- static NSString * const CHAT_GET_SINGLE_CHAT_ANCHOR_INFO = @"api-app/v1/chat/getSingleChatAnchorInfo";
- /// 获取关注的单聊主播列表
- static NSString * const CHAT_GET_SINGLE_CHAT_FOLLOW_LIST = @"api-app/v1/chat/getSingleChatFollowList";
- /// vip单聊主播搜索
- static NSString * const CHAT_GET_VIPSINGLE_CHAT_LIST = @"api-app/v1/chat/getVipSingleChatList";
- /// 语音速配-发起
- static NSString * const CHAT_SEND_VOICE_MATCH = @"api-app/v1/chat/sendVoiceMatch";
- /// 语音速配-同意或拒绝
- static NSString * const CHAT_DECIDE_VOICE_MATCH = @"api-app/v1/chat/decideVoiceMatch";
- /// 语音速配-暂停
- static NSString * const CHAT_CANCEL_VOICE_CHAT = @"api-app/v1/chat/cancelVoiceChat";
- /// 语音速配-结束
- static NSString * const CHAT_STOP_VOICE_CHAT = @"api-app/v1/chat/stopVoiceChat";
- /// 语音速配-获取免费时长
- static NSString * const CHAT_GET_VOICE_CHAT_FREE_TIME = @"api-app/v1/chat/getVoiceChatFreeTime";
- /// 语音速配-详情
- static NSString * const CHAT_GET_VOICE_CHAT_DETAIL = @"api-app/v1/chat/getVoiceChatDetail";
- /// 语音速配-获取配置
- static NSString * const CHAT_GET_VOICE_CHAT_CONFIG = @"api-app/v1/chat/getVoiceChatConfig";
- /// 语音速配-获取token
- static NSString * const CHAT_GET_VOICE_CHAT_TOKEN = @"api-app/v1/chat/getVoiceChatToken";
- /// 赠送语音速配礼物
- static NSString * const CHAT_SENDVOICE_GIFT = @"api-app/v1/gift/sendVoiceGift";
- /// 语音速配-列表
- static NSString * const CHAT_GET_VOICE_CHAT_LIST = @"api-app/v1/chat/getVoiceChatList";
- /// 获取匹配成功记录
- static NSString * const CHAT_GET_MATCH_SUCCESS_LIST = @"api-app/v1/chat/getMatchSuccessList";
- /// 获取符合条件用户(头像信息)
- static NSString * const CHAT_GET_MATCH_USER_LIST = @"api-app/v1/chat/getMatchUserList";
- @implementation XYChatAPIManager
- /// 发送视频单聊请求
- /// @param targetUserId 主播 id
- /// @param matchId 主播发起请求的话 需要传
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)sendSingleChatRequest:(NSString *)targetUserId matchId:(NSString *)matchId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_SEND_SINGLE_CHAT_REQUEST copy];
- config.instructions = @"发送视频单聊请求";
- NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
- if (StringIsNotEmpty(targetUserId)) {
- [parameters addEntriesFromDictionary:@{@"targetUserId":targetUserId}];
- }
- if (StringIsNotEmpty(matchId)) {
- [parameters addEntriesFromDictionary:@{@"matchId":matchId}];
- }
- config.requestParameters = parameters;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 取消视频单聊请求
- /// @param hisId 请求记录 id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)cancelSingleChatRequest:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_CANCEL_SINGLE_CHAT_REQUEST copy];
- config.instructions = @"取消视频单聊请求";
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 处理视频单聊请求
- /// @param hisId 请求记录 id
- /// @param decision 1 接受 -1 拒绝
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)decideSingleChatRequest:(NSString *)hisId decision:(NSInteger)decision successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_DECIDE_SINGLE_CHAT_REQUEST copy];
- config.instructions = @"处理视频单聊请求";
- config.requestParameters = @{@"hisId":hisId};
- if (decision) {
- config.requestParameters = @{@"hisId":hisId, @"decision":@(decision)};
- }else {
- config.requestParameters = @{@"hisId":hisId};
- }
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊推荐列表
- /// @param query 暂时不用
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatSuggestListWithQuery:(NSInteger)query successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_SUGGEST_LIST copy];
- config.instructions = @"获取单聊推荐列表";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊主播列表
- /// @param pageIndex 页码
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatListWithPageIndex:(NSInteger)pageIndex successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_LIST copy];
- config.instructions = @"获取单聊主播列表";
- config.requestType = ZYLNetworkRequestTypeGet;
- config.requestParameters = @{@"pageIndex":@(pageIndex)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊主播列表
- /// @param pageIndex 页码
- /// @param userSex 性别筛选
- /// @param categoryId 类目id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatListWithPageIndex:(NSInteger)pageIndex userSex:(NSInteger)userSex categoryId:(NSString *)categoryId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_LIST copy];
- config.instructions = @"获取单聊主播列表";
- config.requestType = ZYLNetworkRequestTypeGet;
- NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
- [parameters addEntriesFromDictionary:@{@"pageIndex":@(pageIndex)}];
- if (userSex != 0) {
- [parameters addEntriesFromDictionary:@{@"userSex":@(userSex)}];
- }
- if (StringIsNotEmpty(categoryId)) {
- [parameters addEntriesFromDictionary:@{@"categoryId":categoryId}];
- }
- config.requestParameters = parameters;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 中止单聊
- /// @param hisId 记录 id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)stopSingleChatWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_STOP_SINGLE_CHAT copy];
- config.instructions = @"中止单聊";
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 单聊结束评价
- /// @param hisId 记录 id
- /// @param scoreValue 评分 1-5
- /// @param tagIds 评价标签id 英文逗号分隔
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)evaluateSingleChatWithhHsId:(NSString *)hisId scoreValue:(NSInteger)scoreValue tagIds:(NSString *)tagIds successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_EVALUATE_SINGLE_CHAT copy];
- config.instructions = @"单聊结束评价";
- if (StringIsEmpty(tagIds)) {
- config.requestParameters = @{@"hisId":hisId, @"scoreValue":@(scoreValue)};
- }else {
- config.requestParameters = @{@"hisId":hisId, @"scoreValue":@(scoreValue), @"tagIds":tagIds};
- }
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊评价标签
- /// @param tagType 标签类型 1 用户标签 2 主播标签
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatEvaluateTagsTagType:(NSInteger)tagType successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_EVALUATE_TAGS copy];
- config.instructions = @"获取单聊评价标签";
- config.requestType = ZYLNetworkRequestTypeGet;
- config.requestParameters = @{@"tagType":@(tagType)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 随机获取单聊主播列表
- /// @param userSex 性别筛选
- /// @param categoryId 类目筛选
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatRandomWithUserSex:(NSInteger)userSex categoryId:(NSString *)categoryId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_RANDOM copy];
- config.instructions = @"随机获取单聊主播列表";
- config.requestType = ZYLNetworkRequestTypeGet;
- NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
- if (userSex) {
- [parameters addEntriesFromDictionary:@{@"userSex":@(userSex)}];
- }
- if (StringIsNotEmpty(categoryId)) {
- [parameters addEntriesFromDictionary:@{@"categoryId":categoryId}];
- }
- config.requestParameters = parameters;
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊记录详情
- /// @param hisId 记录 id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatHisInfoWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_HIS_INFO copy];
- config.instructions = @"获取单聊记录详情";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"hisId":hisId};
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 刷新单聊提醒
- /// @param hisId 记录 id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)refreshSingleChatRemindWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_REFRESH_SINGLE_CHAT_REMIND copy];
- config.instructions = @"刷新单聊提醒";
-
- config.requestParameters = @{@"hisId":hisId};
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取单聊主播详情
- /// @param userId 主播 id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatAnchorInfoWithUserId:(NSString *)userId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_ANCHOR_INFO copy];
- config.instructions = @"获取单聊主播详情";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"userId":userId};
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取关注的单聊主播列表
- /// @param pageIndex 0是不分页 大于0则是分页
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getSingleChatFollowListWithPageIndex:(NSInteger)pageIndex successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_SINGLE_CHAT_FOLLOW_LIST copy];
- config.instructions = @"获取关注的单聊主播列表";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- if (pageIndex > 0) {
- config.requestParameters = @{@"pageIndex":@(pageIndex)};
- }
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// vip单聊主播搜索
- /// @param pageIndex 页码
- /// @param parameters 参数
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVipSingleChatListWithPageIndex:(NSInteger)pageIndex parameters:(NSDictionary *)parameters successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VIPSINGLE_CHAT_LIST copy];
- config.instructions = @"vip单聊主播搜索";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- NSMutableDictionary *tempParameters = [NSMutableDictionary dictionary];
- [tempParameters addEntriesFromDictionary:@{@"pageIndex":@(pageIndex)}];
- if (parameters) {
- [tempParameters addEntriesFromDictionary:parameters];
- }
- config.requestParameters = tempParameters;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-发起
- /// @param userSex 用户性别 1男 2女 0全部
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)sendVoiceMatchWithUserSex:(NSInteger)userSex successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_SEND_VOICE_MATCH copy];
- config.instructions = @"语音速配-发起";
- config.requestParameters = @{@"userSex":@(userSex)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-同意或拒绝
- /// @param hisId 匹配记录id
- /// @param decision 是否同意 1同意 0拒绝
- /// @param round 轮次
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)decideVoiceMatchWithHisId:(NSString *)hisId decision:(NSInteger)decision round:(NSInteger)round successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_DECIDE_VOICE_MATCH copy];
- config.instructions = @"语音速配-同意或拒绝";
-
- config.requestParameters = @{@"hisId":hisId, @"decision":@(decision), @"round":@(round)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-暂停
- /// @param hisId 匹配记录id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)cancelVoiceChatWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_CANCEL_VOICE_CHAT copy];
- config.instructions = @"语音速配-暂停";
-
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-结束
- /// @param hisId 语音速配记录id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)stopVoiceChatWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_STOP_VOICE_CHAT copy];
- config.instructions = @"语音速配-结束";
-
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-获取免费时长
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVoiceChatFreeTimeSuccessHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VOICE_CHAT_FREE_TIME copy];
- config.instructions = @"语音速配-获取免费时长";
-
- config.requestType = ZYLNetworkRequestTypeGet;
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-详情
- /// @param hisId 匹配记录id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVoiceChatDetailWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VOICE_CHAT_DETAIL copy];
- config.instructions = @"语音速配-详情";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-获取配置
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVoiceChatConfigSuccessHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VOICE_CHAT_CONFIG copy];
- config.instructions = @"语音速配-详情";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-获取token
- /// @param hisId 匹配记录id
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVoiceChatTokenWithHisId:(NSString *)hisId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VOICE_CHAT_TOKEN copy];
- config.instructions = @"语音速配-获取token";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"hisId":hisId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- //赠送语音速配礼物
- //Body hisId 语音速配id Long
- //Body userId 收礼物人id Long
- //Body giftId 礼物id Long
- //Body quantity 数量 Integer
- //Body isFromBag 是否来自背包 Boolean
- - (NSNumber *)sendVoiceGift:(NSDictionary *__nullable)paramDict successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler{
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_SENDVOICE_GIFT copy];
- config.instructions = @"赠送语音速配礼物";
- config.requestType = ZYLNetworkRequestTypePost;
-
- config.requestParameters = paramDict;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 语音速配-列表
- /// @param pageIndex 当前页码
- /// @param hisStatus 聊天状态
- /// /** * 呼叫中 */ Ringing(101, "呼叫中"), /** * 通话中 */ Calling(201, "通话中"), /** * 已结束 */ Closed(301, "已结束"), /** * 已取消 */ Canceled(302, "已取消"), /** * 已拒绝 */ Rejected(303, "已拒绝"),
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getVoiceChatListWithPageIndex:(NSInteger)pageIndex hisStatus:(NSInteger)hisStatus successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
-
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_VOICE_CHAT_LIST copy];
- config.instructions = @"语音速配-列表";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- if (hisStatus == 0) {
- config.requestParameters = @{@"pageIndex":@(pageIndex)};
- }else {
- config.requestParameters = @{@"pageIndex":@(pageIndex), @"hisStatus":@(hisStatus)};
- }
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- //获取符合条件用户(头像信息)
- //Query userSex 性别 Integer 1男 2女 0全部
- - (NSNumber *)getMatchUserList:(NSDictionary *__nullable)paramDict successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler{
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_MATCH_USER_LIST copy];
- config.instructions = @"获取符合条件用户(头像信息)";
- config.requestType = ZYLNetworkRequestTypeGet;
- config.requestParameters = paramDict;
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- //获取匹配成功记录
- - (NSNumber *)getMatchSuccessList:(NSDictionary *__nullable)paramDict successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler{
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [CHAT_GET_MATCH_SUCCESS_LIST copy];
- config.instructions = @"获取匹配成功记录";
- config.requestType = ZYLNetworkRequestTypeGet;
- config.requestParameters = paramDict;
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- @end
|