Commit 799f45ae7bae532503abd494a0d8837c5dd421a2

Authored by guoruipeng
1 parent d13bec6b

no message

CNLiveBusinessTools.podspec
... ... @@ -8,7 +8,7 @@
8 8  
9 9 Pod::Spec.new do |s|
10 10 s.name = 'CNLiveBusinessTools'
11   - s.version = '0.1.0'
  11 + s.version = '0.1.1'
12 12 s.summary = '业务工具集合组件.'
13 13  
14 14 # This description is used to generate tags and improve search results.
... ...
CNLiveBusinessTools/Classes/CNLiveBusinessTools.m
... ... @@ -38,26 +38,55 @@
38 38 NSLog(@"event:%@",eventStr);
39 39 return eventStr;
40 40 }
  41 +
41 42 + (NSString *)getUidForStat:(NSDate *)date {
42 43  
43 44 NSString *uid = @"";
  45 + NSString *uidKey = @"kCNLiveUserDefaultsUIDKey";
44 46 NSUserDefaults *defauts = [NSUserDefaults standardUserDefaults];
45   - if ([defauts objectForKey:@"kCNLiveUserDefaultsStatUIDKey"]) {
46   - uid = [[defauts objectForKey:@"kCNLiveUserDefaultsStatUIDKey"] copy];
  47 + if ([defauts objectForKey:uidKey]) {
  48 + uid = [[defauts objectForKey:uidKey] copy];
47 49 return uid;
48 50 }
49 51 else {
50 52  
51   - NSString *idfv = @"";
52   - if ([defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"]) {
53   - idfv = [[defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"] copy];
54   - } else {
55   - idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""];
56   - }
57   - NSString *stamp = [NSString stringWithFormat:@"%.3f", [date timeIntervalSince1970]];
  53 + NSInteger time = [[NSDate date] timeIntervalSince1970];
  54 + NSString *timeString = [NSString stringWithFormat:@"%ld", (long)time];
  55 + NSString *stamp = timeString;
58 56 stamp = [stamp stringByReplacingOccurrencesOfString:@"." withString:@""];
  57 + NSString *idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""];
59 58 uid = [NSString stringWithFormat:@"%@_%@", idfv, stamp];
60   - [defauts setObject:uid forKey:@"kCNLiveUserDefaultsStatUIDKey"];
  59 + [defauts setObject:uid forKey:uidKey];
  60 + [defauts synchronize];
  61 + return uid;
  62 + }
  63 +}
  64 +
  65 ++ (NSString *)uuid{
  66 + NSString *uid = @"";
  67 + NSString *uidKey = @"kCNLiveUserDefaultsUIDKey";
  68 + NSUserDefaults *defauts = [NSUserDefaults standardUserDefaults];
  69 + if ([defauts objectForKey:uidKey]) {
  70 + uid = [[defauts objectForKey:uidKey] copy];
  71 + return uid;
  72 + } else {
  73 + NSString *idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""];
  74 + [defauts setObject:idfv forKey:uidKey];
  75 + [defauts synchronize];
  76 + return uid;
  77 + }
  78 +}
  79 +
  80 +
  81 ++ (NSString *)tingyunUUID{
  82 + NSString *uid = @"";
  83 + NSUserDefaults *defauts = [NSUserDefaults standardUserDefaults];
  84 + if ([defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"]) {
  85 + uid = [[defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"] copy];
  86 + return uid;
  87 + } else {
  88 + NSString *idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""];
  89 + [defauts setObject:idfv forKey:@"kCNLiveUserDefaultsTingYunUIDKey"];
61 90 [defauts synchronize];
62 91 }
63 92 return uid;
... ... @@ -266,7 +295,7 @@
266 295 }
267 296 + (NSString *)getSidIdfv
268 297 {
269   - NSString *idfv = [self uuid];
  298 + NSString *idfv = [self tingyunUUID];
270 299 NSString *uid = @"";
271 300 if ([CNUserShareManager isLogin]) {
272 301 uid = CNUserShareModel.uid;
... ... @@ -276,19 +305,7 @@
276 305 return sidIdfv;
277 306 }
278 307  
279   -+ (NSString *)uuid{
280   - NSString *uid = @"";
281   - NSUserDefaults *defauts = [NSUserDefaults standardUserDefaults];
282   - if ([defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"]) {
283   - uid = [[defauts objectForKey:@"kCNLiveUserDefaultsTingYunUIDKey"] copy];
284   - return uid;
285   - } else {
286   - NSString *idfv = [[[[UIDevice currentDevice] identifierForVendor] UUIDString] stringByReplacingOccurrencesOfString:@"-" withString:@""];
287   - [defauts setObject:idfv forKey:@"kCNLiveUserDefaultsTingYunUIDKey"];
288   - [defauts synchronize];
289   - }
290   - return uid;
291   -}
  308 +
292 309  
293 310 + (NSMutableDictionary *)encryptionSignWithParameter:(NSMutableDictionary *)parameter encryptionKey:(NSString *)encryptionKey
294 311 {
... ...