Geen omschrijving

FKRecommendRequest.m 9.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. //
  2. // FKRecommendRequest.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/12/8.
  6. // Copyright © 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "FKRecommendRequest.h"
  9. const int REC_INITIAL_DATA_REQ = 110;
  10. const int REC_MORE_DATA_REQ = 111;
  11. const int REC_TAB_PAGE_REQ = 112;
  12. const int REC_REQUEST_ACTIVITY_URL = 113;
  13. const int REC_SIGN_STATE = 114;
  14. const int REC_DYNAMIC_MESSAGE = 115;
  15. const int REC_POINT_MESSAGE = 116;
  16. const int REC_BOOK_BRAND_INFO = 117;
  17. const int REC_RANDOM_BRAND = 118;
  18. const int REC_SCAN_DATA_REQ = 120;
  19. const int REC_USER_DATA_REQ = 121;
  20. const int REC_ACTIVITY_SHARE = 122;
  21. const int REC_PROMOTION_INFO = 123;
  22. @implementation FKRecommendRequest
  23. + (void)requestTabPagesWithIdentify:(int)identify delegate:(id<FLNetworkDelegate>)delegate{
  24. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/tab_page/find_tab_pages.json", [[FKServerUtil sharedInstance] apiServer]];
  25. [[FLDataCenter sharedDataCenter] POST:URLString
  26. para:[FLRequestHelper commonParamater]
  27. identify:identify
  28. delegate:delegate];
  29. }
  30. + (void)requestRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate{
  31. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_index_datas_new.json", [[FKServerUtil sharedInstance] apiServer]];
  32. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
  33. values:@[@(0), @(PAGE_RECORD_COUNT)]];
  34. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  35. [dictM setValue:itemJson forKey:@"product_json"];
  36. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  37. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_INITIAL_DATA_REQ delegate:delegate];
  38. }
  39. + (void)requestUserRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate {
  40. if ([FKUserManager isUserLogin]) {
  41. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/recommend/find_recommend_products.json", [[FKServerUtil sharedInstance] apiServer]];
  42. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
  43. values:@[@(0), @(PAGE_RECORD_COUNT)]];
  44. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  45. [dictM setValue:itemJson forKey:@"recommend_json"];
  46. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  47. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_USER_DATA_REQ delegate:delegate];
  48. }
  49. }
  50. + (void)requestScanRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate {
  51. if ([FKUserManager isUserLogin]) {
  52. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_recommend_products.json", [[FKServerUtil sharedInstance] apiServer]];
  53. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
  54. values:@[@(0), @(PAGE_RECORD_COUNT)]];
  55. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  56. [dictM setValue:itemJson forKey:@"product_json"];
  57. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  58. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_SCAN_DATA_REQ delegate:delegate];
  59. }
  60. }
  61. + (void)requestRandomBrandWithDelegate:(id<FLNetworkDelegate>)delegate{
  62. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_random_brands.json", [[FKServerUtil sharedInstance] apiServer]];
  63. [[FLDataCenter sharedDataCenter] POST:urlString para:[FLRequestHelper commonParamater] identify:REC_RANDOM_BRAND delegate:delegate];
  64. }
  65. + (void)requestActivityShareWithDelegate:(id<FLNetworkDelegate>)delegate {
  66. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"type", @"ts", @"start_row", @"page_size"]
  67. values:@[@(2), @(1), @(0), @(2)]];
  68. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  69. [dictM setValue:itemJson forKey:@"activity_share_json"];
  70. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  71. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/activity_share/find_activity_shares.json", [[FKServerUtil sharedInstance] apiServer]];
  72. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_ACTIVITY_SHARE delegate:delegate];
  73. }
  74. + (void)requestPromotionInfoWithDelegate:(id<FLNetworkDelegate>)delegate {
  75. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/home/find_blocks.json", [[FKServerUtil sharedInstance] apiServer]];
  76. [[FLDataCenter sharedDataCenter] POST:urlString para:[FLRequestHelper commonParamater] identify:REC_PROMOTION_INFO delegate:delegate];
  77. }
  78. + (void)requestMoreDataWithStartRow:(NSUInteger)startRow
  79. updateTime:(NSString *)updateTime
  80. delegate:(id<FLNetworkDelegate>)delegate{
  81. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_index_datas_new.json", [[FKServerUtil sharedInstance] apiServer]];
  82. NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size", @"update_time"]
  83. values:@[@(startRow), @(PAGE_RECORD_COUNT), [FLStringHelper replaceNilWithEmpty:updateTime]]];
  84. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  85. [dictM setValue:itemJson forKey:@"product_json"];
  86. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  87. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_MORE_DATA_REQ delegate:delegate];
  88. }
  89. + (void)requestActivityURL:(int)identify deleagate:(id<FLNetworkDelegate>)delegate {
  90. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/initconf.json", [[FKServerUtil sharedInstance] apiServer]];
  91. [[FLDataCenter sharedDataCenter] POST:URLString
  92. para:[FLRequestHelper commonParamater]
  93. identify:identify
  94. delegate:delegate];
  95. }
  96. + (void)requestSignState:(int)identify deleagate:(id<FLNetworkDelegate>)delegate{
  97. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_score/get_user_score_by_sign.json", [[FKServerUtil sharedInstance] apiServer]];
  98. [[FLDataCenter sharedDataCenter] POST:URLString
  99. para:[FLRequestHelper commonParamater]
  100. identify:identify
  101. delegate:delegate];
  102. }
  103. + (void)requestPointMessage:(int)identify
  104. delegate:(id<FLNetworkDelegate>)delegate{
  105. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_score/get_share_user_score.json", [[FKServerUtil sharedInstance] apiServer]];
  106. [[FLDataCenter sharedDataCenter] POST:URLString
  107. para:[FLRequestHelper commonParamater]
  108. identify:identify
  109. delegate:delegate];
  110. }
  111. + (void)requestBookInfoWithServeTime:(NSString *)serveTime
  112. identify:(int)identify
  113. deleagate:(id<FLNetworkDelegate>)delegate{
  114. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/subscribe/subscribe_message.json", [[FKServerUtil sharedInstance] apiServer]];
  115. NSString *itemJson = nil;
  116. if ([FLStringHelper isValidString:serveTime]){
  117. itemJson = [FLRequestHelper JSONStringWithKeys:@[@"last_time"]
  118. values:@[serveTime]];
  119. }
  120. NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
  121. if (itemJson){
  122. [dictM setValue:itemJson forKey:@"subscribe_json"];
  123. }
  124. [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  125. [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:identify delegate:delegate];
  126. }
  127. + (void)requestDynamicMsgWithIdentify:(int)identify deleagate:(id<FLNetworkDelegate>)delegate{
  128. NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/cash_coupon/find_messages.json", [[FKServerUtil sharedInstance] apiServer]];
  129. [[FLDataCenter sharedDataCenter] POST:URLString
  130. para:[FLRequestHelper commonParamater]
  131. identify:identify
  132. delegate:delegate];
  133. }
  134. + (void)requestBehavior:(NSString *)areaName objType:(NSString *)objType objID:(NSString *)objID positionV1:(NSString *)v1 positionV2:(NSString *)v2 {
  135. [BehaviorTrackManger requestBehavior:@"index"
  136. areaName:areaName
  137. objType:objType
  138. objID:objID
  139. positionV1:v1
  140. positionV2:v2];
  141. }
  142. @end