摄像头分享和二维码生成规则修改
This commit is contained in:
parent
9b266aea7b
commit
aff0f33ec6
|
|
@ -220,7 +220,7 @@ alpha:1.0]
|
||||||
#define kShareDevice [NSString stringWithFormat:@"app.ifish7.com/api/user/shareDevice.do",JIEKOUPORT]
|
#define kShareDevice [NSString stringWithFormat:@"app.ifish7.com/api/user/shareDevice.do",JIEKOUPORT]
|
||||||
|
|
||||||
// 扫一扫分享设备 已最新
|
// 扫一扫分享设备 已最新
|
||||||
#define kshareDeviceByQrCode [NSString stringWithFormat:@"%@/api/users/sharingDevice/",JIEKOUPORT]
|
#define kshareDeviceByQrCode [NSString stringWithFormat:@"%@/api/user/shareDeviceByQrCode.do",JIEKOUPORT]
|
||||||
|
|
||||||
// 解除分享的设备
|
// 解除分享的设备
|
||||||
#define kdeleteShareDevice [NSString stringWithFormat:@"%@/api/user/deleteShareDevice.do",JIEKOUPORT]
|
#define kdeleteShareDevice [NSString stringWithFormat:@"%@/api/user/deleteShareDevice.do",JIEKOUPORT]
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#import "IfishNewsModel.h"
|
#import "IfishNewsModel.h"
|
||||||
#import "IfishHotBarVc.h"
|
#import "IfishHotBarVc.h"
|
||||||
#import "Xuanduo2fController.h"
|
#import "Xuanduo2fController.h"
|
||||||
|
#import "IfishP2PMonitorController.h"
|
||||||
|
|
||||||
@implementation IfishDataUnity
|
@implementation IfishDataUnity
|
||||||
|
|
||||||
|
|
@ -48,15 +49,57 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
if (dataDic[@"cameraId"])
|
||||||
|
{
|
||||||
|
IfishCameraModel *camera=[[IfishCameraModel alloc] initWithDict:dataDic];
|
||||||
|
[deviceArry insertObject:camera atIndex:0];
|
||||||
|
[[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"cameraArr"];
|
||||||
|
if (scanVC)
|
||||||
|
{
|
||||||
|
[scanVC dismissViewControllerAnimated:YES completion:^{
|
||||||
|
IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init];
|
||||||
|
p2pVC.contact = camera;
|
||||||
|
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:p2pVC];
|
||||||
|
UIApplication*app=[UIApplication sharedApplication];
|
||||||
|
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||||
|
app1.window.rootViewController=nav;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IfishP2PMonitorController *p2pVC=[[IfishP2PMonitorController alloc] init];
|
||||||
|
p2pVC.contact = camera;
|
||||||
|
UINavigationController *nav=[[UINavigationController alloc] initWithRootViewController:p2pVC];
|
||||||
|
UIApplication*app=[UIApplication sharedApplication];
|
||||||
|
AppDelegate*app1=(AppDelegate*)app.delegate;
|
||||||
|
app1.window.rootViewController=nav;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DeviceModel*devicemodel=[[DeviceModel alloc]initWithDict:dataDic];
|
||||||
|
//设备
|
||||||
|
[deviceArry insertObject:devicemodel atIndex:0];
|
||||||
|
|
||||||
|
[[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"deviceInfo"];
|
||||||
|
|
||||||
|
if ([devicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
|
||||||
|
NSMutableDictionary*petStores=[[DataCenter defaultDtacenter] valueForKey:@"petStores"];
|
||||||
|
for (NSMutableArray*array in petStores.allValues) {
|
||||||
|
|
||||||
|
|
||||||
|
[array insertObject:devicemodel atIndex:0];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[DataCenter defaultDtacenter]setValue:petStores forKey:@"petStores"];
|
||||||
|
[[DataCenter defaultDtacenter].cache setString:devicemodel.macAddress forKey:@"currentPetDevice"];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[self initAppCenterVcWith:devicemodel addWithdissMisVc:scanVC];
|
||||||
|
}
|
||||||
|
|
||||||
DeviceModel*devicemodel=[[DeviceModel alloc]initWithDict:dataDic];
|
|
||||||
//设备
|
|
||||||
[deviceArry insertObject:devicemodel atIndex:0];
|
|
||||||
|
|
||||||
[[DataCenter defaultDtacenter]setValue:deviceArry forKey:@"deviceInfo"];
|
|
||||||
|
|
||||||
|
|
||||||
[self initAppCenterVcWith:devicemodel addWithdissMisVc:scanVC];
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ static NSString *setTimerflag = @"SetTimerCell";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@" %d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn];
|
[cell configTitleLabel:@"循环开关" timer:[NSString stringWithFormat:@"持续时长 %d分钟",[dataContorl hexToTen:model.lastTime]] switchStatus:isOn];
|
||||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ Strong UIImage *screenShotImage;//截图
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
title=@"水族城";
|
title=@"水族箱";
|
||||||
}
|
}
|
||||||
|
|
||||||
[seg initleftTitle:@"摄像头" addRightTitle:title isSelectStyle:YES];
|
[seg initleftTitle:@"摄像头" addRightTitle:title isSelectStyle:YES];
|
||||||
|
|
@ -1060,7 +1060,7 @@ Strong UIImage *screenShotImage;//截图
|
||||||
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||||
[paragraphStyle setLineSpacing:12];
|
[paragraphStyle setLineSpacing:12];
|
||||||
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])];
|
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [title length])];
|
||||||
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(9,4)];
|
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithRed:0 green:170.0/255.0 blue:218.0/255.0 alpha:1] range:NSMakeRange(13,4)];
|
||||||
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,13)];
|
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange(0,13)];
|
||||||
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)];
|
[attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor] range:NSMakeRange([title length]-1,1)];
|
||||||
[notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal];
|
[notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal];
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,15 @@
|
||||||
if ([self.erdevicemodel.deviceId isKindOfClass:[NSNumber class]]) {
|
if ([self.erdevicemodel.deviceId isKindOfClass:[NSNumber class]]) {
|
||||||
self.erdevicemodel.deviceId=[NSString stringWithFormat:@"%ld",self.erdevicemodel.deviceId.integerValue];
|
self.erdevicemodel.deviceId=[NSString stringWithFormat:@"%ld",self.erdevicemodel.deviceId.integerValue];
|
||||||
}
|
}
|
||||||
NSString*str=[NSString stringWithFormat:@"deviceId=%@",self.erdevicemodel.deviceId.length?self.erdevicemodel.deviceId:[CommonUtils getNotNilStr:self.deviceid]];
|
NSString*type=@"deviceId";
|
||||||
|
if ([_erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F]) {
|
||||||
|
type=@"petdeviceId";
|
||||||
|
}
|
||||||
|
else if (self.deviceid.length)
|
||||||
|
{
|
||||||
|
type=@"cameraId";
|
||||||
|
}
|
||||||
|
NSString*str=[NSString stringWithFormat:@"%@=%@",type,self.erdevicemodel.deviceId.length?self.erdevicemodel.deviceId:[CommonUtils getNotNilStr:self.deviceid]];
|
||||||
self.erWeiMaView.image=[QRCodeGenerator qrImageForString:str imageSize:self.erWeiMaView.bounds.size.width];
|
self.erWeiMaView.image=[QRCodeGenerator qrImageForString:str imageSize:self.erWeiMaView.bounds.size.width];
|
||||||
if ([self.erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
if ([self.erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -225,16 +225,24 @@
|
||||||
//deviceId= 水族箱设备标识
|
//deviceId= 水族箱设备标识
|
||||||
|
|
||||||
NSString*formatSting=[NSString stringWithFormat:@"%@",str];
|
NSString*formatSting=[NSString stringWithFormat:@"%@",str];
|
||||||
NSString*headstring=[formatSting substringWithRange:NSMakeRange(0,9)];
|
NSArray*array=[formatSting componentsSeparatedByString:@"="];
|
||||||
NSString*deviceIdString=[str substringFromIndex:9];
|
NSString*headstring=@"";
|
||||||
if ([headstring isEqualToString:@"deviceId="]){
|
NSString*deviceIdString=@"";
|
||||||
|
if (array.count==2)
|
||||||
|
{
|
||||||
|
headstring=array[0];
|
||||||
|
deviceIdString=array[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
//宠物笼 鱼缸
|
||||||
|
if ([headstring isEqualToString:@"deviceId"]||[headstring isEqualToString:@"petdeviceId"]){
|
||||||
|
|
||||||
UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
|
UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
|
||||||
NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||||
NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init];
|
NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init];
|
||||||
DeviceModel*deviceModel=[[DeviceModel alloc]init];
|
DeviceModel*deviceModel=[[DeviceModel alloc]init];
|
||||||
if ([arry count]==0) {
|
if ([arry count]==0) {
|
||||||
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString];
|
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring];
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
|
@ -256,11 +264,47 @@
|
||||||
}];
|
}];
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString];
|
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}//摄像头
|
||||||
|
else if ([headstring isEqualToString:@"cameraId"]){
|
||||||
|
|
||||||
|
UserModel*model=[[DataCenter defaultDtacenter]valueForKey:@"UserLogIn"];
|
||||||
|
NSArray*arry=[dataContorl getallCameras];
|
||||||
|
;
|
||||||
|
NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init];
|
||||||
|
|
||||||
|
if ([arry count]==0) {
|
||||||
|
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring];
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
for (IfishCameraModel* cama in arry) {
|
||||||
|
NSString*string=[NSString stringWithFormat:@"%@",cama.cameraId];
|
||||||
|
[deviceIdArr addObject:string];
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BOOL isExst=[deviceIdArr containsObject:deviceIdString];
|
||||||
|
if (isExst) {
|
||||||
|
|
||||||
|
[self.view makeToast:@"设备已经存在"];
|
||||||
|
[self dismissViewControllerAnimated:YES completion:^{
|
||||||
|
|
||||||
|
}];
|
||||||
|
|
||||||
|
}else{
|
||||||
|
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
|
||||||
|
|
||||||
if ([str hasPrefix:@"iFishCamera:"]) {
|
if ([str hasPrefix:@"iFishCamera:"]) {
|
||||||
|
|
@ -294,21 +338,39 @@
|
||||||
|
|
||||||
#pragma mark - 扫一扫 绑定水族箱
|
#pragma mark - 扫一扫 绑定水族箱
|
||||||
//老版本扫一扫 绑定 接口中无请求头 已换新接口
|
//老版本扫一扫 绑定 接口中无请求头 已换新接口
|
||||||
-(void)shareDeviceWithUserId:(NSNumber*)userId addDeviceId:(NSString*)deviceId{
|
-(void)shareDeviceWithUserId:(NSNumber*)userId addDeviceId:(NSString*)deviceId type:(NSString*)type{
|
||||||
|
|
||||||
NSString *userID =[NSString stringWithFormat:@"%@",userId];
|
NSString *userID =[NSString stringWithFormat:@"%@",userId];
|
||||||
|
|
||||||
|
|
||||||
NSString *url = [NSString stringWithFormat:@"%@%@",kshareDeviceByQrCode,userID];
|
NSString *url = [NSString stringWithFormat:@"%@",kshareDeviceByQrCode];
|
||||||
NSDictionary*para=@{
|
NSDictionary*para=@{
|
||||||
@"deviceId":deviceId
|
@"deviceId":deviceId,@"userId":userID
|
||||||
};
|
};
|
||||||
|
if ([type isEqualToString:@"petdeviceId"])
|
||||||
|
{
|
||||||
|
url=[NSString stringWithFormat:@"%@/api/user/sharePetDeviceByQrCode.do",JIEKOUPORT];
|
||||||
|
para=@{
|
||||||
|
@"deviceId":deviceId,@"userId":userID
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else if ([type isEqualToString:@"cameraId"])
|
||||||
|
{
|
||||||
|
url=[NSString stringWithFormat:@"%@/api/user/shareCamaraDeviceByQrCode.do",JIEKOUPORT];
|
||||||
|
para=@{
|
||||||
|
@"deviceId":deviceId,@"userId":userID
|
||||||
|
};
|
||||||
|
}
|
||||||
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:para success:^(id response) {
|
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:para success:^(id response) {
|
||||||
|
|
||||||
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||||
NSLog(@"result:%@",resultDic[@"result"]);
|
NSLog(@"result:%@",resultDic[@"result"]);
|
||||||
if ([resultDic[@"result"] isEqualToString:@"100"]) {
|
if ([resultDic[@"result"] isEqualToString:@"100"]) {
|
||||||
NSMutableArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
NSMutableArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||||
|
if ([type isEqualToString:@"cameraId"])
|
||||||
|
{
|
||||||
|
deviceArry=[dataContorl getallCameras];
|
||||||
|
}
|
||||||
[[IfishDataUnity shareDataInstance] addDeviceByQRCodeWithDic:resultDic addWith:deviceArry dismiss:self];
|
[[IfishDataUnity shareDataInstance] addDeviceByQRCodeWithDic:resultDic addWith:deviceArry dismiss:self];
|
||||||
}else if ([resultDic[@"result"] isEqualToString:@"101"]){
|
}else if ([resultDic[@"result"] isEqualToString:@"101"]){
|
||||||
[self.view makeToast:@"分享失败"];
|
[self.view makeToast:@"分享失败"];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue