XYPublicAPIManager.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // XYPublicAPIManager.m
  3. // Starbuds
  4. //
  5. // Created by 翟玉磊 on 2019/12/31.
  6. // Copyright © 2019 翟玉磊. All rights reserved.
  7. //
  8. #import "XYPublicAPIManager.h"
  9. /// 搜索用户
  10. static NSString * const COMMON_SEARCH_CONTENT = @"api-common/v1/search/searchContent";
  11. @implementation XYPublicAPIManager
  12. /// 搜索用户
  13. /// @param content 搜索框的值(支持ID、靓号、主播姓名搜索)
  14. /// @param pageNum 当前页码
  15. /// @param pageSize 分页大小
  16. /// @param successHandler 请求成功
  17. /// @param failureHandler 请求失败
  18. - (NSNumber *)searchContentWithContent:(NSString *)content pageNum:(NSInteger)pageNum pageSize:(NSInteger)pageSize successHandler:(ZYLNetworkTaskSuccessHandler)successHandler failureHandler:(ZYLNetworkTaskFailureHandler)failureHandler {
  19. ZYLDataAPIConfiguration *config = [ZYLDataAPIConfiguration new];
  20. config.urlPath = [COMMON_SEARCH_CONTENT copy];
  21. config.instructions = @"搜索用户";
  22. if (pageSize == 0) {
  23. config.requestParameters = @{@"content":content, @"pageNum":@(pageNum)};
  24. }else {
  25. config.requestParameters = @{@"content":content, @"pageNum":@(pageNum), @"pageSize":@(pageSize)};
  26. }
  27. return [super dispatchDataTaskWithConfiguration:config successHandler:successHandler failureHandler:failureHandler];
  28. }
  29. @end