Parcourir la source

优化新接口

liuzhenxing1118 il y a 8 mois
Parent
commit
3f1d755126

+ 2 - 2
artimenring-iOS/Artimenring/Classes/ViewController/Baby/SKBabyDetailInfoViewController.m

@@ -483,8 +483,8 @@ typedef NS_ENUM(NSInteger, EControllerType) {
 
 - (void)updateChildRequest {
     @weakify(self);
-    NSString* cid = self.childModel.cid;
     NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
+    param[@"cid"] = self.childModel.cid;
     param[@"avatar"] = self.childModel.avatar;
     param[@"name"] = self.childModel.name;
     param[@"appellation"] = self.childModel.appellation;
@@ -495,7 +495,7 @@ typedef NS_ENUM(NSInteger, EControllerType) {
     param[@"height"] = @(self.childModel.height);
     param[@"weight"] = @(self.childModel.weight);
     [self ShowHUBWithText:NSLocalizedString(@"Request.Modifing", nil)];
-    [ERequest httpRequest:param path:cid httpURL:URL_CHILD_UPDATE httpMethod:@"PUT" onSuccess:^(NSDictionary *result) {
+    [ERequest httpRequest:param httpURL:URL_CHILD_UPDATE httpMethod:@"POST" onSuccess:^(NSDictionary *result) {
         [weak_self HiddenHUB];
         if([ERequest isSuccessWithResult:result]) {
             if (weak_self.opType == 1) {

+ 1 - 1
artimenring-iOS/Artimenring/Classes/ViewController/Event/EventReminderViewController.m

@@ -98,7 +98,7 @@
     param[@"operationTime"] = @([[ScheduleManager sharedInstance] getLatestTimeID:cid]);
     
     [self ShowHUBWithText:NSLocalizedString(@"Request.Updating", nil)];
-    [ERequest httpRequest:@{} path:cid httpURL:URL_EVENT httpMethod:@"GET" onSuccess:^(NSDictionary *result){
+    [ERequest httpRequest:param httpURL:URL_EVENT httpMethod:@"GET" onSuccess:^(NSDictionary *result){
         [self HiddenHUB];
         if([ERequest isSuccessWithResult:result])
         {

+ 0 - 20
artimenring-iOS/Artimenring/Classes/ViewController/Mine/SKMineViewController+baby.h

@@ -1,20 +0,0 @@
-//
-//  SKMineViewController+baby.h
-//  Overseas Watch
-//
-//  Created by 刘振兴 on 2024/1/19.
-//  Copyright © 2024 BaH Cy. All rights reserved.
-//
-
-#import "SKMineViewController.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface SKMineViewController (baby)
-
-- (UITableViewCell *)babyTableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
-- (void)babyTableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 153
artimenring-iOS/Artimenring/Classes/ViewController/Mine/SKMineViewController+baby.m

@@ -1,153 +0,0 @@
-//
-//  SKMineViewController+baby.m
-//  Overseas Watch
-//
-//  Created by 刘振兴 on 2024/1/19.
-//  Copyright © 2024 BaH Cy. All rights reserved.
-//
-
-#import "SKMineViewController+baby.h"
-#import "SKBabyListCellViewCell.h"
-#import "SKBabyDetailInfoViewController.h"
-#import "SKBabyQRCodeViewController.h"
-
-@implementation SKMineViewController (baby)
-
-- (UITableViewCell *)babyTableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    static NSString *cellID = @"BabyListCellID";
-    SKBabyListCellViewCell *cell = (SKBabyListCellViewCell*)[tableView dequeueReusableCellWithIdentifier:cellID forIndexPath:indexPath];
-    if(cell == nil) {
-        cell = [[SKBabyListCellViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
-    }
-    [cell setData:indexPath.row];
-    cell.mCellCallback = ^(NSInteger rowIndex, NSInteger btnIndex) {
-        self.seletedBabyIdx = rowIndex;
-        if (btnIndex == 1) {
-            [self showAlert:1];
-        } else if (btnIndex == 2) {
-            [self showAlert:2];
-        } else if (btnIndex == 3) {
-            [self showBind:rowIndex];
-        } else if (btnIndex == 11) {
-            [self showBabyDetail:rowIndex];
-        } else if (btnIndex == 12) {
-            [self showBabyQRCode:rowIndex];
-        }
-    };
-    return cell;
-}
-
-- (void)babyTableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
-}
-
-- (void)deleteWatch:(NSInteger)index {
-    ChildModel *child = [[DataManager shared] getIndexChild:index];
-    NSDictionary *param = @{
-        @"cid":child.cid,
-        @"deviceId":@(child.device.did),
-        @"ticket":child.device.ticket,
-    };
-    
-    //@"解绑中..."
-    [self ShowHUBWithText:NSLocalizedString(@"DB.Remove.Bind.Ing", nil)];
-    
-    [ERequest httpRequest:param httpURL:URL_DEVICE_DELETE httpMethod:@"POST" onSuccess:^(NSDictionary *result) {
-        [self HiddenHUB];
-        if ([ERequest isSuccessWithResult:result]) {
-            
-            //@"解绑成功"
-            [EasyTextView showSuccessText:NSLocalizedString(@"DB.Remove.Bind.Success", nil)];
-            
-            [[DataManager shared] removeDevice:index];
-        
-            [self.mTableView reloadData];
-        } else {
-            [EasyTextView showErrorText:result[@"message"]];
-        }
-    } onFailure:^(NSError *error) {
-        [self HiddenHUB];
-        [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
-    }];
-}
-
-- (void)deleteChild:(NSInteger)index {
-    ChildModel *child = [[DataManager shared] getIndexChild:index];
-    NSString* cid = child.cid;
-    
-    [self ShowHUBWithText:NSLocalizedString(@"Cancel.Following...", nil)];//@"取消关注中..."];
-    [ERequest httpRequest:@{} path:cid httpURL:URL_CHILD_DELETE httpMethod:@"GET" onSuccess:^(NSDictionary *result) {
-        [self HiddenHUB];
-        if ([ERequest isSuccessWithResult:result]) {
-            if([[DataManager shared] getChildCount] - 1 > 0) {
-                if (index >= 0) {
-                    [[DataManager shared] removeData:index];
-                }
-                [self.mTableView reloadData];
-                [EUtil postInformation:@"RELOAD_CHILDS_DEVICES"];
-            } else {
-                [[DataManager shared] logout];
-            }
-        } else {
-            [EasyTextView showErrorText:result[@"message"]];
-        }
-    } onFailure:^(NSError *error) {
-        [self HiddenHUB];
-        [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];//@"网络错误"];
-    }];
-}
-
-- (void)showBind:(NSInteger)index {
-    [MobClick event:@"ClickAddBindAgain"];
-    ChildModel *child = [[DataManager shared] getIndexChild:index];
-    [DataManager shared].bindOptions = BO_REBIND;
-    SKBabyDetailInfoViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"BabyDetailInfo"];
-    controller.opType = 3;
-    controller.childModel = child;
-    [self pushViewController:controller animated:YES];
-}
-
-- (void)showBabyDetail:(NSInteger)index {
-    ChildModel* model = [[DataManager shared] getIndexChild:index];
-    if (model.role > ROLE_ADMIN)
-        return;
-    ChildModel *child = [[DataManager shared] getIndexChild:index];
-    SKBabyDetailInfoViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"BabyDetailInfo"];
-    controller.opType = 1;
-    controller.childModel = [child mutableCopy];
-    [self pushViewController:controller animated:YES];
-}
-
-- (void)showBabyQRCode:(NSInteger)index {
-    [MobClick event:@"ClickBabyQRCode"];
-    ChildModel *child = [[DataManager shared] getIndexChild:index];
-    SKBabyQRCodeViewController *controller = [[self storyboard] instantiateViewControllerWithIdentifier:@"BabyQRCodeVC"];
-    controller.cid = child.cid;
-    [self pushViewController:controller animated:YES];
-}
-
-#pragma mark - popup
-- (void)showAlert:(NSInteger)type {
-    NSString* title;
-    NSString* content;
-    if (type == 1) {
-        title = NSLocalizedString(@"Baby.List.Alert.1", nil);
-        content = NSLocalizedString(@"Baby.List.Alert.Content.1", nil);
-    } else {
-        title = NSLocalizedString(@"Baby.List.Alert.2", nil);
-        content = NSLocalizedString(@"Baby.List.Alert.Content.2", nil);
-    }
-    
-    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:content preferredStyle:UIAlertControllerStyleAlert];
-    [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"SK.Cancel", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-    }]];
-    [alert addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"SK.Confirm", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-        if (type == 1) {
-            [self deleteWatch:self.seletedBabyIdx];
-        } else if (type == 2) {
-            [self deleteChild:self.seletedBabyIdx];
-        }
-    }]];
-    [self presentViewController:alert animated:YES completion:nil];
-}
-
-@end

+ 4 - 6
artimenring-iOS/Artimenring/Classes/ViewController/Mine/SKMineViewController+user.m

@@ -19,12 +19,10 @@
     if(cell == nil) {
         cell = [[SKMineViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellID];
     }
-    if (indexPath.section == 1) {
-        NSString* imageName = [NSString stringWithFormat:@"%@_%ld", @"mine_list", (long)indexPath.row];
-        NSString* titleName = [NSString stringWithFormat:@"%@.%ld", @"Mine.List", (long)indexPath.row];
-        [cell.mImage setImage:[UIImage imageNamed:imageName]];
-        cell.mTitle.text = NSLocalizedString(titleName, nil);
-    }
+    NSString* imageName = [NSString stringWithFormat:@"%@_%ld", @"mine_list", (long)indexPath.row];
+    NSString* titleName = [NSString stringWithFormat:@"%@.%ld", @"Mine.List", (long)indexPath.row];
+    [cell.mImage setImage:[UIImage imageNamed:imageName]];
+    cell.mTitle.text = NSLocalizedString(titleName, nil);
     return cell;
 }
 

+ 5 - 27
artimenring-iOS/Artimenring/Classes/ViewController/Mine/SKMineViewController.m

@@ -7,7 +7,6 @@
 //
 
 #import "SKMineViewController.h"
-#import "SKMineViewController+baby.h"
 #import "SKMineViewController+user.h"
 #import <UMMobClick/MobClick.h>
 
@@ -22,45 +21,24 @@
 }
 
 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
-    return 2;
+    return 1;
 }
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    if (section == 0)
-        //return [DataManager shared].mChildList.count;
-        return 0;
-    else
-        return 3;
+    return 3;
 }
 
 - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (indexPath.section == 0) {
-        return 170;
-    } else {
-        return 64;
-    }
+    return 64;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    if (indexPath.section == 0) {
-        return [self babyTableView:tableView cellForRowAtIndexPath:indexPath];
-    } else {
-        return [self userTableView:tableView cellForRowAtIndexPath:indexPath];
-    }
+    return [self userTableView:tableView cellForRowAtIndexPath:indexPath];
 }
 
 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     [self.mTableView deselectRowAtIndexPath:indexPath animated:YES];
-    if (indexPath.section == 0) {
-        return [self babyTableView:tableView didSelectRowAtIndexPath:indexPath];
-    } else {
-        return [self userTableView:tableView didSelectRowAtIndexPath:indexPath];
-    }
-}
-
-- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
-    
-    NSLog(@"%@的值改变了,",keyPath);
+    return [self userTableView:tableView didSelectRowAtIndexPath:indexPath];
 }
 
 - (void)onRefreshChildsDevices {

+ 6 - 4
artimenring-iOS/Artimenring/Classes/ViewController/WatchFunction/StrangerIntercept/SKStrangerInterceptViewController.m

@@ -126,9 +126,11 @@
 
 - (void)requestSwitchFlag {
     @weakify(self);
-    NSString* cid = [DataManager shared].mSelectChildModel.cid;
+    NSMutableDictionary *param = [[NSMutableDictionary alloc] init];
+    param[@"cid"] = [DataManager shared].mSelectChildModel.cid;
+    
     [self ShowHUBWithText:NSLocalizedString(@"Request.Updating", nil)];
-    [ERequest httpRequest:@{} path:cid httpURL:URL_STRANGER httpMethod:@"GET" onSuccess:^(NSDictionary *result){
+    [ERequest httpRequest:param httpURL:URL_STRANGER httpMethod:@"GET" onSuccess:^(NSDictionary *result){
         [self HiddenHUB];
         if([ERequest isSuccessWithResult:result]) {
             weak_self.strangerModel = [StrangerInterceptModel mj_objectWithKeyValues:result[@"data"]];
@@ -144,11 +146,11 @@
 
 - (void)uploadSwitchFlag:(NSInteger)flag {
     @weakify(self);
-    NSString* cid = [DataManager shared].mSelectChildModel.cid;
     NSMutableDictionary* param = [[NSMutableDictionary alloc] init];
+    param[@"cid"] = [DataManager shared].mSelectChildModel.cid;
     param[@"toggle"] = @(flag);
     [self ShowHUBWithText:NSLocalizedString(@"Request.Updating", nil)];
-    [ERequest httpRequest:param path:cid httpURL:URL_STRANGER httpMethod:@"PUT" onSuccess:^(NSDictionary *result){
+    [ERequest httpRequest:param httpURL:URL_STRANGER httpMethod:@"POST" onSuccess:^(NSDictionary *result){
         [self HiddenHUB];
         if([ERequest isSuccessWithResult:result]) {
             weak_self.strangerModel.toggle = flag;

+ 0 - 6
artimenring-iOS/SikeyComm.xcodeproj/project.pbxproj

@@ -213,7 +213,6 @@
 		E41ECBA82CF95EAF00C4C36C /* SKLoginViewController+guide.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBA52CF95EAF00C4C36C /* SKLoginViewController+guide.m */; };
 		E41ECBA92CF95EAF00C4C36C /* SKLoginViewController+thirdparty.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBA62CF95EAF00C4C36C /* SKLoginViewController+thirdparty.m */; };
 		E41ECBB22CF95F2100C4C36C /* SKMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBAB2CF95F2100C4C36C /* SKMineViewController.m */; };
-		E41ECBB32CF95F2100C4C36C /* SKMineViewController+baby.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBAF2CF95F2100C4C36C /* SKMineViewController+baby.m */; };
 		E41ECBB42CF95F2100C4C36C /* SKMineViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBB02CF95F2100C4C36C /* SKMineViewCell.m */; };
 		E41ECBB52CF95F2100C4C36C /* SKMineViewController+user.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBB12CF95F2100C4C36C /* SKMineViewController+user.m */; };
 		E41ECBC22CF9605E00C4C36C /* SKBaseViewController+navigationbar.m in Sources */ = {isa = PBXBuildFile; fileRef = E41ECBB62CF9605C00C4C36C /* SKBaseViewController+navigationbar.m */; };
@@ -771,8 +770,6 @@
 		E41ECBAB2CF95F2100C4C36C /* SKMineViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKMineViewController.m; sourceTree = "<group>"; };
 		E41ECBAC2CF95F2100C4C36C /* SKMineViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKMineViewController.h; sourceTree = "<group>"; };
 		E41ECBAD2CF95F2100C4C36C /* SKMineViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SKMineViewCell.h; sourceTree = "<group>"; };
-		E41ECBAE2CF95F2100C4C36C /* SKMineViewController+baby.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SKMineViewController+baby.h"; sourceTree = "<group>"; };
-		E41ECBAF2CF95F2100C4C36C /* SKMineViewController+baby.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SKMineViewController+baby.m"; sourceTree = "<group>"; };
 		E41ECBB02CF95F2100C4C36C /* SKMineViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SKMineViewCell.m; sourceTree = "<group>"; };
 		E41ECBB12CF95F2100C4C36C /* SKMineViewController+user.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SKMineViewController+user.m"; sourceTree = "<group>"; };
 		E41ECBB62CF9605C00C4C36C /* SKBaseViewController+navigationbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SKBaseViewController+navigationbar.m"; sourceTree = "<group>"; };
@@ -1698,8 +1695,6 @@
 				E41ECBB02CF95F2100C4C36C /* SKMineViewCell.m */,
 				E41ECBAC2CF95F2100C4C36C /* SKMineViewController.h */,
 				E41ECBAB2CF95F2100C4C36C /* SKMineViewController.m */,
-				E41ECBAE2CF95F2100C4C36C /* SKMineViewController+baby.h */,
-				E41ECBAF2CF95F2100C4C36C /* SKMineViewController+baby.m */,
 				E41ECBAA2CF95F2100C4C36C /* SKMineViewController+user.h */,
 				E41ECBB12CF95F2100C4C36C /* SKMineViewController+user.m */,
 				27F0DA582062449F0064AABA /* TestMasonryViewController.h */,
@@ -3027,7 +3022,6 @@
 				E41ECB8E2CF95DD700C4C36C /* SKChatViewController+permission.m in Sources */,
 				E4735C4D2B6CE81900FCF9D9 /* UIWindow+Hierarchy.m in Sources */,
 				E4FE9B632AD9465100DEABCA /* SSLunarDateFormatter.m in Sources */,
-				E41ECBB32CF95F2100C4C36C /* SKMineViewController+baby.m in Sources */,
 				2747DF81206353AE002F84E9 /* NSMutableArray+addNil.m in Sources */,
 				27ADEA5E1CBFD15E0013EADA /* RedFlowerCompleteListViewController.m in Sources */,
 				E41ECBA02CF95DD700C4C36C /* SKChatListViewCell.m in Sources */,