宠物店修改

This commit is contained in:
kai60
2020-05-02 14:56:49 +08:00
parent 8fca79324a
commit 53f06fcf43
100 changed files with 2672 additions and 198 deletions
@@ -8,12 +8,16 @@
#import "BaseViewController.h"
#import "LXWaveProgressView.h"
#import "StoreNameView.h"
@interface SecondConnectWifiController : BaseViewController
@property (weak, nonatomic) IBOutlet UIImageView *wifigifImgView;
@property (weak, nonatomic) IBOutlet UILabel *wifiNamelabel;
@property (weak, nonatomic) IBOutlet UITextField *wifiTextFiled;
@property (weak, nonatomic) IBOutlet UILabel *redTextLable;
@property (nonatomic, strong) UIView *mask;
@property (nonatomic, strong) StoreNameView *storeNameView;
@property (nonatomic, strong) NSString *storeName;
- (IBAction)makeSureButton:(id)sender;
@@ -16,7 +16,7 @@
#import "ESPTouchTask.h"
#import "ESPTouchResult.h"
#import "ESPTouchDelegate.h"
#import "MyMD5.h"
#import "ChatroomModel.h"
#import "MMProgressHUD.h"
#import "MMProgressHUDOverlayView.h"
@@ -135,6 +135,7 @@ extern BOOL isfromCameraView;
[self creatConnectStateUI];
//获取WiFi名称
[self getSSid];
[self showStoreNameView];
}
- (void)updateUI {
@@ -565,7 +566,7 @@ extern BOOL isfromCameraView;
NSUInteger count = 0;
// max results to be displayed, if it is more than maxDisplayCount,
// just show the count of redundant ones
const int maxDisplayCount = 5;
const int maxDisplayCount = 100000;
if ([firstResult isSuc])
{
@@ -573,7 +574,8 @@ extern BOOL isfromCameraView;
NSArray*arry=[[DataCenter defaultDtacenter]valueForKey:@"deviceInfo"];
DeviceModel*model=[[DeviceModel alloc]init];
if (arry.count<5) {
//if (arry.count<5)
{
NSMutableArray*macdressArr=[[NSMutableArray alloc]init];
for (model in arry) {
@@ -592,17 +594,25 @@ extern BOOL isfromCameraView;
}else{
[self bindDeviceWithSsid:_deviceBssid];
if (self.deviceType==DEVICEPETS) {
[self showStoreNameView];
}
else
{
[self bindDeviceWithSsid:_deviceBssid];
}
}
}else{
[self.view makeToast:@"您的设备数量已超过限制"];
[self mmPogressHUDdismiss];
[self connectNormalView];
}
}
// else{
//
// [self.view makeToast:@"您的设备数量已超过限制"];
// [self mmPogressHUDdismiss];
// [self connectNormalView];
//
// }
for (int i = 0; i < [esptouchResultArray count]; ++i)
@@ -660,11 +670,76 @@ extern BOOL isfromCameraView;
}
-(UIView *)mask
{
if (!_mask)
{
UIView*mask=[[UIView alloc]initWithFrame:self.view.bounds];
mask.backgroundColor=[UIColor lightGrayColor];
mask.alpha=0.5;
_mask=mask;
UITapGestureRecognizer*tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(dismissStore)];
[mask addGestureRecognizer:tap];
}
return _mask;
}
-(void)dismissStore
{
[self.storeNameView removeFromSuperview];
[self.mask removeFromSuperview];
}
-(void)showStoreNameView
{
[self.storeNameView removeFromSuperview];
StoreNameView*store=[[[NSBundle mainBundle] loadNibNamed:@"StoreNameView" owner:self options:nil] lastObject];
store.frame=CGRectMake((SCREEN_WIDTH-280)/2.0, 100, 280, 280);
self.storeNameView.center=self.mask.center;
self.storeNameView=store;
WEAK_SELF;
store.cancelBlock=^(){
[weakSelf.mask removeFromSuperview];
[weakSelf.storeNameView removeFromSuperview];
};
store.sureBlock=^(NSString*name)
{
[weakSelf.mask removeFromSuperview];
[weakSelf.storeNameView removeFromSuperview];
weakSelf.storeName=name;
[weakSelf bindDeviceWithSsid:_deviceBssid];
};
[self.view addSubview:self.mask];
[self.view addSubview:self.storeNameView];
}
#pragma mark 绑定设备
-(void)bindDeviceWithSsid:(NSString*)bssid{
NSLog(@"设备bssid_%@",bssid);
NSString *userId = [dataContorl dataControlGetUserIdInfo];
[AFHttpTool bindDeviceWithUserId:userId macAddress:bssid success:^(id response) {
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:@"" params:@{} success:^(id response) {
} failure:^(NSError *err) {
}];
NSString*url=[NSString stringWithFormat:@"%@%@",kBindDevice,userId];
NSMutableDictionary*bind=[[NSMutableDictionary alloc]initWithDictionary:@{@"macAddress":bssid}];
NSString* timestamp=[NSString stringWithFormat:@"%lld",[[NSDate date] timeIntervalSince1970]*1000];
NSString*token=[MyMD5 md5:[NSString stringWithFormat:@"%@%@ifish8",userId,timestamp]];
if (self.deviceType==DEVICEPETS)
{
url=[NSString stringWithFormat:@"%@%@",[NSString stringWithFormat:@"%@/api/user/bindPetDevice.do/",JIEKOUPORT],userId];
bind[@"token"]=token;
bind[@"timestamp"]=timestamp;
bind[@"storeName"]=[NSString stringWithFormat:@"宠物笼%lld",[[NSDate date] timeIntervalSince1970]];
}
[AFHttpTool requestWihtMethod:RequestMethodTypePost url:url params:bind success:^(id response) {
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSLog(@"data:%@",resultDic[@"data"]);
if ([resultDic[@"result"] isEqualToString:@"100"]) {