OOLoginModels.swift 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. //
  2. // OOLoginModels.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2018/4/5.
  6. // Copyright © 2018年 zoneland. All rights reserved.
  7. //
  8. import Foundation
  9. import HandyJSON
  10. // MARK: - 手机注册节点请求Model
  11. public class OONodeReqModel:DataModel {
  12. @objc var mobile:String?
  13. @objc var value:String?
  14. @objc var meta:String?
  15. required public init() {
  16. }
  17. public var description: String {
  18. return "mobile = \(String(describing: mobile)),value=\(String(describing: value)),meta=\(String(describing: meta))"
  19. }
  20. }
  21. // MARK:- 手机注册请求返回Model
  22. public class OONodeRespModel:DataModel {
  23. var value:Bool?
  24. required public init() {
  25. }
  26. public var description: String {
  27. return "value=\(String(describing: value))"
  28. }
  29. }
  30. // MARK: - 中心服务器节点Model
  31. public class OONodeModel:NSObject,DataModel,NSCoding {
  32. @objc var id:String?
  33. @objc var pinyin:String?
  34. @objc var pinyinInitial:String?
  35. @objc var httpProtocol:String?
  36. @objc var name:String?
  37. @objc var centerHost:String?
  38. @objc var centerContext:String = ""
  39. var centerPort:Int?
  40. override public required init() {
  41. }
  42. public func encode(with aCoder: NSCoder) {
  43. if id != nil {
  44. aCoder.encode(id, forKey: "id")
  45. }
  46. if pinyin != nil {
  47. aCoder.encode(pinyin, forKey: "pinyin")
  48. }
  49. if httpProtocol != nil {
  50. aCoder.encode(pinyin, forKey: "httpProtocol")
  51. }
  52. if pinyinInitial != nil {
  53. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  54. }
  55. if name != nil {
  56. aCoder.encode(name, forKey: "name")
  57. }
  58. if centerHost != nil {
  59. aCoder.encode(centerHost, forKey: "centerHost")
  60. }
  61. aCoder.encode(centerContext, forKey: "centerContext")
  62. if centerPort != nil {
  63. aCoder.encode(centerPort, forKey: "centerPort")
  64. }
  65. }
  66. public required init?(coder aDecoder: NSCoder) {
  67. id = aDecoder.decodeObject(forKey: "id") as? String
  68. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  69. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  70. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  71. name = aDecoder.decodeObject(forKey: "name") as? String
  72. centerHost = aDecoder.decodeObject(forKey: "centerHost") as? String
  73. centerContext = aDecoder.decodeObject(forKey: "centerContext") as! String
  74. centerPort = aDecoder.decodeObject(forKey: "centerPort") as? Int
  75. }
  76. public override var description: String {
  77. return "id=\(String(describing: id)),pinyin=\(String(describing: pinyin)),pinyinInitial=\(String(describing: pinyinInitial)),name = \(String(describing: name)),centerHost=\(String(describing: centerHost)),centerContext=\(centerContext),centerPort=\(String(describing: centerPort))"
  78. }
  79. }
  80. // MARK:- 绑定单元结点Model
  81. public class OOUnitNodeModel:NSObject, DataModel,NSCoding {
  82. //选择的节点名称
  83. @objc var unit:String?
  84. //手机号码
  85. @objc var mobile:String?
  86. //验证码
  87. @objc var code:String?
  88. //设备推送的token
  89. @objc var name:String?
  90. //设备类型
  91. @objc var deviceType:String = "iOS"
  92. required public override init() {
  93. }
  94. public func encode(with aCoder: NSCoder) {
  95. if unit != nil {
  96. aCoder.encode(unit, forKey: "unit")
  97. }
  98. if mobile != nil {
  99. aCoder.encode(mobile, forKey: "mobile")
  100. }
  101. if code != nil {
  102. aCoder.encode(code, forKey: "code")
  103. }
  104. if name != nil {
  105. aCoder.encode(name, forKey: "name")
  106. }
  107. aCoder.encode(deviceType, forKey: "deviceType")
  108. }
  109. public required init?(coder aDecoder: NSCoder) {
  110. unit = aDecoder.decodeObject(forKey: "unit") as? String
  111. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  112. code = aDecoder.decodeObject(forKey: "code") as? String
  113. name = aDecoder.decodeObject(forKey: "name") as? String
  114. deviceType = aDecoder.decodeObject(forKey: "deviceType") as! String
  115. }
  116. public init(unit:String,mobile:String,code:String,name:String) {
  117. self.unit = unit
  118. self.mobile = mobile
  119. self.code = code
  120. self.name = name
  121. }
  122. public override var description: String {
  123. return "unit=\(String(describing: unit)),mobile=\(String(describing: mobile)),code=\(String(describing: code)),name=\(String(describing: name)),deviceType=\(deviceType)"
  124. }
  125. }
  126. // MARK:- 模块结点模型
  127. public class OOModuleAPI:NSObject,DataModel,NSCoding {
  128. @objc var httpProtocol:String?
  129. @objc var host:String?
  130. @objc var name:String?
  131. @objc var context:String?
  132. var port:Int?
  133. public required override init() {
  134. }
  135. public func encode(with aCoder: NSCoder) {
  136. if httpProtocol != nil {
  137. aCoder.encode(httpProtocol, forKey: "httpProtocol")
  138. }
  139. if name != nil {
  140. aCoder.encode(name, forKey: "name")
  141. }
  142. if host != nil {
  143. aCoder.encode(host, forKey: "host")
  144. }
  145. if context != nil {
  146. aCoder.encode(context, forKey: "context")
  147. }
  148. if port != nil {
  149. aCoder.encode(port, forKey: "port")
  150. }
  151. }
  152. public required init?(coder aDecoder: NSCoder) {
  153. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  154. name = aDecoder.decodeObject(forKey: "name") as? String
  155. host = aDecoder.decodeObject(forKey: "host") as? String
  156. context = aDecoder.decodeObject(forKey: "context") as? String
  157. port = aDecoder.decodeObject(forKey: "port") as? Int
  158. }
  159. public override var description: String {
  160. return "\(name ?? "")模块配置信息\(host ?? ""),\(context ?? ""),\(port ?? 0)"
  161. }
  162. }
  163. public class OOWebModuleAPI:NSObject,DataModel,NSCoding {
  164. @objc var httpProtocol:String?
  165. @objc var host:String?
  166. var port:Int?
  167. public required override init() {
  168. }
  169. public func encode(with aCoder: NSCoder) {
  170. if httpProtocol != nil {
  171. aCoder.encode(httpProtocol, forKey: "httpProtocol")
  172. }
  173. if host != nil {
  174. aCoder.encode(host, forKey: "host")
  175. }
  176. if port != nil {
  177. aCoder.encode(port, forKey: "port")
  178. }
  179. }
  180. public required init?(coder aDecoder: NSCoder) {
  181. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  182. host = aDecoder.decodeObject(forKey: "host") as? String
  183. port = aDecoder.decodeObject(forKey: "port") as? Int
  184. }
  185. }
  186. public class OONodeAPI:NSObject,DataModel,NSCoding {
  187. @objc var assembles:[String:OOModuleAPI]?
  188. @objc var webServer:OOWebModuleAPI?
  189. public required override init() {
  190. }
  191. public func encode(with aCoder: NSCoder) {
  192. if assembles != nil {
  193. aCoder.encode(assembles, forKey: "assembles")
  194. }
  195. if webServer != nil {
  196. aCoder.encode(webServer, forKey: "webServer")
  197. }
  198. }
  199. public required init?(coder aDecoder: NSCoder) {
  200. assembles = aDecoder.decodeObject(forKey: "assembles") as? [String : OOModuleAPI]
  201. webServer = aDecoder.decodeObject(forKey: "webServer") as? OOWebModuleAPI
  202. }
  203. }
  204. // MARK:- 帐号模型
  205. class OOLoginAccountModel:NSObject,DataModel,NSCoding {
  206. @objc var changePasswordTime : String?
  207. @objc var controllerList : [AnyObject]?
  208. @objc var createTime : String?
  209. @objc var distinguishedName : String?
  210. @objc var employee : String?
  211. @objc var genderType : String?
  212. @objc var icon : String?
  213. @objc var id : String?
  214. @objc var lastLoginAddress : String?
  215. @objc var lastLoginClient : String?
  216. @objc var lastLoginTime : String?
  217. @objc var mail : String?
  218. @objc var mobile : String?
  219. @objc var name : String?
  220. var passwordExpired : Bool?
  221. @objc var pinyin : String?
  222. @objc var pinyinInitial : String?
  223. @objc var qq : String?
  224. @objc var roleList : [AnyObject]?
  225. @objc var token : String?
  226. @objc var tokenType : String?
  227. @objc var unique : String?
  228. @objc var updateTime : String?
  229. @objc var weixin : String?
  230. public override required init(){}
  231. /**
  232. * NSCoding required initializer.
  233. * Fills the data from the passed decoder
  234. */
  235. @objc required init(coder aDecoder: NSCoder)
  236. {
  237. changePasswordTime = aDecoder.decodeObject(forKey: "changePasswordTime") as? String
  238. controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [AnyObject]
  239. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  240. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  241. employee = aDecoder.decodeObject(forKey: "employee") as? String
  242. genderType = aDecoder.decodeObject(forKey: "genderType") as? String
  243. icon = aDecoder.decodeObject(forKey: "icon") as? String
  244. id = aDecoder.decodeObject(forKey: "id") as? String
  245. lastLoginAddress = aDecoder.decodeObject(forKey: "lastLoginAddress") as? String
  246. lastLoginClient = aDecoder.decodeObject(forKey: "lastLoginClient") as? String
  247. lastLoginTime = aDecoder.decodeObject(forKey: "lastLoginTime") as? String
  248. mail = aDecoder.decodeObject(forKey: "mail") as? String
  249. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  250. name = aDecoder.decodeObject(forKey: "name") as? String
  251. passwordExpired = aDecoder.decodeObject(forKey: "passwordExpired") as? Bool
  252. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  253. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  254. qq = aDecoder.decodeObject(forKey: "qq") as? String
  255. roleList = aDecoder.decodeObject(forKey: "roleList") as? [AnyObject]
  256. token = aDecoder.decodeObject(forKey: "token") as? String
  257. tokenType = aDecoder.decodeObject(forKey: "tokenType") as? String
  258. unique = aDecoder.decodeObject(forKey: "unique") as? String
  259. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  260. weixin = aDecoder.decodeObject(forKey: "weixin") as? String
  261. }
  262. /**
  263. * NSCoding required method.
  264. * Encodes mode properties into the decoder
  265. */
  266. @objc func encode(with aCoder: NSCoder)
  267. {
  268. if changePasswordTime != nil{
  269. aCoder.encode(changePasswordTime, forKey: "changePasswordTime")
  270. }
  271. if controllerList != nil{
  272. aCoder.encode(controllerList, forKey: "controllerList")
  273. }
  274. if createTime != nil{
  275. aCoder.encode(createTime, forKey: "createTime")
  276. }
  277. if distinguishedName != nil{
  278. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  279. }
  280. if employee != nil{
  281. aCoder.encode(employee, forKey: "employee")
  282. }
  283. if genderType != nil{
  284. aCoder.encode(genderType, forKey: "genderType")
  285. }
  286. if icon != nil{
  287. aCoder.encode(icon, forKey: "icon")
  288. }
  289. if id != nil{
  290. aCoder.encode(id, forKey: "id")
  291. }
  292. if lastLoginAddress != nil{
  293. aCoder.encode(lastLoginAddress, forKey: "lastLoginAddress")
  294. }
  295. if lastLoginClient != nil{
  296. aCoder.encode(lastLoginClient, forKey: "lastLoginClient")
  297. }
  298. if lastLoginTime != nil{
  299. aCoder.encode(lastLoginTime, forKey: "lastLoginTime")
  300. }
  301. if mail != nil{
  302. aCoder.encode(mail, forKey: "mail")
  303. }
  304. if mobile != nil{
  305. aCoder.encode(mobile, forKey: "mobile")
  306. }
  307. if name != nil{
  308. aCoder.encode(name, forKey: "name")
  309. }
  310. if passwordExpired != nil{
  311. aCoder.encode(passwordExpired, forKey: "passwordExpired")
  312. }
  313. if pinyin != nil{
  314. aCoder.encode(pinyin, forKey: "pinyin")
  315. }
  316. if pinyinInitial != nil{
  317. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  318. }
  319. if qq != nil{
  320. aCoder.encode(qq, forKey: "qq")
  321. }
  322. if roleList != nil{
  323. aCoder.encode(roleList, forKey: "roleList")
  324. }
  325. if token != nil{
  326. aCoder.encode(token, forKey: "token")
  327. }
  328. if tokenType != nil{
  329. aCoder.encode(tokenType, forKey: "tokenType")
  330. }
  331. if unique != nil{
  332. aCoder.encode(unique, forKey: "unique")
  333. }
  334. if updateTime != nil{
  335. aCoder.encode(updateTime, forKey: "updateTime")
  336. }
  337. if weixin != nil{
  338. aCoder.encode(weixin, forKey: "weixin")
  339. }
  340. }
  341. }