Nav apraksta

BehaviorTrackManger.m 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // BehaviorTrackManger.m
  3. // FirstLink
  4. //
  5. // Created by jack on 15/7/23.
  6. // Copyright (c) 2015年 FirstLink. All rights reserved.
  7. //
  8. #import "BehaviorTrackManger.h"
  9. @implementation BehaviorTrackManger
  10. + (void)requestBehaviorType:(kBehaviorType)type jsonString:(NSString *)jsonString{
  11. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/pvc/create_pvc.json", [[FKServerUtil sharedInstance] apiServer]];
  12. NSMutableDictionary *para = [NSMutableDictionary dictionary];
  13. [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  14. NSString *dictJson;
  15. if (jsonString && jsonString.length > 0){
  16. dictJson = [FLRequestHelper JSONStringWithKeys:@[@"biz_json", @"code"] values:@[jsonString, [NSString stringWithFormat:@"%lu", (unsigned long)type]]];
  17. } else {
  18. dictJson = [FLRequestHelper JSONStringWithKeys:@[@"code"] values:@[[NSString stringWithFormat:@"%lu", (unsigned long)type]]];
  19. }
  20. [para setValue:dictJson forKey:@"pvc_json"];
  21. [[FLDataCenter sharedDataCenter] POST:urlString parameters:para success:^(MSGHeader *header, id responseObject) {
  22. if (header.code.intValue == RESPONSE_MSG_NORMAL) {
  23. }
  24. } failure:^(MSGHeader *header, NSError *error) {
  25. }];
  26. }
  27. + (void)requestBehavior:(NSString *)pageName
  28. areaName:(NSString *)areaName
  29. objType:(NSString *)objType
  30. objID:(NSString *)objID
  31. positionV1:(NSString *)v1
  32. positionV2:(NSString *)v2 {
  33. NSString *urlString = [NSString stringWithFormat:@"%@/link-site/api/pvc/track_index_click.json", [[FKServerUtil sharedInstance] apiServer]];
  34. NSMutableDictionary *para = [NSMutableDictionary dictionary];
  35. [para addEntriesFromDictionary:[FLRequestHelper commonParamater]];
  36. NSArray *keys = @[@"page", @"area_alias", @"object_type", @"object_id", @"object_position_lv1", @"object_position_lv2"];
  37. NSArray *values = @[[FLStringHelper replaceNilWithEmpty:pageName],
  38. [FLStringHelper replaceNilWithEmpty:areaName],
  39. [FLStringHelper replaceNilWithEmpty:objType],
  40. [FLStringHelper replaceNilWithEmpty:objID],
  41. [FLStringHelper replaceNilWithEmpty:v1],
  42. [FLStringHelper replaceNilWithEmpty:v2]];
  43. NSString *string = [FLRequestHelper JSONStringWithKeys:keys
  44. values:values];
  45. [para setValue:string forKey:@"post_json"];
  46. [[FLDataCenter sharedDataCenter] POST:urlString parameters:para success:^(MSGHeader *header, id responseObject) {
  47. if (header.code.intValue == RESPONSE_MSG_NORMAL) {
  48. }
  49. } failure:^(MSGHeader *header, NSError *error) {
  50. }];
  51. }
  52. @end