摄像头分享和二维码生成规则修改
This commit is contained in:
+1
-1
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -622,7 +622,7 @@ Strong UIImage *screenShotImage;//截图
|
||||
}
|
||||
else
|
||||
{
|
||||
title=@"水族城";
|
||||
title=@"水族箱";
|
||||
}
|
||||
|
||||
[seg initleftTitle:@"摄像头" addRightTitle:title isSelectStyle:YES];
|
||||
@@ -1060,7 +1060,7 @@ Strong UIImage *screenShotImage;//截图
|
||||
NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
|
||||
[paragraphStyle setLineSpacing:12];
|
||||
[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([title length]-1,1)];
|
||||
[notbindBtn setAttributedTitle:attributedString forState:UIControlStateNormal];
|
||||
|
||||
@@ -46,7 +46,15 @@
|
||||
if ([self.erdevicemodel.deviceId isKindOfClass:[NSNumber class]]) {
|
||||
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];
|
||||
if ([self.erdevicemodel.type isEqualToString:DECICE_TYPE_XUANDUO3F])
|
||||
{
|
||||
|
||||
@@ -225,16 +225,24 @@
|
||||
//deviceId= 水族箱设备标识
|
||||
|
||||
NSString*formatSting=[NSString stringWithFormat:@"%@",str];
|
||||
NSString*headstring=[formatSting substringWithRange:NSMakeRange(0,9)];
|
||||
NSString*deviceIdString=[str substringFromIndex:9];
|
||||
if ([headstring isEqualToString:@"deviceId="]){
|
||||
NSArray*array=[formatSting componentsSeparatedByString:@"="];
|
||||
NSString*headstring=@"";
|
||||
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"];
|
||||
NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||
NSMutableArray*deviceIdArr=[[NSMutableArray alloc]init];
|
||||
DeviceModel*deviceModel=[[DeviceModel alloc]init];
|
||||
if ([arry count]==0) {
|
||||
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString];
|
||||
[self shareDeviceWithUserId:model.userId addDeviceId:deviceIdString type:headstring];
|
||||
|
||||
}else{
|
||||
|
||||
@@ -256,11 +264,47 @@
|
||||
}];
|
||||
|
||||
}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:"]) {
|
||||
@@ -294,21 +338,39 @@
|
||||
|
||||
#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 *url = [NSString stringWithFormat:@"%@%@",kshareDeviceByQrCode,userID];
|
||||
NSString *url = [NSString stringWithFormat:@"%@",kshareDeviceByQrCode];
|
||||
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) {
|
||||
|
||||
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
|
||||
NSLog(@"result:%@",resultDic[@"result"]);
|
||||
if ([resultDic[@"result"] isEqualToString:@"100"]) {
|
||||
NSMutableArray*deviceArry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
|
||||
if ([type isEqualToString:@"cameraId"])
|
||||
{
|
||||
deviceArry=[dataContorl getallCameras];
|
||||
}
|
||||
[[IfishDataUnity shareDataInstance] addDeviceByQRCodeWithDic:resultDic addWith:deviceArry dismiss:self];
|
||||
}else if ([resultDic[@"result"] isEqualToString:@"101"]){
|
||||
[self.view makeToast:@"分享失败"];
|
||||
|
||||
Reference in New Issue
Block a user