XYWishAPIManager.m 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. //
  2. // XYWishAPIManager.m
  3. // Timi
  4. //
  5. // Created by 翟玉磊 on 2021/10/20.
  6. //
  7. #import "XYWishAPIManager.h"
  8. /// 获取个人许愿列表
  9. static NSString * const WISH_GET_WISH_LIST = @"api-app/v1/rtc/wish/getWishList";
  10. /// 获取个人许愿完成的列表
  11. static NSString * const WISH_GET_WISH_COMPLETE_LIST = @"api-app/v1/rtc/wish/getWishCompleteList";
  12. /// 获取个人开启的许愿任务
  13. static NSString * const WISH_GET_WISH_OPENED_DETAIL = @"api-app/v1/rtc/wish/getWishOpenedDetail";
  14. /// 设置心愿任务开关
  15. static NSString * const WISH_GET_WISH_TASK_SWITCH = @"api-app/v1/rtc/wish/setWishTaskSwitch";
  16. @implementation XYWishAPIManager
  17. /// 获取个人许愿列表
  18. /// @param successHandler 请求成功
  19. /// @param failureHandler 请求失败
  20. - (NSNumber *)getWishListSuccessHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
  21. ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
  22. config.urlPath = [WISH_GET_WISH_LIST copy];
  23. config.instructions = @"获取个人许愿列表";
  24. config.requestType = ZYLNetworkRequestTypeGet;
  25. return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
  26. }
  27. /// 获取个人许愿完成的列表
  28. /// @param successHandler 请求成功
  29. /// @param failureHandler 请求失败
  30. - (NSNumber *)getWishCompleteListWithPage:(NSInteger)page successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
  31. ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
  32. config.urlPath = [WISH_GET_WISH_COMPLETE_LIST copy];
  33. config.instructions = @"获取个人许愿完成的列表";
  34. config.requestType = ZYLNetworkRequestTypeGet;
  35. config.requestParameters = @{@"page":@(page)};
  36. return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
  37. }
  38. /// 获取个人开启的许愿任务
  39. /// @param userId 目标用户ID
  40. /// @param successHandler 请求成功
  41. /// @param failureHandler 请求失败
  42. - (NSNumber *)getWishOpenedDetailWithUserId:(NSString *)userId successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
  43. ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
  44. config.urlPath = [WISH_GET_WISH_OPENED_DETAIL copy];
  45. config.instructions = @"获取个人开启的许愿任务";
  46. config.requestType = ZYLNetworkRequestTypeGet;
  47. config.requestParameters = @{@"userId":userId};
  48. return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
  49. }
  50. /// 设置心愿任务开关
  51. /// @param wishTaskId 许愿任务id
  52. /// @param status 0关 1开
  53. /// @param successHandler 请求成功
  54. /// @param failureHandler 请求失败
  55. - (NSNumber *)setWishTaskSwitchWithWishTaskId:(NSString *)wishTaskId status:(NSInteger)status successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
  56. ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
  57. config.urlPath = [WISH_GET_WISH_TASK_SWITCH copy];
  58. config.instructions = @"设置心愿任务开关";
  59. config.requestParameters = @{@"wishTaskId":wishTaskId, @"status":@(status)};
  60. return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
  61. }
  62. @end