RQHTTPService+RQSaveBetchFavQuestion.m 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //
  2. // RQHTTPService+RQSaveBetchFavQuestion.m
  3. // jiaPei
  4. //
  5. // Created by 张嵘 on 2022/8/25.
  6. // Copyright © 2022 JCZ. All rights reserved.
  7. //
  8. #import "RQHTTPService+RQSaveBetchFavQuestion.h"
  9. @implementation RQHTTPService (RQSaveBetchFavQuestion)
  10. /**
  11. 新增题目记录
  12. @param questionId 题目ID
  13. @param type 1是收藏,2是错题,3是排除的题
  14. @return Returns a signal which will send complete, or error.
  15. */
  16. - (RACSignal *)saveBetchFavQuestionWithQuestionId:(NSInteger)questionId type:(RQSaveFavQuestionType)type {
  17. /// 1. 配置参数
  18. RQKeyedSubscript *subscript = [RQKeyedSubscript subscript];
  19. NSString *pinStr = [NSString stringWithFormat:@"%ld,%@;",questionId,(RQ_YDTQuestion_Module.subject == RQHomePageSubjectType_SubjectFour)? @"4" : @"1"];
  20. if (type == RQSaveFavQuestionType_Collect) {
  21. subscript[@"favArr"] = pinStr;
  22. subscript[@"wrongArr"] = @"";
  23. } else if (type == RQSaveFavQuestionType_Wrong) {
  24. subscript[@"favArr"] = @"";
  25. subscript[@"wrongArr"] = pinStr;
  26. }
  27. subscript[@"pcArr"] = @"";
  28. subscript[@"user"] = RQObjectIsNil(RQ_USER_MANAGER.currentUser._id)? @0 : RQ_USER_MANAGER.currentUser._id;
  29. subscript[@"carType"] = RQ_YDTQuestion_Module.car_type;
  30. /// 2. 配置参数模型
  31. RQURLParameters *paramters = [RQURLParameters urlParametersWithMethod:RQ_HTTTP_METHOD_POST path:RQ_POST_SaveBetchFavQuestion parameters:subscript.dictionary];
  32. /// 3.发起请求
  33. return [[[RQHTTPRequest requestWithParameters:paramters]
  34. enqueueResultClass:RQBaseModel.class]
  35. rq_parsedResults];
  36. }
  37. @end