Selaa lähdekoodia

1.分销广告需求

huangxiaodong 1 viikko sitten
vanhempi
commit
e8c4f3c71f

+ 4 - 4
创维盒子/code/AppDelegate/PrefixHeader.pch

@@ -108,8 +108,8 @@ isBangsScreen; \
 //弃用 #define shareService   @"http://testprivacy.phone.armclouding.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //创维盒子 测试地址 正在使用
-//#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
-//#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
+#define CloudService   @"http://testprivacy.phone.androidscloud.com:1801"
+#define shareService   @"http://testprivacy.phone.androidscloud.com:1801/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //预生产环境
 //#define CloudService   @"http://testprivacy.phone.androidscloud.com:10900"
@@ -120,8 +120,8 @@ isBangsScreen; \
 //弃用 #define shareService   @"http://hiboxde.armclouding.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 //生产环境 1.4.3 开始使用
-#define CloudService   @"http://hiboxde.androidscloud.com:7780"
-#define shareService   @"http://hiboxde.androidscloud.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
+//#define CloudService   @"http://hiboxde.androidscloud.com:7780"
+//#define shareService   @"http://hiboxde.androidscloud.com:7780/h5/#/pages/fileSharing/index?productType=Private-X&token="
 
 
 #define AESCODEKEEYY @"fvO8gAfNSr1tbdQe"

+ 2 - 2
创维盒子/code/CloudPlayer/Model/PhoneTimeInfoModel.h

@@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN
 /**
  * @brief  特权信息
  */
-@property(nonatomic, copy)NSArray *privilegeList;
+@property(nonatomic, strong)NSArray *privilegeList;
 
 /**
  * @brief  云机状态( 0:不存在 1:有效时间 2:有效时间不足 3:过期未回收 )
@@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
 
 @interface PhoneTimeInfoDataModel : SuperModel
 
-@property(nonatomic, copy)PhoneTimeInfoModel *data;
+@property(nonatomic, strong)PhoneTimeInfoModel *data;
 
 @end
 

+ 106 - 1
创维盒子/code/mine/mineViewController.m

@@ -22,12 +22,16 @@
 #import "scanToPCLoginViewController.h"
 #import "PCLoginViewController.h"
 #import "cloudPhoneModelViewController.h"
+#import <SDCycleScrollView/SDCycleScrollView.h>
+#import "ADModel.h"
 
-@interface mineViewController ()
+@interface mineViewController ()<SDCycleScrollViewDelegate>
 @property(nonatomic,strong)UIButton *netButton;
 @property(nonatomic,strong)UILabel *snLabel;
 @property(nonatomic,strong)UIButton *snCopyButton;
 @property(nonatomic,strong)MineCommonUsedView *MineCommonUsedV;
+@property (nonatomic,strong) SDCycleScrollView *curScrollView;
+@property (nonatomic,strong) ADModel *curADModel;
 @end
 
 @implementation mineViewController
@@ -48,6 +52,7 @@
     
     
     [self drawAnyView];
+    [self queryOnTheShelfFun];
 }
 
 - (void)drawAnyView{
@@ -160,6 +165,28 @@
     _MineCommonUsedV.didClickButtonFun = ^(NSInteger tag) {
         [weakSelf didClickCommonUsedFunBy:tag];
     };
+    
+    _curScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageURLStringsGroup:nil];
+    _curScrollView.autoScroll = YES;
+    _curScrollView.autoScrollTimeInterval = 5.0;
+    _curScrollView.infiniteLoop = YES;
+    //_curScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
+    //_curScrollView.placeholderImage = [UIImage imageNamed:@"uploadFile_image"];
+    _curScrollView.layer.cornerRadius = 8;
+    _curScrollView.layer.masksToBounds = YES;
+    _curScrollView.delegate = self;
+    [self.view addSubview:_curScrollView];
+    
+    //_curScrollView.backgroundColor = [UIColor blackColor];
+    _curScrollView.hidesForSinglePage = YES;
+    _curScrollView.hidden = YES;
+    
+    [_curScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
+        make.left.mas_equalTo(15);
+        make.right.mas_equalTo(-15);
+        make.top.equalTo(_MineCommonUsedV.mas_bottom).offset(18);
+        make.height.mas_equalTo((SCREEN_W -15*2)*130/343.0);
+    }];
 }
 
 #pragma mark 点击常用模块模块
@@ -727,4 +754,82 @@
     });
 }
 
+#pragma mark  获取分销广告
+- (void)queryOnTheShelfFun{
+    
+    NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
+    
+    NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
+    [paraDict setValue:@"Private-X" forKey:@"productType"];
+    [paraDict setValue:@"IOS" forKey:@"type"];
+    
+    KWeakSelf
+    [[netWorkManager shareInstance] CommonPostCallBackCode:queryOnTheShelf Parameters:paraDict success:^(id  _Nonnull responseObject) {
+        weakSelf.curADModel = [[ADModel alloc] initWithDictionary:responseObject error:nil];
+
+       if (weakSelf.curADModel && weakSelf.curADModel.status == 0) {
+           [weakSelf handleAdUIFun];
+       }
+       else
+       {
+           
+       }
+
+    } failure:^(NSError * _Nonnull error) {
+        
+    }];
+}
+
+#pragma mark 处理广告UI事宜
+- (void)handleAdUIFun
+{
+    _curScrollView.hidden = YES;
+    if (_curADModel && _curADModel.data.count > 0) {
+        
+        NSMutableArray *imgaUrls = [NSMutableArray array];
+        
+        for (ADListModel*listModel in _curADModel.data) {
+            ADImageListModel *imageModel = listModel.pictureVOList.firstObject;
+            
+            if (imageModel.url) {
+                [imgaUrls addObject:imageModel.url];
+            }
+        }
+        
+        if (imgaUrls.count > 0) {
+            _curScrollView.hidden = NO;
+            [_curScrollView setImageURLStringsGroup:imgaUrls];
+        }
+    }
+    
+}
+
+/** 点击图片回调 */
+- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
+{
+    if(index >= _curADModel.data.count){
+        return;
+    }
+    
+    ADListModel*listModel = _curADModel.data[index];
+    NSString *linkAddress = listModel.linkAddress;
+    
+    NSURL *url = [NSURL URLWithString:linkAddress];
+    UIApplication *application = [UIApplication sharedApplication];
+
+    if ([application canOpenURL:url]) {
+        if (@available(iOS 10.0, *)) {
+            [application openURL:url options:@{} completionHandler:^(BOOL success) {
+                if (success) {
+                    //NSLog(@"成功打开浏览器");
+                } else {
+                    //NSLog(@"打开浏览器失败");
+                }
+            }];
+        } else {
+            // iOS 10 之前的方法
+            //[application openURL:url];
+        }
+    }
+}
 @end

+ 34 - 0
创维盒子/code/mine/model/ADModel.h

@@ -0,0 +1,34 @@
+//
+//  ADModel.h
+//  双子星云手机
+//
+//  Created by xd h on 2026/1/8.
+//
+
+#import "SuperModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface ADImageListModel : SuperModel
+@property(nonatomic, copy)NSString *url;
+//@property(nonatomic, copy)NSString *id;
+@end
+
+@protocol ADImageListModel;
+@interface ADListModel : SuperModel
+
+@property(nonatomic, copy)NSString *productType;
+//@property(nonatomic, copy)NSString *status;
+//@property(nonatomic, copy)NSString *id;
+
+@property(nonatomic, copy)NSString *linkAddress;
+@property(nonatomic, copy)NSString *type;
+@property (nonatomic, strong) NSArray<ADImageListModel>* pictureVOList;
+@end
+
+@protocol ADListModel;
+@interface ADModel : SuperModel
+@property (nonatomic, strong) NSArray<ADListModel>* data;
+@end
+
+NS_ASSUME_NONNULL_END

+ 20 - 0
创维盒子/code/mine/model/ADModel.m

@@ -0,0 +1,20 @@
+//
+//  ADModel.m
+//  双子星云手机
+//
+//  Created by xd h on 2026/1/8.
+//
+
+#import "ADModel.h"
+
+@implementation ADImageListModel
+
+@end
+
+@implementation ADListModel
+
+@end
+
+@implementation ADModel
+
+@end

+ 8 - 0
创维盒子/code/netWork/newWorkInterface.h

@@ -198,4 +198,12 @@
  返回数据模型 */
 #define querySwitchButton  @"/box/config/querySwitchButton"
 
+
+/*29 查询广告信息接口接口  POST请求
+ 输入参数     productType 创维盒子:Private-X 隐私盒子:InsiBox
+ 输入参数     type  应用类型(广告位置 安卓=Android,苹果=IOS,H5=H5,PC=Windows,macOS=MAC)
+ 
+ 返回数据模型 */
+#define queryOnTheShelf  @"/box/advertisement/info/queryOnTheShelf"
+
 #endif /* newWorkInterface_h */

+ 20 - 0
创维盒子/双子星云手机.xcodeproj/project.pbxproj

@@ -531,6 +531,10 @@
 		6B49BFC92C943CE800E17406 /* webRtcManager+downloadNasFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B49BFC52C943CE700E17406 /* webRtcManager+downloadNasFile.h */; };
 		6B49BFCA2C943CE800E17406 /* webRtcManager+downloadNasFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B49BFC62C943CE700E17406 /* webRtcManager+downloadNasFile.m */; };
 		6B4A81002CBE5F5C0088DB73 /* WebRTC.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6B8676812C855EDF00F81DFC /* WebRTC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+		6B4AAB3F2F0F903C00C7F8A2 /* ADModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4AAB3D2F0F903C00C7F8A2 /* ADModel.h */; };
+		6B4AAB402F0F903C00C7F8A2 /* ADModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4AAB3E2F0F903C00C7F8A2 /* ADModel.m */; };
+		6B4AAB412F0F903C00C7F8A2 /* ADModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4AAB3E2F0F903C00C7F8A2 /* ADModel.m */; };
+		6B4AAB422F0F903C00C7F8A2 /* ADModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4AAB3D2F0F903C00C7F8A2 /* ADModel.h */; };
 		6B4C0F622C0314BA0070EF2E /* DFPlayerFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4C0F4C2C0314BA0070EF2E /* DFPlayerFileManager.h */; };
 		6B4C0F632C0314BA0070EF2E /* DFPlayerFileManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B4C0F4C2C0314BA0070EF2E /* DFPlayerFileManager.h */; };
 		6B4C0F642C0314BA0070EF2E /* DFPlayerFileManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6B4C0F4D2C0314BA0070EF2E /* DFPlayerFileManager.m */; };
@@ -1954,6 +1958,8 @@
 		6B49BFBA2C90472600E17406 /* webRtcManager+StatisticsReport.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "webRtcManager+StatisticsReport.m"; sourceTree = "<group>"; };
 		6B49BFC52C943CE700E17406 /* webRtcManager+downloadNasFile.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "webRtcManager+downloadNasFile.h"; sourceTree = "<group>"; };
 		6B49BFC62C943CE700E17406 /* webRtcManager+downloadNasFile.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "webRtcManager+downloadNasFile.m"; sourceTree = "<group>"; };
+		6B4AAB3D2F0F903C00C7F8A2 /* ADModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ADModel.h; sourceTree = "<group>"; };
+		6B4AAB3E2F0F903C00C7F8A2 /* ADModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ADModel.m; sourceTree = "<group>"; };
 		6B4B0B692BEF087E00B62C22 /* 隐私保护.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "隐私保护.entitlements"; sourceTree = "<group>"; };
 		6B4B0B6A2BEF16F200B62C22 /* 计算器.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "计算器.entitlements"; sourceTree = "<group>"; };
 		6B4C0F4C2C0314BA0070EF2E /* DFPlayerFileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DFPlayerFileManager.h; sourceTree = "<group>"; };
@@ -3307,6 +3313,15 @@
 			path = resources;
 			sourceTree = "<group>";
 		};
+		6B4AAB3C2F0F8E4900C7F8A2 /* model */ = {
+			isa = PBXGroup;
+			children = (
+				6B4AAB3D2F0F903C00C7F8A2 /* ADModel.h */,
+				6B4AAB3E2F0F903C00C7F8A2 /* ADModel.m */,
+			);
+			path = model;
+			sourceTree = "<group>";
+		};
 		6B4C0F562C0314BA0070EF2E /* supplement */ = {
 			isa = PBXGroup;
 			children = (
@@ -3505,6 +3520,7 @@
 		6B679DF42C25593800D0DC03 /* mine */ = {
 			isa = PBXGroup;
 			children = (
+				6B4AAB3C2F0F8E4900C7F8A2 /* model */,
 				6B679DFB2C255D9900D0DC03 /* view */,
 				6B679DF52C25595700D0DC03 /* mineViewController.h */,
 				6B679DF62C25595700D0DC03 /* mineViewController.m */,
@@ -4268,6 +4284,7 @@
 				6B2C1E842C070ADE00FDCF82 /* ZFPlayer.h in Headers */,
 				6B2C1E3E2C070ADE00FDCF82 /* ZFPortraitControlView.h in Headers */,
 				6B0A75E02C4CA3D300DCB32D /* audioPlayingView.h in Headers */,
+				6B4AAB3F2F0F903C00C7F8A2 /* ADModel.h in Headers */,
 				6B3F963A2AD2AD0B008E349E /* newWorkInterface.h in Headers */,
 				6BDB85B92D573A9C00526D1F /* BoxHeartbeatReStartView.h in Headers */,
 				6B0581B22AFE02B100D37290 /* uploadFileBottomView.h in Headers */,
@@ -4583,6 +4600,7 @@
 				6B2C1E852C070ADE00FDCF82 /* ZFPlayer.h in Headers */,
 				6B2C1E3F2C070ADE00FDCF82 /* ZFPortraitControlView.h in Headers */,
 				6B0A75E22C4CA3D300DCB32D /* audioPlayingView.h in Headers */,
+				6B4AAB422F0F903C00C7F8A2 /* ADModel.h in Headers */,
 				6BD506B02B9576A4006E7CB0 /* newWorkInterface.h in Headers */,
 				6BDB85B72D573A9C00526D1F /* BoxHeartbeatReStartView.h in Headers */,
 				6BD506B12B9576A4006E7CB0 /* uploadFileBottomView.h in Headers */,
@@ -5269,6 +5287,7 @@
 				6BD507622B9576A4006E7CB0 /* iToast.m in Sources */,
 				6B2C1E272C070ADE00FDCF82 /* UIView+ZFFrame.m in Sources */,
 				6BC741492C24097E0049BA8D /* webSocketManager+baseDownload.m in Sources */,
+				6B4AAB412F0F903C00C7F8A2 /* ADModel.m in Sources */,
 				6BD507632B9576A4006E7CB0 /* HWPageListCell.m in Sources */,
 				6BD507642B9576A4006E7CB0 /* downloadFileRecordTableView.m in Sources */,
 				6BD507652B9576A4006E7CB0 /* HWHomeListCell.m in Sources */,
@@ -5666,6 +5685,7 @@
 				A003F6D327D8425C00715CBF /* iToast.m in Sources */,
 				6B2C1E262C070ADE00FDCF82 /* UIView+ZFFrame.m in Sources */,
 				6BC741472C24097E0049BA8D /* webSocketManager+baseDownload.m in Sources */,
+				6B4AAB402F0F903C00C7F8A2 /* ADModel.m in Sources */,
 				A08A94E027E9837600C544BB /* HWPageListCell.m in Sources */,
 				6BED888B2B4E819000F76DDC /* downloadFileRecordTableView.m in Sources */,
 				A084D69827E8657800054880 /* HWHomeListCell.m in Sources */,