IHCurtainService.swift 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // IHCurtainService.swift
  3. // Inhealth
  4. //
  5. // Created by weclouds on 2020/7/27.
  6. // Copyright © 2020 weclouds. All rights reserved.
  7. //
  8. import UIKit
  9. class IHCurtainService: NSObject {
  10. //单例
  11. static let share = IHCurtainService()
  12. let username = AppShare.username
  13. let client_key = AppShare.client_key
  14. let os = AppShare.os
  15. let token = AppShare.token
  16. let version = AppShare.version
  17. //获取窗帘的数据
  18. func getSchoolCurtainModel(id: String, complete:@escaping( _ curtainModel_info : CurtainModel_info?) -> Void) {
  19. net_school_get_curtain_mode(username: username, client_key: client_key, os: os, version: version, token: token, id: id, success: { (json) -> (Void) in
  20. let curtainDataInfo = CurtainModel_info.fromJSON(json)
  21. complete(curtainDataInfo)
  22. }) { () -> (Void) in
  23. }
  24. }
  25. //设置窗帘的数据
  26. 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) {
  27. IHWebSocketManager.shareInstance().schoolDeviceOpation(isSchool: true) { (isSuccess, responeStr,code) in
  28. if isSuccess == 2 {
  29. log.debug("websocket窗帘返回的数据")
  30. compelete(responeStr, code)
  31. }else{
  32. 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
  33. }) { () -> (Void) in
  34. }
  35. }
  36. }
  37. }
  38. }