暫無描述

FKCirDetailRequest.m 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. //
  2. // FKCirDetailRequest.m
  3. // FirstLink
  4. //
  5. // Created by jack on 16/6/16.
  6. // Copyright © 2016年 FirstLink. All rights reserved.
  7. //
  8. #import "FKCirDetailRequest.h"
  9. @implementation FKCirDetailRequest
  10. + (void)reqCirDetailWithID:(NSString *)shareId
  11. identify:(int)identify
  12. delegate:(id <FLNetworkDelegate>)delegate{
  13. if (!shareId) return;
  14. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/share/get_share.json", [[FKServerUtil sharedInstance] apiServer]];
  15. NSString *jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"id"]
  16. values:@[shareId]];
  17. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[FLRequestHelper commonParamater]];
  18. [dictM setObject:jsonStr forKey:@"share_json"];
  19. [[FLDataCenter sharedDataCenter] POST:urlString
  20. para:dictM
  21. identify:identify
  22. delegate:delegate];
  23. }
  24. + (void)reqCirRelativeListWithID:(NSString *)shareId
  25. startRow:(NSUInteger)startRow
  26. identify:(int)identify
  27. delegate:(id <FLNetworkDelegate>)delegate{
  28. if (!shareId) return;
  29. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/search/recommend_products_for_share.json", [[FKServerUtil sharedInstance] apiServer]];
  30. NSString *jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"share_id", @"start_row", @"page_size"]
  31. values:@[shareId, @(startRow), @20]];
  32. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[FLRequestHelper commonParamater]];
  33. [dictM setObject:jsonStr forKey:@"recommend_json"];
  34. [[FLDataCenter sharedDataCenter] POST:urlString
  35. para:dictM
  36. identify:identify
  37. delegate:delegate];
  38. }
  39. + (void)reqCommentWithID:(NSString *)shareId
  40. replyToUserID:(NSString *)replyToUserID
  41. content:(NSString *)content
  42. identify:(int)identify
  43. delegate:(id <FLNetworkDelegate>)delegate{
  44. if (!shareId || !content.length) return;
  45. if (content.length > 250){
  46. content = [content substringToIndex:250];
  47. }
  48. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/share_comment/create_share_comment.json", [[FKServerUtil sharedInstance] apiServer]];
  49. NSString *jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"share_id", @"content"]
  50. values:@[shareId, content]];
  51. if (replyToUserID.length){
  52. jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"share_id", @"content", @"reply_to_user_id"]
  53. values:@[shareId, content, replyToUserID]];
  54. }
  55. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[FLRequestHelper commonParamater]];
  56. [dictM setObject:jsonStr forKey:@"share_comment_json"];
  57. [[FLDataCenter sharedDataCenter] POST:urlString
  58. para:dictM
  59. identify:identify
  60. delegate:delegate];
  61. }
  62. + (void)reqRmoveCommentWithID:(NSString *)commentID
  63. identify:(int)identify
  64. delegate:(id <FLNetworkDelegate>)delegate{
  65. if (!commentID) return;
  66. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/share_comment/remove_share_comment.json?id=%@", [[FKServerUtil sharedInstance] apiServer], commentID];
  67. [[FLDataCenter sharedDataCenter] POST:urlString
  68. para:[FLRequestHelper commonParamater]
  69. identify:identify
  70. delegate:delegate];
  71. }
  72. + (void)reqLike:(BOOL)like
  73. identify:(int)identify
  74. itemID:(NSString *)itemID
  75. delegate:(id <FLNetworkDelegate>)delegate{
  76. if (!itemID.length) return;
  77. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/share_like/cancel_share_like.json", [[FKServerUtil sharedInstance] apiServer]];
  78. if (like) {
  79. urlString = [NSString stringWithFormat:@"%@/link-site/api/share_like/create_share_like.json", [[FKServerUtil sharedInstance] apiServer]];
  80. }
  81. NSString *jsonStr = [FLRequestHelper JSONStringWithKeys:@[@"share_id"]
  82. values:@[itemID]];
  83. NSMutableDictionary *dictM = [NSMutableDictionary dictionaryWithDictionary:[FLRequestHelper commonParamater]];
  84. [dictM setObject:jsonStr forKey:@"share_like_json"];
  85. [[FLDataCenter sharedDataCenter] POST:urlString
  86. para:dictM
  87. identify:identify
  88. delegate:delegate];
  89. }
  90. + (void)reqShareUrlWithIdentify:(int)identify
  91. shareID:(NSString *)shareID
  92. deleagate:(id<FLNetworkDelegate>)delegate{
  93. if (!shareID.length) return;
  94. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/share/get_share_url.json", [[FKServerUtil sharedInstance] apiServer]];
  95. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"source", @"object_id"]
  96. values:@[@"5", shareID]];
  97. NSMutableDictionary *para = [NSMutableDictionary dictionary];
  98. [para setValue:itemJson forKey:@"share_json"];
  99. [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  100. [[FLDataCenter sharedDataCenter] POST:urlString para:para identify:identify delegate:delegate];
  101. }
  102. @end