1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- //
- // XYWishAPIManager.m
- // Timi
- //
- // Created by 翟玉磊 on 2021/10/20.
- //
- #import "XYWishAPIManager.h"
- /// 获取个人许愿列表
- static NSString * const WISH_GET_WISH_LIST = @"api-app/v1/rtc/wish/getWishList";
- /// 获取个人许愿完成的列表
- static NSString * const WISH_GET_WISH_COMPLETE_LIST = @"api-app/v1/rtc/wish/getWishCompleteList";
- /// 获取个人开启的许愿任务
- static NSString * const WISH_GET_WISH_OPENED_DETAIL = @"api-app/v1/rtc/wish/getWishOpenedDetail";
- /// 设置心愿任务开关
- static NSString * const WISH_GET_WISH_TASK_SWITCH = @"api-app/v1/rtc/wish/setWishTaskSwitch";
- @implementation XYWishAPIManager
- /// 获取个人许愿列表
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getWishListSuccessHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [WISH_GET_WISH_LIST copy];
- config.instructions = @"获取个人许愿列表";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取个人许愿完成的列表
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getWishCompleteListWithPage:(NSInteger)page successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [WISH_GET_WISH_COMPLETE_LIST copy];
- config.instructions = @"获取个人许愿完成的列表";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"page":@(page)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 获取个人开启的许愿任务
- /// @param userId 目标用户ID
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)getWishOpenedDetailWithUserId:(NSString *)userId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [WISH_GET_WISH_OPENED_DETAIL copy];
- config.instructions = @"获取个人开启的许愿任务";
- config.requestType = ZYLNetworkRequestTypeGet;
-
- config.requestParameters = @{@"userId":userId};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- /// 设置心愿任务开关
- /// @param wishTaskId 许愿任务id
- /// @param status 0关 1开
- /// @param successHandler 请求成功
- /// @param failureHandler 请求失败
- - (NSNumber *)setWishTaskSwitchWithWishTaskId:(NSString *)wishTaskId status:(NSInteger)status successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
- ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
- config.urlPath = [WISH_GET_WISH_TASK_SWITCH copy];
- config.instructions = @"设置心愿任务开关";
-
- config.requestParameters = @{@"wishTaskId":wishTaskId, @"status":@(status)};
-
- return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
- }
- @end
|