12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //
- // IHCurtainService.swift
- // Inhealth
- //
- // Created by weclouds on 2020/7/27.
- // Copyright © 2020 weclouds. All rights reserved.
- //
- import UIKit
- class IHCurtainService: NSObject {
- //单例
- static let share = IHCurtainService()
-
- let username = AppShare.username
- let client_key = AppShare.client_key
- let os = AppShare.os
- let token = AppShare.token
- let version = AppShare.version
-
- //获取窗帘的数据
- func getSchoolCurtainModel(id: String, complete:@escaping( _ curtainModel_info : CurtainModel_info?) -> Void) {
- net_school_get_curtain_mode(username: username, client_key: client_key, os: os, version: version, token: token, id: id, success: { (json) -> (Void) in
- let curtainDataInfo = CurtainModel_info.fromJSON(json)
- complete(curtainDataInfo)
- }) { () -> (Void) in
-
- }
- }
-
- //设置窗帘的数据
- func setSchoolCurtainData(id : String,open_status : String,close_status : String,att_class_status : String, fin_class_status : String, break_status : String, self_stu_status : String,blackboard_status : String,shadow_status : String,compelete:@escaping (_ respone: String?, _ code : String?) -> Void) {
-
- IHWebSocketManager.shareInstance().schoolDeviceOpation(isSchool: true) { (isSuccess, responeStr,code) in
- if isSuccess == 2 {
- log.debug("websocket窗帘返回的数据")
- compelete(responeStr, code)
-
- }else{
- net_school_set_curtain_mode(username: self.username, client_key: self.client_key, os: self.os, version: self.version, token: self.token, id: id, close_status: close_status, open_status: open_status, att_class_status: att_class_status, fin_class_status: fin_class_status, break_status: break_status, self_stu_status: self_stu_status, blackboard_status: blackboard_status, shadow_status: shadow_status, clientId: responeStr, success: { (json) -> (Void) in
-
- }) { () -> (Void) in
-
- }
- }
- }
- }
-
- }
|