// // IHHotelMapService.swift // Inhealth // // Created by weclouds on 2019/12/25. // Copyright © 2019 weclouds. All rights reserved. // import UIKit class IHHotelMapService: NSObject { static let share = IHHotelMapService() deinit { log.debug("IHHotelMapService销毁") } ///获取首页概览列表 func getHotelMapData(_ lng_low:String,lng_high:String, lat_low:String,lat_high:String,requestSuccess:@escaping ([HotelMapData])->Void,requestFail:@escaping (()->Void)) { let username = AppShare.username let client_key = AppShare.client_key let os = AppShare.os let version = AppShare.version let token = AppShare.token g_app_hotel_mapHttpRequest(username, client_key: client_key, os: os, version: version, token: token, lng_low: lng_low, lng_high: lng_high, lat_low: lat_low, lat_high: lat_high, success: { (json) -> (Void) in var hotelList = [HotelMapData]() let mHotelMapInfo = HotelMap_Info.fromJSON(json) let result = mHotelMapInfo?.result guard let list = result?.list else {return} for hotel in list { if let id = hotel.id,let name = hotel.name,let latitude = hotel.latitude,let longitude = hotel.longitude ,let roomCount = hotel.roomCount,let deviceCount = hotel.deviceCount,let lightCount = hotel.lightCount,let cicLightCount = hotel.cicLightCount,let sensorCount = hotel.sensorCount,let airPurCount = hotel.airPurCount,let aqi = hotel.aqi,let location = hotel.location,let countryId = hotel.countryId,let proId = hotel.proId,let cityId = hotel.cityId,let avatar = hotel.avatar { let aHotel = HotelMapData(id: id, name: name, longitude: longitude, latitude: latitude, roomCount: roomCount, deviceCount: deviceCount, lightCount: lightCount, cicLightCount: cicLightCount, sensorCount: sensorCount, airPurCount: airPurCount, aqi: aqi, location: location, countryId: countryId, proId: proId, cityId: cityId, avatar: avatar) hotelList.append(aHotel) } } requestSuccess(hotelList) }) { () -> (Void) in requestFail() } } }