xiongzhu 7 vuotta sitten
vanhempi
commit
081ee30d9b

+ 4 - 4
model/Classes/Controllers/AboutUsVC/AboutUsViewController.m

@@ -84,7 +84,7 @@
     UIButton *telButton = [[UIButton alloc] init];
     telButton.layer.cornerRadius = 5;
     telButton.backgroundColor = [UIColor whiteColor];
-    [telButton setTitle:@"客服电话:15805170379" forState:UIControlStateNormal];
+    [telButton setTitle:@"客服电话:17768144625" forState:UIControlStateNormal];
     [telButton setTitleColor:RGB(51, 51, 51) forState:UIControlStateNormal];
     [telButton setImage:[UIImage imageNamed:@"youjiantou"] forState:UIControlStateNormal];
     [telButton setTitleEdgeInsets:UIEdgeInsetsMake(5, 10, 5, ScreenWidth - 200)];
@@ -147,16 +147,16 @@
 
 - (void)clickTel {
 
-    NSString *PhoneStr = [NSString stringWithFormat:@"tel://%@", @"15805170379"];
+    NSString *PhoneStr = [NSString stringWithFormat:@"tel://%@", @"17768144625"];
     UIApplication *app = [UIApplication sharedApplication];
     if ([app canOpenURL:[NSURL URLWithString:PhoneStr]]) {
         [app openURL:[NSURL URLWithString:PhoneStr]];
     }
 
-//    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"联系客服\n15805170379" message: nil preferredStyle:UIAlertControllerStyleAlert];
+//    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"联系客服\n17768144625" message: nil preferredStyle:UIAlertControllerStyleAlert];
 //    // 添加按钮
 //    [alert addAction:[UIAlertAction actionWithTitle:@"呼叫" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-//        NSString* PhoneStr = [NSString stringWithFormat:@"tel://%@",@"15805170379"];
+//        NSString* PhoneStr = [NSString stringWithFormat:@"tel://%@",@"17768144625"];
 //        UIApplication * app = [UIApplication sharedApplication];
 //        if ([app canOpenURL:[NSURL URLWithString:PhoneStr]]) {
 //            [app openURL:[NSURL URLWithString:PhoneStr]];

+ 2 - 1
model/Classes/Public/AdViewController.m

@@ -129,6 +129,7 @@
     }];
 
     self.label = [[UILabel alloc] init];
+    self.label.textAlignment = NSTextAlignmentCenter;
     [self.view addSubview:self.label];
     [self.label mas_makeConstraints:^(MASConstraintMaker *make) {
         make.left.equalTo(self.view).offset(25);
@@ -169,7 +170,7 @@
     [cancelBtn setTitleColor:[UIColor colorWithHexString:@"#8F9294"] forState:UIControlStateNormal];
     [cancelBtn addTarget:self action:@selector(dismiss) forControlEvents:UIControlEventTouchUpInside];
 
-    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", imageURl, self.model[@"Pic"]]];
+    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", imageURl, self.model[@"banner"]]];
     [self.img sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"jiazai"]];
     self.label.text = self.model[@"Caption"];
 }

+ 33 - 28
model/Classes/Public/ModelRootViewController.m

@@ -19,6 +19,7 @@
 
 @interface ModelRootViewController () <NIMSystemNotificationManagerDelegate, NIMConversationManagerDelegate>
 @property(nonatomic, assign) NSInteger sessionUnreadCount;
+@property(nonatomic, assign) BOOL showAd;
 @end
 
 @implementation ModelRootViewController {
@@ -45,6 +46,7 @@
     [self setupViewController:[[PrivateSpaceViewController alloc] init] andTag:1 andTitle:@"" andSelectImg:@"faxian" andImg:@"faxian"];
     [self setupViewController:[[MineNewViewController alloc] init] andTag:2 andTitle:@"我的" andSelectImg:@"wode2" andImg:@"wode1"];
     self.selectedIndex = 2;
+    self.showAd = YES;
 }
 
 - (void)viewDidAppear:(BOOL)animated {
@@ -98,37 +100,40 @@
 }
 
 - (void)getTopActivity {
-    [[AHHttpManager sharedManager]
-            POST:[NSString
-                    stringWithFormat:@"%@/activity?action=dogettoppartty", PublicUrl]
-      parameters:nil
-         success:^(id responseObject) {
-             if ([[responseObject objectForKey:@"msg"] isEqualToString:@"success"]) {
-                 NSArray *data = responseObject[@"data"];
-                 for (NSUInteger i = 0; i < data.count; ++i) {
-                     long beg = MIN([data[i][@"SBeg"] longValue], [data[i][@"Beg"] longValue]);
-                     long end = MAX([data[i][@"Sendt"] longValue], [data[i][@"Endt"] longValue]);
-                     NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0];
-                     NSTimeInterval time = [date timeIntervalSince1970] * 1000;
-                     if (time >= beg && time <= end) {
-                         AdViewController *adViewController = [[AdViewController alloc] init];
-                         adViewController.model = data[i];
-                         adViewController.callback = ^(void) {
-                             WebViewController *webVC = [[WebViewController alloc] init];
-                             webVC.url = data[i][@"url"];
-                             webVC.activityPK = data[i][@"PK"];
-                             webVC.hidesBottomBarWhenPushed = YES;
-                             [(UINavigationController *) self.selectedViewController pushViewController:webVC animated:YES];
-                         };
-                         [self presentViewController:adViewController animated:YES completion:nil];
-                         return;
+    if (self.showAd) {
+        self.showAd = NO;
+        [[AHHttpManager sharedManager]
+                POST:[NSString
+                        stringWithFormat:@"%@/activity?action=dogettoppartty", PublicUrl]
+          parameters:nil
+             success:^(id responseObject) {
+                 if ([[responseObject objectForKey:@"msg"] isEqualToString:@"success"]) {
+                     NSArray *data = responseObject[@"data"];
+                     for (NSUInteger i = 0; i < data.count; ++i) {
+                         long beg = MIN([data[i][@"SBeg"] longValue], [data[i][@"Beg"] longValue]);
+                         long end = MAX([data[i][@"Sendt"] longValue], [data[i][@"Endt"] longValue]);
+                         NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0];
+                         NSTimeInterval time = [date timeIntervalSince1970] * 1000;
+                         if (time >= beg && time <= end) {
+                             AdViewController *adViewController = [[AdViewController alloc] init];
+                             adViewController.model = data[i];
+                             adViewController.callback = ^(void) {
+                                 WebViewController *webVC = [[WebViewController alloc] init];
+                                 webVC.url = data[i][@"url"];
+                                 webVC.activityPK = data[i][@"PK"];
+                                 webVC.hidesBottomBarWhenPushed = YES;
+                                 [(UINavigationController *) self.selectedViewController pushViewController:webVC animated:YES];
+                             };
+                             [self presentViewController:adViewController animated:YES completion:nil];
+                             return;
+                         }
                      }
                  }
              }
-         }
-         failure:^(NSError *error) {
-             NSLog(@"error = %@", error);
-         }];
+             failure:^(NSError *error) {
+                 NSLog(@"error = %@", error);
+             }];
+    }
 }
 
 - (void)setupViewController:(UIViewController *)controller andTag:(NSInteger)tag andTitle:(NSString *)title andSelectImg:(NSString *)selectImg andImg:(NSString *)img {

+ 18 - 3
model/Classes/Public/WebViewController.m

@@ -16,7 +16,7 @@
 #import "UIImage+Common.h"
 #import "ModelFansViewController.h"
 
-@interface WebViewController () <ShareDelegate, WKUIDelegate, WKScriptMessageHandler>
+@interface WebViewController () <ShareDelegate, WKUIDelegate, WKScriptMessageHandler, WKNavigationDelegate>
 @property(nonatomic, strong) WKWebView *webView;
 @end
 
@@ -41,13 +41,14 @@
         make.bottom.equalTo(self.mas_bottomLayoutGuide);
     }];
     webView.UIDelegate = self;
+    webView.navigationDelegate = self;
     [[webView configuration].userContentController addScriptMessageHandler:[[WeakScriptMessageDelegate alloc] initWithDelegate:self] name:@"chmo"];
 
     [webView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
     if ([self.url containsString:@"?"]) {
-        [NSString stringWithFormat:@"%@&memberpk=%@&activitypk=%@", self.url, [Helper sharedAccount].accid, self.activityPK];
+        [NSString stringWithFormat:@"%@&memberpk=%@&activitypk=%@", self.url, [ModelUser user].pk, self.activityPK];
     } else {
-        self.url = [NSString stringWithFormat:@"%@?memberpk=%@&activitypk=%@", self.url, [Helper sharedAccount].accid, self.activityPK];
+        self.url = [NSString stringWithFormat:@"%@?memberpk=%@&activitypk=%@", self.url, [ModelUser user].pk, self.activityPK];
     }
     if (self.modelPK) {
         self.url = [self.url stringByAppendingFormat:@"&modelpk=%@", self.modelPK];
@@ -93,7 +94,21 @@
     } else {
         [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
     }
+}
 
+- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
+    if ([@"tel" isEqualToString:navigationAction.request.URL.scheme]) {
+        if (@available(iOS 10.0, *)) {
+            [[UIApplication sharedApplication] openURL:navigationAction.request.URL options:@{} completionHandler:nil];
+        } else {
+            if (![[UIApplication sharedApplication] canOpenURL:navigationAction.request.URL]) {
+                [[UIApplication sharedApplication] openURL:navigationAction.request.URL];
+            }
+        }
+        decisionHandler(WKNavigationActionPolicyCancel);
+    } else {
+        decisionHandler(WKNavigationActionPolicyAllow);
+    }
 }
 
 - (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {

+ 1 - 1
model/Info.plist

@@ -44,7 +44,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2</string>
+	<string>3</string>
 	<key>ITSAppUsesNonExemptEncryption</key>
 	<false/>
 	<key>LSApplicationCategoryType</key>