123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- //
- // FKRecommendRequest.m
- // FirstLink
- //
- // Created by jack on 15/12/8.
- // Copyright © 2015年 FirstLink. All rights reserved.
- //
- #import "FKRecommendRequest.h"
- const int REC_INITIAL_DATA_REQ = 110;
- const int REC_MORE_DATA_REQ = 111;
- const int REC_TAB_PAGE_REQ = 112;
- const int REC_REQUEST_ACTIVITY_URL = 113;
- const int REC_SIGN_STATE = 114;
- const int REC_DYNAMIC_MESSAGE = 115;
- const int REC_POINT_MESSAGE = 116;
- const int REC_BOOK_BRAND_INFO = 117;
- const int REC_RANDOM_BRAND = 118;
- const int REC_SCAN_DATA_REQ = 120;
- const int REC_USER_DATA_REQ = 121;
- const int REC_ACTIVITY_SHARE = 122;
- const int REC_PROMOTION_INFO = 123;
- @implementation FKRecommendRequest
- + (void)requestTabPagesWithIdentify:(int)identify delegate:(id<FLNetworkDelegate>)delegate{
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/tab_page/find_tab_pages.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:[FLRequestHelper commonParamater]
- identify:identify
- delegate:delegate];
- }
- + (void)requestRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate{
-
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_index_datas_new.json", [[FKServerUtil sharedInstance] apiServer]];
- NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
- values:@[@(0), @(PAGE_RECORD_COUNT)]];
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- [dictM setValue:itemJson forKey:@"product_json"];
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_INITIAL_DATA_REQ delegate:delegate];
- }
- + (void)requestUserRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate {
- if ([FKUserManager isUserLogin]) {
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/recommend/find_recommend_products.json", [[FKServerUtil sharedInstance] apiServer]];
- NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
- values:@[@(0), @(PAGE_RECORD_COUNT)]];
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- [dictM setValue:itemJson forKey:@"recommend_json"];
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_USER_DATA_REQ delegate:delegate];
- }
- }
- + (void)requestScanRecommendDataWithDelegate:(id<FLNetworkDelegate>)delegate {
- if ([FKUserManager isUserLogin]) {
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_recommend_products.json", [[FKServerUtil sharedInstance] apiServer]];
- NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size"]
- values:@[@(0), @(PAGE_RECORD_COUNT)]];
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- [dictM setValue:itemJson forKey:@"product_json"];
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_SCAN_DATA_REQ delegate:delegate];
- }
- }
- + (void)requestRandomBrandWithDelegate:(id<FLNetworkDelegate>)delegate{
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_random_brands.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:urlString para:[FLRequestHelper commonParamater] identify:REC_RANDOM_BRAND delegate:delegate];
- }
- + (void)requestActivityShareWithDelegate:(id<FLNetworkDelegate>)delegate {
- NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"type", @"ts", @"start_row", @"page_size"]
- values:@[@(2), @(1), @(0), @(2)]];
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- [dictM setValue:itemJson forKey:@"activity_share_json"];
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/activity_share/find_activity_shares.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_ACTIVITY_SHARE delegate:delegate];
- }
- + (void)requestPromotionInfoWithDelegate:(id<FLNetworkDelegate>)delegate {
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/home/find_blocks.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:urlString para:[FLRequestHelper commonParamater] identify:REC_PROMOTION_INFO delegate:delegate];
- }
- + (void)requestMoreDataWithStartRow:(NSUInteger)startRow
- updateTime:(NSString *)updateTime
- delegate:(id<FLNetworkDelegate>)delegate{
-
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/product/find_index_datas_new.json", [[FKServerUtil sharedInstance] apiServer]];
- NSString *itemJson = [FLRequestHelper JSONStringWithKeys:@[@"start_row", @"page_size", @"update_time"]
- values:@[@(startRow), @(PAGE_RECORD_COUNT), [FLStringHelper replaceNilWithEmpty:updateTime]]];
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- [dictM setValue:itemJson forKey:@"product_json"];
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:REC_MORE_DATA_REQ delegate:delegate];
- }
- + (void)requestActivityURL:(int)identify deleagate:(id<FLNetworkDelegate>)delegate {
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/initconf.json", [[FKServerUtil sharedInstance] apiServer]];
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:[FLRequestHelper commonParamater]
- identify:identify
- delegate:delegate];
- }
- + (void)requestSignState:(int)identify deleagate:(id<FLNetworkDelegate>)delegate{
-
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_score/get_user_score_by_sign.json", [[FKServerUtil sharedInstance] apiServer]];
-
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:[FLRequestHelper commonParamater]
- identify:identify
- delegate:delegate];
- }
- + (void)requestPointMessage:(int)identify
- delegate:(id<FLNetworkDelegate>)delegate{
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/user_score/get_share_user_score.json", [[FKServerUtil sharedInstance] apiServer]];
-
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:[FLRequestHelper commonParamater]
- identify:identify
- delegate:delegate];
- }
- + (void)requestBookInfoWithServeTime:(NSString *)serveTime
- identify:(int)identify
- deleagate:(id<FLNetworkDelegate>)delegate{
-
- NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/subscribe/subscribe_message.json", [[FKServerUtil sharedInstance] apiServer]];
-
- NSString *itemJson = nil;
- if ([FLStringHelper isValidString:serveTime]){
- itemJson = [FLRequestHelper JSONStringWithKeys:@[@"last_time"]
- values:@[serveTime]];
- }
-
- NSMutableDictionary *dictM = [NSMutableDictionary dictionary];
- if (itemJson){
- [dictM setValue:itemJson forKey:@"subscribe_json"];
- }
-
- [dictM addEntriesFromDictionary:[FLRequestHelper commonParamater]];
-
- [[FLDataCenter sharedDataCenter] POST:urlString para:dictM identify:identify delegate:delegate];
-
- }
- + (void)requestDynamicMsgWithIdentify:(int)identify deleagate:(id<FLNetworkDelegate>)delegate{
- NSString *URLString = [NSString stringWithFormat:@"%@/link-site/api/cash_coupon/find_messages.json", [[FKServerUtil sharedInstance] apiServer]];
-
- [[FLDataCenter sharedDataCenter] POST:URLString
- para:[FLRequestHelper commonParamater]
- identify:identify
- delegate:delegate];
- }
- + (void)requestBehavior:(NSString *)areaName objType:(NSString *)objType objID:(NSString *)objID positionV1:(NSString *)v1 positionV2:(NSString *)v2 {
- [BehaviorTrackManger requestBehavior:@"index"
- areaName:areaName
- objType:objType
- objID:objID
- positionV1:v1
- positionV2:v2];
- }
- @end
|