浏览代码

消息红点

apple 6 年之前
父节点
当前提交
cf9814b2ce

二进制
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate


+ 28 - 0
ios/JianYuIOS/JianYuIOS.xcworkspace/xcuserdata/apple.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,4 +2,32 @@
 <Bucket
 <Bucket
    type = "0"
    type = "0"
    version = "2.0">
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            scope = "0"
+            stopOnStyle = "0">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "JianYuIOS/Classes&#xff08;&#x6a21;&#x5757;&#xff09;/JYSearchViewController.m"
+            timestampString = "568790720.323967"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "176"
+            endingLineNumber = "176"
+            landmarkName = "-newsRedPoint:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>
 </Bucket>

+ 73 - 67
ios/JianYuIOS/JianYuIOS/AppDelegate.m

@@ -232,35 +232,35 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
         NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
         NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
         if (info[@"url"]) {
         if (info[@"url"]) {
             
             
-            if (userInfo[@"type"] && ![userInfo[@"type"] isEqualToString:@""]) {
-                [temp setObject:userInfo[@"type"] forKey:@"type"];
-            }
-            
-            
-            NSString *pushTime = info[@"pushTime"];
-            if (pushTime && ![pushTime isEqualToString:@""]) {
-                
-                if (![[LXDataBaseManager shareDataBaseManager] returnPushTime:info[@"pushTime"] inTable:kNewsTable]) {
-                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
-                }
-                [[LXDataBaseManager shareDataBaseManager] changeReadedWithPushTime:info[@"pushTime"]];
-                if (!info[@"type"] || [info[@"type"] isEqualToString:@""]) {
-                    NSString *ids = [[LXDataBaseManager shareDataBaseManager] returnID:info[@"pushTime"] inTable:kNewsTable];
-                    if (ids) {
-                        [temp setObject:[NSString stringWithFormat:@"%@%@", info[@"url"], ids] forKey:@"url"];
-                    }
-                }
-            }else{
-                
-                if (![[LXDataBaseManager shareDataBaseManager] returnURL:info[@"url"] openid:info[@"openid"] inTable:kNewsTable]) {
-                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
-                }
-                [[LXDataBaseManager shareDataBaseManager] changeReadedWithURL:info[@"url"] openid:info[@"openid"]];
-                NSString *ids = [[LXDataBaseManager shareDataBaseManager] returnIDWithUrl:info[@"url"] openid:info[@"openid"] inTable:kNewsTable];
-                if (ids) {
-                    [temp setObject:[NSString stringWithFormat:@"%@%@", info[@"url"], ids] forKey:@"url"];
-                }
-            }
+//            if (userInfo[@"type"] && ![userInfo[@"type"] isEqualToString:@""]) {
+//                [temp setObject:userInfo[@"type"] forKey:@"type"];
+//            }
+//
+//
+//            NSString *pushTime = info[@"pushTime"];
+//            if (pushTime && ![pushTime isEqualToString:@""]) {
+//
+//                if (![[LXDataBaseManager shareDataBaseManager] returnPushTime:info[@"pushTime"] inTable:kNewsTable]) {
+////                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
+//                }
+//                [[LXDataBaseManager shareDataBaseManager] changeReadedWithPushTime:info[@"pushTime"]];
+//                if (!info[@"type"] || [info[@"type"] isEqualToString:@""]) {
+//                    NSString *ids = [[LXDataBaseManager shareDataBaseManager] returnID:info[@"pushTime"] inTable:kNewsTable];
+//                    if (ids) {
+//                        [temp setObject:[NSString stringWithFormat:@"%@%@", info[@"url"], ids] forKey:@"url"];
+//                    }
+//                }
+//            }else{
+//
+//                if (![[LXDataBaseManager shareDataBaseManager] returnURL:info[@"url"] openid:info[@"openid"] inTable:kNewsTable]) {
+////                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
+//                }
+//                [[LXDataBaseManager shareDataBaseManager] changeReadedWithURL:info[@"url"] openid:info[@"openid"]];
+//                NSString *ids = [[LXDataBaseManager shareDataBaseManager] returnIDWithUrl:info[@"url"] openid:info[@"openid"] inTable:kNewsTable];
+//                if (ids) {
+//                    [temp setObject:[NSString stringWithFormat:@"%@%@", info[@"url"], ids] forKey:@"url"];
+//                }
+//            }
             
             
             // 跳转到该链接
             // 跳转到该链接
             [[NSNotificationCenter defaultCenter] postNotificationName:kRequestWebViewWithUrl object:temp userInfo:nil];
             [[NSNotificationCenter defaultCenter] postNotificationName:kRequestWebViewWithUrl object:temp userInfo:nil];
@@ -271,10 +271,10 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
                 self.wakeUpBool = NO;
                 self.wakeUpBool = NO;
             }
             }
             
             
-            
-             if([info[@"type"] isEqualToString:@"message"]) {
+            NSLog(@"%@",info);
+             if([userInfo[@"type"] isEqualToString:@"message"]) {
                  
                  
-                 [[LXDataBaseManager shareDataBaseManager] changeCatagoryTypeWithURL:info[@"url"]];
+                 [[LXDataBaseManager shareDataBaseManager] changeCatagoryTypeWithURL:userInfo[@"url"]];
                  
                  
                  NSDictionary * infoDic;
                  NSDictionary * infoDic;
                  if(self.wakeUpBool) {
                  if(self.wakeUpBool) {
@@ -338,42 +338,42 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
     NSLog(@"info--新消息%@",info);
     NSLog(@"info--新消息%@",info);
     if (info ) {
     if (info ) {
         if (info[@"url"]) {
         if (info[@"url"]) {
-            NSString *pushTime = info[@"pushTime"];
-            if (pushTime && ![pushTime isEqualToString:@""]) {
-                
-                if (![[LXDataBaseManager shareDataBaseManager] returnPushTime:info[@"pushTime"] inTable:kNewsTable]) {
-                    NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
-                    if (userInfo[@"type"]) {
-                        [temp setObject:userInfo[@"type"] forKey:@"type"];
-                    }
-                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
-                }
-            }
-            else{
-                
-                if([info[@"type"] isEqualToString:@"message"]) {
-                    NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
-                    if (userInfo[@"type"]) {
-                        [temp setObject:userInfo[@"type"] forKey:@"type"];
-                    }
-                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
-                }else {
-                    if (![[LXDataBaseManager shareDataBaseManager] returnURL:info[@"url"] openid:info[@"openid"] inTable:kNewsTable]) {
-                        NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
-                        if (userInfo[@"type"]) {
-                            [temp setObject:userInfo[@"type"] forKey:@"type"];
-                        }
-                        [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
-                    }
-                }
-
-            }
+//            NSString *pushTime = info[@"pushTime"];
+//            if (pushTime && ![pushTime isEqualToString:@""]) {
+//
+//                if (![[LXDataBaseManager shareDataBaseManager] returnPushTime:info[@"pushTime"] inTable:kNewsTable]) {
+//                    NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
+//                    if (userInfo[@"type"]) {
+//                        [temp setObject:userInfo[@"type"] forKey:@"type"];
+//                    }
+////                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
+//                }
+//            }
+//            else{
+//
+//                if([info[@"type"] isEqualToString:@"message"]) {
+//                    NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
+//                    if (userInfo[@"type"]) {
+//                        [temp setObject:userInfo[@"type"] forKey:@"type"];
+//                    }
+////                    [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
+//                }else {
+//                    if (![[LXDataBaseManager shareDataBaseManager] returnURL:info[@"url"] openid:info[@"openid"] inTable:kNewsTable]) {
+//                        NSMutableDictionary *temp = [NSMutableDictionary dictionaryWithDictionary:info];
+//                        if (userInfo[@"type"]) {
+//                            [temp setObject:userInfo[@"type"] forKey:@"type"];
+//                        }
+////                        [[LXDataBaseManager shareDataBaseManager] insertMessage:temp toTable:kNewsTable];
+//                    }
+//                }
+//
+//            }
             
             
             [[NSNotificationCenter defaultCenter] postNotificationName:kAfterReceiveNewMsg object:nil];
             [[NSNotificationCenter defaultCenter] postNotificationName:kAfterReceiveNewMsg object:nil];
             
             
             
             
 //
 //
-            if([info[@"type"] isEqualToString:@"message"]) {
+            if([userInfo[@"type"] isEqualToString:@"message"]) {
             
             
                 NSDictionary * infoDic = @{@"url":info[@"url"],
                 NSDictionary * infoDic = @{@"url":info[@"url"],
                                            @"rectype":@"D",
                                            @"rectype":@"D",
@@ -392,13 +392,19 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
 
 
             }
             }
             
             
-            if([info[@"type"] isEqualToString:@"bid"]) {
+            if([userInfo[@"type"] isEqualToString:@"bid"]) {
                 //收到订阅推送,展示红点
                 //收到订阅推送,展示红点
-                [[NSNotificationCenter defaultCenter] postNotificationName:JYNewsRedPoint object:nil userInfo:@{@"type":@"1",@"typeMsg":info[@"type"]}];
+                NSLog(@"收到订阅推送");
+                [[NSNotificationCenter defaultCenter] postNotificationName:JYNewsRedPoint object:nil userInfo:@{@"type":@"1",@"typeMsg":userInfo[@"type"],@"url":info[@"url"]}];
+            }else {
+                NSLog(@"不是订阅推送");
             }
             }
-            if([info[@"type"] isEqualToString:@"message"]||[info[@"type"] isEqualToString:@"feedback"]||[info[@"type"] isEqualToString:@"project"]||[info[@"type"] isEqualToString:@"entname"]) {
+            if([userInfo[@"type"] isEqualToString:@"message"]||[userInfo[@"type"] isEqualToString:@"feedback"]||[userInfo[@"type"] isEqualToString:@"project"]||[userInfo[@"type"] isEqualToString:@"entname"]) {
+                NSLog(@"收到我的推送");
                 //收到我的推送,展示红点
                 //收到我的推送,展示红点
-                [[NSNotificationCenter defaultCenter] postNotificationName:JYNewsRedPoint object:nil userInfo:@{@"type":@"2",@"typeMsg":info[@"type"]}];
+                [[NSNotificationCenter defaultCenter] postNotificationName:JYNewsRedPoint object:nil userInfo:@{@"type":@"2",@"typeMsg":userInfo[@"type"],@"url":info[@"url"]}];
+            }else {
+                NSLog(@"不是订阅推送");
             }
             }
             
             
         }
         }

+ 8 - 2
ios/JianYuIOS/JianYuIOS/BaseClass1/LXNetworkManager.m

@@ -32,7 +32,10 @@ progress:(void (^)(NSProgress * progress))upProgress
     manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"application/json",@"image/png",@"application/pdf",@"image/jpeg", @"application/octet-stream",@"text/json", nil];
     manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"application/json",@"image/png",@"application/pdf",@"image/jpeg", @"application/octet-stream",@"text/json", nil];
     
     
     [manager POST:urlstr parameters:parameters progress:upProgress success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
     [manager POST:urlstr parameters:parameters progress:upProgress success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
-        success(responseObject);
+//        success(responseObject);
+        NSError *error=nil;
+        id Object=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:&error];
+        success(Object);
     } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
     } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
         LXLog(@"afn post request error:%@",error);
         LXLog(@"afn post request error:%@",error);
         failure(error);
         failure(error);
@@ -50,7 +53,10 @@ progress:(void (^)(NSProgress * progress))upProgress
     manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"application/json", nil];
     manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", @"application/json", nil];
     [manager GET:urlstr parameters:parameters progress:upProgress success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
     [manager GET:urlstr parameters:parameters progress:upProgress success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
         //回传成功
         //回传成功
-        success(responseObject);
+//        success(responseObject);
+        NSError *error=nil;
+        id Object=[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableLeaves error:&error];
+        success(Object);
     } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
     } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
         //回传失败
         //回传失败
         LXLog(@"afn get request error:%@", error);
         LXLog(@"afn get request error:%@", error);

+ 2 - 2
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYMineViewController.m

@@ -935,8 +935,8 @@ NSString *const AesKey_3 = @"mGlAgnIBB8bx2nch";
     NSDictionary *data = @{ @"appId":@"wx0e6a5b18f4cfd10d",
     NSDictionary *data = @{ @"appId":@"wx0e6a5b18f4cfd10d",
                             @"nonceStr":@"ZMZqGVibnrQSGlmq",
                             @"nonceStr":@"ZMZqGVibnrQSGlmq",
                             @"partnerid":@"1513535801",
                             @"partnerid":@"1513535801",
-                        @"paySign":@"046AFF278351BD5B685F153057B61CF9",
-                        @"prepay_id":@"wx241022000493643eb8db09901655699181",
+                            @"paySign":@"046AFF278351BD5B685F153057B61CF9",
+                            @"prepay_id":@"wx241022000493643eb8db09901655699181",
                             @"timeStamp":@"1543026120",
                             @"timeStamp":@"1543026120",
                             };
                             };
     
     

+ 4 - 3
ios/JianYuIOS/JianYuIOS/Classes(模块)/JYSearchViewController.m

@@ -157,6 +157,7 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
 -(void)newsRedPoint:(NSNotification *)notificaition
 -(void)newsRedPoint:(NSNotification *)notificaition
 {
 {
     NSDictionary *dict = notificaition.userInfo;
     NSDictionary *dict = notificaition.userInfo;
+    NSLog(@"%@",dict);
     NSInteger type = [dict[@"type"] integerValue];
     NSInteger type = [dict[@"type"] integerValue];
     if(type==1) {
     if(type==1) {
         //显示
         //显示
@@ -172,7 +173,7 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
         
         
     }
     }
     
     
-    NSString *textJS =  [NSString stringWithFormat:@"afterReceivePushMessage('%@')",dict[@"typeMsg"]];
+    NSString *textJS =  [NSString stringWithFormat:@"afterReceivePushMessage('%@','%@')",dict[@"typeMsg"],@""];
     JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
     JSContext *context = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
     [context evaluateScript:textJS];
     [context evaluateScript:textJS];
 }
 }
@@ -186,7 +187,7 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
         } success:^(id responseObject) {
         } success:^(id responseObject) {
             NSLog(@"responseObject=%@",responseObject);
             NSLog(@"responseObject=%@",responseObject);
             
             
-            if([responseObject[@"subscribe"] integerValue]==1) {
+            if([responseObject[@"subscribe"] integerValue]>=1) {
                 //显示
                 //显示
                 kMainQueue(^{
                 kMainQueue(^{
                     [self.tabBarController.tabBar showBadgeOnItemIndex:1];
                     [self.tabBarController.tabBar showBadgeOnItemIndex:1];
@@ -197,7 +198,7 @@ NSString *const AesKey_0 = @"mGlAgnIBB8bx2nch";
                 });
                 });
             }
             }
             
             
-            if([responseObject[@"my"] integerValue]==1) {
+            if([responseObject[@"my"] integerValue]>=1) {
                 //显示
                 //显示
                 kMainQueue(^{
                 kMainQueue(^{
                     [self.tabBarController.tabBar showBadgeOnItemIndex:3];
                     [self.tabBarController.tabBar showBadgeOnItemIndex:3];