Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 9 | Rev 17 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 9 Rev 11
Línea 63... Línea 63...
63
        completionHandler(true)
63
        completionHandler(true)
64
    }
64
    }
Línea 65... Línea 65...
65
    
65
    
66
    func sendSync(record: SyncModel)
66
    func sendSync(record: SyncModel)
67
    {
67
    {
Línea 68... Línea 68...
68
        let appData = self.appDao.selectOne()
68
        let appData = appDao.selectOne()
69
        
69
        
70
        let parameters = [
70
        let parameters = [
71
            Constants.POST_SYNC_FIELD_DEVICE_UUID: "\(appData.deviceUuid)",
71
            Constants.POST_SYNC_FIELD_DEVICE_UUID: "\(appData.deviceUuid)",
Línea 76... Línea 76...
76
            .accept(Constants.HTTP_HEADER_ACCEPT)
76
            .accept(Constants.HTTP_HEADER_ACCEPT)
77
        ]
77
        ]
Línea 78... Línea 78...
78
        
78
        
Línea 79... Línea 79...
79
        AF.request(Config.URL_SYNC, method: .post, parameters: parameters, encoding: URLEncoding.default, headers: headers).responseJSON {response in
79
        AF.request(Config.URL_SYNC, method: .post, parameters: parameters, encoding: URLEncoding.default, headers: headers).responseJSON {response in
Línea 80... Línea 80...
80
            
80
            
81
            print("Send Sync  ")
81
            //print("Send Sync  ")
82
            
82
            
83
            switch response.result {
83
            switch response.result {
Línea 89... Línea 89...
89
                            self.syncDao.remove(id: sync_id)
89
                            self.syncDao.remove(id: sync_id)
90
                        }
90
                        }
91
                    }
91
                    }
92
                break
92
                break
93
                case .failure:
93
                case .failure:
94
                    print("JSON = \(String(describing: Error.self))")
94
                   // print("JSON = \(String(describing: Error.self))")
95
                break
95
                break
96
            }
96
            }
97
        }
97
        }
98
    }
98
    }
Línea 124... Línea 124...
124
                    if sync_id > 0 {
124
                    if sync_id > 0 {
125
                        self.syncDao.remove(id: sync_id)
125
                        self.syncDao.remove(id: sync_id)
126
                    }
126
                    }
127
                    break
127
                    break
128
                case .failure:
128
                case .failure:
129
                    print("JSON = \(String(describing: Error.self))")
129
                   // print("JSON = \(String(describing: Error.self))")
130
                    break
130
                    break
131
            }
131
            }
132
        }
132
        }
133
    }
133
    }
Línea 175... Línea 175...
175
 
175
 
176
            
176
            
177
                            var appData = self.appDao.selectOne()
177
                            var appData = self.appDao.selectOne()
-
 
178
                            appData.deviceAes = aes
-
 
179
                            appData.devicePassword = password
178
                            appData.deviceAes = aes
180
                            
179
                            appData.devicePassword = password
181
                            print("update query : 1")
Línea 180... Línea 182...
180
                            self.appDao.update(model: appData)
182
                            self.appDao.update(model: appData)
181
                        }
183
                        }
182
                        
184
                        
183
                        let sync_id = Int(result?["data"]["sync_id"].stringValue ?? "0") ?? 0
185
                        let sync_id = Int(result?["data"]["sync_id"].stringValue ?? "0") ?? 0
184
                        if sync_id > 0 {
186
                        if sync_id > 0 {
185
                            self.syncDao.remove(id: sync_id)
187
                            self.syncDao.remove(id: sync_id)
186
                        }
188
                        }
187
                    }
189
                    }
188
                break
190
                break
189
                case .failure:
191
                case .failure:
190
                    print("JSON = \(String(describing: Error.self))")
192
                    //print("JSON = \(String(describing: Error.self))")
191
                break
193
                break
192
            }
194
            }