O2AuthenticationModels.swift 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. //
  2. // O2AuthenticationModels.swift
  3. // O2OA_SDK_Framwork
  4. //
  5. // Created by FancyLou on 2018/11/7.
  6. //
  7. import Foundation
  8. import HandyJSON
  9. // MARK: - 绑定collect服务器相关的models
  10. /// 注册节点请求的model
  11. public class O2NodeReqModel: DataModel {
  12. required public init() {}
  13. public var description: String {
  14. return toJSONString(prettyPrint: true) ?? ""
  15. }
  16. @objc var mobile:String?
  17. @objc var value:String?
  18. @objc var meta:String?
  19. }
  20. /// 注册节点返回的model
  21. public class O2NodeResModel: NSObject, DataModel, NSCoding {
  22. public func encode(with aCoder: NSCoder) {
  23. if value != nil {
  24. aCoder.encode(value, forKey: "value")
  25. }
  26. }
  27. public required init?(coder aDecoder: NSCoder) {
  28. value = aDecoder.decodeObject(forKey: "value") as? Bool
  29. }
  30. required public override init() {}
  31. public override var description: String {
  32. return toJSONString(prettyPrint: true) ?? ""
  33. }
  34. var value:Bool?
  35. }
  36. // 短信验证码返回
  37. public class O2MobileCodeResModel: NSObject, DataModel, NSCoding {
  38. public func encode(with aCoder: NSCoder) {
  39. if answer != nil {
  40. aCoder.encode(answer, forKey: "answer")
  41. }
  42. }
  43. public required init?(coder aDecoder: NSCoder) {
  44. answer = aDecoder.decodeObject(forKey: "answer") as? String
  45. }
  46. required public override init() {}
  47. public override var description: String {
  48. return toJSONString(prettyPrint: true) ?? ""
  49. }
  50. @objc var answer: String?
  51. }
  52. /// 中心服务器节点Model
  53. public protocol IO2BindUnitModel: HandyJSON, CustomStringConvertible {
  54. var id:String? { get set }
  55. var pinyin:String? { get set }
  56. var pinyinInitial:String? { get set }
  57. var httpProtocol:String? { get set }
  58. var name:String? { get set }
  59. var centerHost:String? { get set }
  60. var centerContext:String? { get set }
  61. var centerPort:Int? { get set }
  62. }
  63. open class O2BindUnitModel: NSObject, DataModel, NSCoding, IO2BindUnitModel {
  64. @objc open var id:String?
  65. @objc open var pinyin:String?
  66. @objc open var pinyinInitial:String?
  67. @objc open var httpProtocol:String?
  68. @objc open var name:String?
  69. @objc open var centerHost:String?
  70. @objc open var centerContext:String?
  71. open var centerPort:Int?
  72. public func encode(with aCoder: NSCoder) {
  73. if id != nil {
  74. aCoder.encode(id, forKey: "id")
  75. }
  76. if pinyin != nil {
  77. aCoder.encode(pinyin, forKey: "pinyin")
  78. }
  79. if httpProtocol != nil {
  80. aCoder.encode(httpProtocol, forKey: "httpProtocol")
  81. }
  82. if pinyinInitial != nil {
  83. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  84. }
  85. if name != nil {
  86. aCoder.encode(name, forKey: "name")
  87. }
  88. if centerHost != nil {
  89. aCoder.encode(centerHost, forKey: "centerHost")
  90. }
  91. if centerContext != nil {
  92. aCoder.encode(centerContext, forKey: "centerContext")
  93. }
  94. if centerPort != nil {
  95. aCoder.encode(centerPort, forKey: "centerPort")
  96. }
  97. }
  98. public required init?(coder aDecoder: NSCoder) {
  99. id = aDecoder.decodeObject(forKey: "id") as? String
  100. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  101. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  102. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  103. name = aDecoder.decodeObject(forKey: "name") as? String
  104. centerHost = aDecoder.decodeObject(forKey: "centerHost") as? String
  105. centerContext = aDecoder.decodeObject(forKey: "centerContext") as? String
  106. centerPort = aDecoder.decodeObject(forKey: "centerPort") as? Int
  107. }
  108. required public override init() {}
  109. open override var description: String {
  110. return toJSONString(prettyPrint: true) ?? ""
  111. }
  112. }
  113. /// 手机绑定节点的对象
  114. public protocol IO2BindDeviceModel: HandyJSON, CustomStringConvertible {
  115. //选择的节点名称
  116. var unit:String? { get set }
  117. //手机号码
  118. var mobile:String? { get set }
  119. //验证码
  120. var code:String? { get set }
  121. //设备推送的token
  122. var name:String? { get set }
  123. //设备类型
  124. var deviceType:String { get set }
  125. }
  126. open class O2BindDeviceModel: NSObject, DataModel, NSCoding,IO2BindDeviceModel {
  127. //选择的节点名称
  128. @objc open var unit:String?
  129. //手机号码
  130. @objc open var mobile:String?
  131. //验证码
  132. @objc open var code:String?
  133. //设备推送的token
  134. @objc open var name:String?
  135. //设备类型
  136. @objc open var deviceType:String = "ios"
  137. public func encode(with aCoder: NSCoder) {
  138. if unit != nil {
  139. aCoder.encode(unit, forKey: "unit")
  140. }
  141. if mobile != nil {
  142. aCoder.encode(mobile, forKey: "mobile")
  143. }
  144. if code != nil {
  145. aCoder.encode(code, forKey: "code")
  146. }
  147. if name != nil {
  148. aCoder.encode(name, forKey: "name")
  149. }
  150. aCoder.encode(deviceType, forKey: "deviceType")
  151. }
  152. public required init?(coder aDecoder: NSCoder) {
  153. unit = aDecoder.decodeObject(forKey: "unit") as? String
  154. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  155. code = aDecoder.decodeObject(forKey: "code") as? String
  156. name = aDecoder.decodeObject(forKey: "name") as? String
  157. deviceType = aDecoder.decodeObject(forKey: "deviceType") as! String
  158. }
  159. required public override init() {}
  160. open override var description: String {
  161. return toJSONString(prettyPrint: true) ?? ""
  162. }
  163. }
  164. //MARK: - 中心服务器相关对象
  165. /// api服务模块信息对象
  166. public protocol IO2APIServerModel: HandyJSON, CustomStringConvertible {
  167. var httpProtocol:String? { get set }
  168. var host:String? { get set }
  169. var name:String? { get set }
  170. var context:String? { get set }
  171. var port:Int? { get set }
  172. }
  173. open class O2APIServerModel: NSObject, DataModel, NSCoding, IO2APIServerModel {
  174. @objc open var httpProtocol:String?
  175. @objc open var host:String?
  176. @objc open var name:String?
  177. @objc open var context:String?
  178. open var port:Int?
  179. public func encode(with aCoder: NSCoder) {
  180. if httpProtocol != nil {
  181. aCoder.encode(httpProtocol, forKey: "httpProtocol")
  182. }
  183. if name != nil {
  184. aCoder.encode(name, forKey: "name")
  185. }
  186. if host != nil {
  187. aCoder.encode(host, forKey: "host")
  188. }
  189. if context != nil {
  190. aCoder.encode(context, forKey: "context")
  191. }
  192. if port != nil {
  193. aCoder.encode(port, forKey: "port")
  194. }
  195. }
  196. public required init?(coder aDecoder: NSCoder) {
  197. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  198. name = aDecoder.decodeObject(forKey: "name") as? String
  199. host = aDecoder.decodeObject(forKey: "host") as? String
  200. context = aDecoder.decodeObject(forKey: "context") as? String
  201. port = aDecoder.decodeObject(forKey: "port") as? Int
  202. }
  203. required public override init() {}
  204. open override var description: String {
  205. return toJSONString(prettyPrint: true) ?? ""
  206. }
  207. }
  208. /// web服务器信息对象
  209. public protocol IO2WebServerModel: HandyJSON, CustomStringConvertible {
  210. var httpProtocol:String? { get set }
  211. var host:String? { get set }
  212. var port:Int? { get set }
  213. }
  214. open class O2WebServerModel: NSObject, DataModel, NSCoding, IO2WebServerModel {
  215. @objc open var httpProtocol:String?
  216. @objc open var host:String?
  217. open var port:Int?
  218. public func encode(with aCoder: NSCoder) {
  219. if httpProtocol != nil {
  220. aCoder.encode(httpProtocol, forKey: "httpProtocol")
  221. }
  222. if host != nil {
  223. aCoder.encode(host, forKey: "host")
  224. }
  225. if port != nil {
  226. aCoder.encode(port, forKey: "port")
  227. }
  228. }
  229. public required init?(coder aDecoder: NSCoder) {
  230. httpProtocol = aDecoder.decodeObject(forKey: "httpProtocol") as? String
  231. host = aDecoder.decodeObject(forKey: "host") as? String
  232. port = aDecoder.decodeObject(forKey: "port") as? Int
  233. }
  234. required public override init() {}
  235. open override var description: String {
  236. return toJSONString(prettyPrint: true) ?? ""
  237. }
  238. }
  239. /// 中心服务器信息对象
  240. public protocol IO2CenterServerModel: HandyJSON, CustomStringConvertible {
  241. var assembles:[String: O2APIServerModel]? { get set }
  242. var webServer: O2WebServerModel? { get set }
  243. }
  244. open class O2CenterServerModel: NSObject, DataModel, NSCoding, IO2CenterServerModel {
  245. @objc open var assembles:[String: O2APIServerModel]?
  246. @objc open var webServer: O2WebServerModel?
  247. public func encode(with aCoder: NSCoder) {
  248. if assembles != nil {
  249. aCoder.encode(assembles, forKey: "assembles")
  250. }
  251. if webServer != nil {
  252. aCoder.encode(webServer, forKey: "webServer")
  253. }
  254. }
  255. public required init?(coder aDecoder: NSCoder) {
  256. assembles = aDecoder.decodeObject(forKey: "assembles") as? [String : O2APIServerModel]
  257. webServer = aDecoder.decodeObject(forKey: "webServer") as? O2WebServerModel
  258. }
  259. required public override init() {}
  260. open override var description: String {
  261. return toJSONString(prettyPrint: true) ?? ""
  262. }
  263. }
  264. //MARK: - 登录认证相关的对象
  265. /// 当前登录用户对象信息
  266. public protocol IO2LoginAccountModel: HandyJSON, CustomStringConvertible {
  267. var changePasswordTime : String? { get set }
  268. var controllerList : [AnyObject]? { get set }
  269. var createTime : String? { get set }
  270. var distinguishedName : String? { get set }
  271. var employee : String? { get set }
  272. var genderType : String? { get set }
  273. var icon : String? { get set }
  274. var id : String? { get set }
  275. var lastLoginAddress : String? { get set }
  276. var lastLoginClient : String? { get set }
  277. var lastLoginTime : String? { get set }
  278. var mail : String? { get set }
  279. var mobile : String? { get set }
  280. var name : String? { get set }
  281. var passwordExpired : Bool? { get set }
  282. var pinyin : String? { get set }
  283. var pinyinInitial : String? { get set }
  284. var qq : String? { get set }
  285. var roleList : [AnyObject]? { get set }
  286. var token : String? { get set }
  287. var tokenType : String? { get set }
  288. var unique : String? { get set }
  289. var updateTime : String? { get set }
  290. var weixin : String? { get set }
  291. }
  292. open class O2LoginAccountModel: NSObject, DataModel, NSCoding, IO2LoginAccountModel {
  293. @objc open var changePasswordTime : String?
  294. @objc open var controllerList : [AnyObject]?
  295. @objc open var createTime : String?
  296. @objc open var distinguishedName : String?
  297. @objc open var employee : String?
  298. @objc open var genderType : String?
  299. @objc open var icon : String?
  300. @objc open var id : String?
  301. @objc open var lastLoginAddress : String?
  302. @objc open var lastLoginClient : String?
  303. @objc open var lastLoginTime : String?
  304. @objc open var mail : String?
  305. @objc open var mobile : String?
  306. @objc open var name : String?
  307. open var passwordExpired : Bool?
  308. @objc open var pinyin : String?
  309. @objc open var pinyinInitial : String?
  310. @objc open var qq : String?
  311. @objc open var roleList : [AnyObject]?
  312. @objc open var token : String?
  313. @objc open var tokenType : String?
  314. @objc open var unique : String?
  315. @objc open var updateTime : String?
  316. @objc open var weixin : String?
  317. public func encode(with aCoder: NSCoder) {
  318. if changePasswordTime != nil{
  319. aCoder.encode(changePasswordTime, forKey: "changePasswordTime")
  320. }
  321. if controllerList != nil{
  322. aCoder.encode(controllerList, forKey: "controllerList")
  323. }
  324. if createTime != nil{
  325. aCoder.encode(createTime, forKey: "createTime")
  326. }
  327. if distinguishedName != nil{
  328. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  329. }
  330. if employee != nil{
  331. aCoder.encode(employee, forKey: "employee")
  332. }
  333. if genderType != nil{
  334. aCoder.encode(genderType, forKey: "genderType")
  335. }
  336. if icon != nil{
  337. aCoder.encode(icon, forKey: "icon")
  338. }
  339. if id != nil{
  340. aCoder.encode(id, forKey: "id")
  341. }
  342. if lastLoginAddress != nil{
  343. aCoder.encode(lastLoginAddress, forKey: "lastLoginAddress")
  344. }
  345. if lastLoginClient != nil{
  346. aCoder.encode(lastLoginClient, forKey: "lastLoginClient")
  347. }
  348. if lastLoginTime != nil{
  349. aCoder.encode(lastLoginTime, forKey: "lastLoginTime")
  350. }
  351. if mail != nil{
  352. aCoder.encode(mail, forKey: "mail")
  353. }
  354. if mobile != nil{
  355. aCoder.encode(mobile, forKey: "mobile")
  356. }
  357. if name != nil{
  358. aCoder.encode(name, forKey: "name")
  359. }
  360. if passwordExpired != nil{
  361. aCoder.encode(passwordExpired, forKey: "passwordExpired")
  362. }
  363. if pinyin != nil{
  364. aCoder.encode(pinyin, forKey: "pinyin")
  365. }
  366. if pinyinInitial != nil{
  367. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  368. }
  369. if qq != nil{
  370. aCoder.encode(qq, forKey: "qq")
  371. }
  372. if roleList != nil{
  373. aCoder.encode(roleList, forKey: "roleList")
  374. }
  375. if token != nil{
  376. aCoder.encode(token, forKey: "token")
  377. }
  378. if tokenType != nil{
  379. aCoder.encode(tokenType, forKey: "tokenType")
  380. }
  381. if unique != nil{
  382. aCoder.encode(unique, forKey: "unique")
  383. }
  384. if updateTime != nil{
  385. aCoder.encode(updateTime, forKey: "updateTime")
  386. }
  387. if weixin != nil{
  388. aCoder.encode(weixin, forKey: "weixin")
  389. }
  390. }
  391. public required init?(coder aDecoder: NSCoder) {
  392. changePasswordTime = aDecoder.decodeObject(forKey: "changePasswordTime") as? String
  393. controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [AnyObject]
  394. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  395. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  396. employee = aDecoder.decodeObject(forKey: "employee") as? String
  397. genderType = aDecoder.decodeObject(forKey: "genderType") as? String
  398. icon = aDecoder.decodeObject(forKey: "icon") as? String
  399. id = aDecoder.decodeObject(forKey: "id") as? String
  400. lastLoginAddress = aDecoder.decodeObject(forKey: "lastLoginAddress") as? String
  401. lastLoginClient = aDecoder.decodeObject(forKey: "lastLoginClient") as? String
  402. lastLoginTime = aDecoder.decodeObject(forKey: "lastLoginTime") as? String
  403. mail = aDecoder.decodeObject(forKey: "mail") as? String
  404. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  405. name = aDecoder.decodeObject(forKey: "name") as? String
  406. passwordExpired = aDecoder.decodeObject(forKey: "passwordExpired") as? Bool
  407. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  408. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  409. qq = aDecoder.decodeObject(forKey: "qq") as? String
  410. roleList = aDecoder.decodeObject(forKey: "roleList") as? [AnyObject]
  411. token = aDecoder.decodeObject(forKey: "token") as? String
  412. tokenType = aDecoder.decodeObject(forKey: "tokenType") as? String
  413. unique = aDecoder.decodeObject(forKey: "unique") as? String
  414. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  415. weixin = aDecoder.decodeObject(forKey: "weixin") as? String
  416. }
  417. required public override init() {}
  418. open override var description: String {
  419. return toJSONString(prettyPrint: true) ?? ""
  420. }
  421. }
  422. //MARK: - customStyle 移动端样式配置相关对象
  423. /// 自定义图片对象
  424. public protocol IO2CustomImageModel: HandyJSON, CustomStringConvertible {
  425. var name : String? { get set }
  426. var value : String? { get set }
  427. }
  428. open class O2CustomImageModel: NSObject, DataModel, NSCoding, IO2CustomImageModel {
  429. @objc open var name : String?
  430. @objc open var value : String? // base64 图片
  431. public func encode(with aCoder: NSCoder) {
  432. if name != nil {
  433. aCoder.encode(name, forKey: "name")
  434. }
  435. if value != nil {
  436. aCoder.encode(value, forKey: "value")
  437. }
  438. }
  439. public required init?(coder aDecoder: NSCoder) {
  440. name = aDecoder.decodeObject(forKey: "name") as? String
  441. value = aDecoder.decodeObject(forKey: "value") as? String
  442. }
  443. required public override init() {}
  444. open override var description: String {
  445. return toJSONString(prettyPrint: true) ?? ""
  446. }
  447. }
  448. public protocol IO2CustomIosModel: HandyJSON, CustomStringConvertible {
  449. var category : String? { get set }
  450. var storyboard : String? { get set }
  451. var subcategory : String? { get set }
  452. var vcname : String? { get set }
  453. }
  454. open class O2CustomIosModel: NSObject, DataModel, NSCoding, IO2CustomIosModel {
  455. @objc open var category : String?
  456. @objc open var storyboard : String?
  457. @objc open var subcategory : String?
  458. @objc open var vcname : String?
  459. public func encode(with aCoder: NSCoder) {
  460. if category != nil {
  461. aCoder.encode(category, forKey: "category")
  462. }
  463. if storyboard != nil {
  464. aCoder.encode(storyboard, forKey: "storyboard")
  465. }
  466. if subcategory != nil {
  467. aCoder.encode(subcategory, forKey: "subcategory")
  468. }
  469. if vcname != nil {
  470. aCoder.encode(vcname, forKey: "vcname")
  471. }
  472. }
  473. public required init?(coder aDecoder: NSCoder) {
  474. category = aDecoder.decodeObject(forKey: "category") as? String
  475. storyboard = aDecoder.decodeObject(forKey: "storyboard") as? String
  476. subcategory = aDecoder.decodeObject(forKey: "subcategory") as? String
  477. vcname = aDecoder.decodeObject(forKey: "vcname") as? String
  478. }
  479. required public override init() {}
  480. open override var description: String {
  481. return toJSONString(prettyPrint: true) ?? ""
  482. }
  483. }
  484. public protocol IO2CustomNativeAppModel: HandyJSON, CustomStringConvertible {
  485. var enable : Bool? { get set }
  486. var iOS : O2CustomIosModel? { get set }
  487. var id : Int? { get set }
  488. var key : String? { get set }
  489. var name : String? { get set }
  490. }
  491. open class O2CustomNativeAppModel: NSObject, DataModel, NSCoding, IO2CustomNativeAppModel {
  492. open var enable : Bool?
  493. @objc open var iOS : O2CustomIosModel?
  494. open var id : Int?
  495. @objc open var key : String?
  496. @objc open var name : String?
  497. public func encode(with aCoder: NSCoder) {
  498. if enable != nil {
  499. aCoder.encode(enable, forKey: "enable")
  500. }
  501. if iOS != nil {
  502. aCoder.encode(iOS, forKey: "iOS")
  503. }
  504. if id != nil {
  505. aCoder.encode(id, forKey: "id")
  506. }
  507. if key != nil {
  508. aCoder.encode(key, forKey: "key")
  509. }
  510. if name != nil {
  511. aCoder.encode(name, forKey: "name")
  512. }
  513. }
  514. public required init?(coder aDecoder: NSCoder) {
  515. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  516. iOS = aDecoder.decodeObject(forKey: "iOS") as? O2CustomIosModel
  517. id = aDecoder.decodeObject(forKey: "id") as? Int
  518. key = aDecoder.decodeObject(forKey: "key") as? String
  519. name = aDecoder.decodeObject(forKey: "name") as? String
  520. }
  521. required public override init() {}
  522. open override var description: String {
  523. return toJSONString(prettyPrint: true) ?? ""
  524. }
  525. }
  526. public protocol IO2CustomPortalAppModel: HandyJSON, CustomStringConvertible {
  527. var alias : String? { get set }
  528. var createTime : String? { get set }
  529. var creatorPerson : String? { get set }
  530. var descriptionField : String? { get set }
  531. var enable : Bool? { get set }
  532. var firstPage : String? { get set }
  533. var id : String? { get set }
  534. var lastUpdatePerson : String? { get set }
  535. var lastUpdateTime : String? { get set }
  536. var name : String? { get set }
  537. var portalCategory : String? { get set }
  538. var updateTime : String? { get set }
  539. }
  540. open class O2CustomPortalAppModel: NSObject, DataModel, NSCoding, IO2CustomPortalAppModel {
  541. @objc open var alias : String?
  542. @objc open var createTime : String?
  543. @objc open var creatorPerson : String?
  544. @objc open var descriptionField : String?
  545. open var enable : Bool?
  546. @objc open var firstPage : String?
  547. @objc open var id : String?
  548. @objc open var lastUpdatePerson : String?
  549. @objc open var lastUpdateTime : String?
  550. @objc open var name : String?
  551. @objc open var portalCategory : String?
  552. @objc open var updateTime : String?
  553. public func encode(with aCoder: NSCoder) {
  554. if alias != nil {
  555. aCoder.encode(alias, forKey: "alias")
  556. }
  557. if createTime != nil {
  558. aCoder.encode(createTime, forKey: "createTime")
  559. }
  560. if creatorPerson != nil {
  561. aCoder.encode(creatorPerson, forKey: "creatorPerson")
  562. }
  563. if descriptionField != nil {
  564. aCoder.encode(descriptionField, forKey: "descriptionField")
  565. }
  566. if enable != nil {
  567. aCoder.encode(enable, forKey: "enable")
  568. }
  569. if firstPage != nil {
  570. aCoder.encode(firstPage, forKey: "firstPage")
  571. }
  572. if id != nil {
  573. aCoder.encode(id, forKey: "id")
  574. }
  575. if lastUpdatePerson != nil {
  576. aCoder.encode(lastUpdatePerson, forKey: "lastUpdatePerson")
  577. }
  578. if lastUpdateTime != nil {
  579. aCoder.encode(lastUpdateTime, forKey: "lastUpdateTime")
  580. }
  581. if name != nil {
  582. aCoder.encode(name, forKey: "name")
  583. }
  584. if portalCategory != nil {
  585. aCoder.encode(portalCategory, forKey: "portalCategory")
  586. }
  587. if updateTime != nil {
  588. aCoder.encode(updateTime, forKey: "updateTime")
  589. }
  590. }
  591. public required init?(coder aDecoder: NSCoder) {
  592. alias = aDecoder.decodeObject(forKey: "alias") as? String
  593. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  594. creatorPerson = aDecoder.decodeObject(forKey: "creatorPerson") as? String
  595. descriptionField = aDecoder.decodeObject(forKey: "descriptionField") as? String
  596. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  597. firstPage = aDecoder.decodeObject(forKey: "firstPage") as? String
  598. id = aDecoder.decodeObject(forKey: "id") as? String
  599. lastUpdatePerson = aDecoder.decodeObject(forKey: "lastUpdatePerson") as? String
  600. lastUpdateTime = aDecoder.decodeObject(forKey: "lastUpdateTime") as? String
  601. name = aDecoder.decodeObject(forKey: "name") as? String
  602. portalCategory = aDecoder.decodeObject(forKey: "portalCategory") as? String
  603. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  604. }
  605. required public override init() {}
  606. open override var description: String {
  607. return toJSONString(prettyPrint: true) ?? ""
  608. }
  609. }
  610. /// 样式配置对象
  611. public protocol IO2CustomStyleModel: HandyJSON, CustomStringConvertible {
  612. var images : [O2CustomImageModel]? { get set }
  613. var indexPortal : String? { get set }
  614. var indexType : String? { get set }
  615. var nativeAppList : [O2CustomNativeAppModel]? { get set }
  616. var portalList : [O2CustomPortalAppModel]? { get set }
  617. var simpleMode: Bool? { get set } /// 简易模式
  618. }
  619. open class O2CustomStyleModel: NSObject, DataModel, NSCoding, IO2CustomStyleModel {
  620. @objc open var images : [O2CustomImageModel]?
  621. @objc open var indexPortal : String?
  622. @objc open var indexType : String?
  623. @objc open var nativeAppList : [O2CustomNativeAppModel]?
  624. @objc open var portalList : [O2CustomPortalAppModel]?
  625. open var simpleMode: Bool?
  626. @objc public func encode(with aCoder: NSCoder) {
  627. if images != nil {
  628. aCoder.encode(images, forKey: "images")
  629. }
  630. if indexPortal != nil {
  631. aCoder.encode(indexPortal, forKey: "indexPortal")
  632. }
  633. if indexType != nil {
  634. aCoder.encode(indexType, forKey: "indexType")
  635. }
  636. if nativeAppList != nil {
  637. aCoder.encode(nativeAppList, forKey: "nativeAppList")
  638. }
  639. if portalList != nil {
  640. aCoder.encode(portalList, forKey: "portalList")
  641. }
  642. if simpleMode != nil {
  643. aCoder.encode(simpleMode, forKey: "simpleMode")
  644. }
  645. }
  646. @objc public required init?(coder aDecoder: NSCoder) {
  647. images = aDecoder.decodeObject(forKey: "images") as? [O2CustomImageModel]
  648. indexPortal = aDecoder.decodeObject(forKey: "indexPortal") as? String
  649. indexType = aDecoder.decodeObject(forKey: "indexType") as? String
  650. nativeAppList = aDecoder.decodeObject(forKey: "nativeAppList") as? [O2CustomNativeAppModel]
  651. portalList = aDecoder.decodeObject(forKey: "portalList") as? [O2CustomPortalAppModel]
  652. simpleMode = aDecoder.decodeObject(forKey: "simpleMode") as? Bool
  653. }
  654. required public override init() {}
  655. open override var description: String {
  656. return toJSONString(prettyPrint: true) ?? ""
  657. }
  658. }
  659. /// 移动端应用对象, 服务器提供移动端 可以展现的应用列表
  660. public protocol IO2AppModel: HandyJSON, CustomStringConvertible {
  661. var id : String? { get set } // native应用里面的key portal应用里面的id
  662. var name: String? { get set }
  663. var portalUrl: String? { get set } // portal应用的访问地址
  664. var portalCategory : String? { get set } //
  665. var type: String? { get set } //分类 native portal
  666. var enable : Bool? { get set } // 是否启用
  667. }
  668. open class O2AppModel: NSObject, DataModel, NSCoding, IO2AppModel {
  669. @objc open var id: String?
  670. @objc open var name: String?
  671. @objc open var portalUrl: String?
  672. @objc open var portalCategory: String?
  673. @objc open var type: String?
  674. open var enable: Bool?
  675. required public override init() {}
  676. open override var description: String {
  677. return toJSONString(prettyPrint: true) ?? ""
  678. }
  679. @objc public func encode(with aCoder: NSCoder) {
  680. if id != nil {
  681. aCoder.encode(id, forKey: "id")
  682. }
  683. if name != nil {
  684. aCoder.encode(name, forKey: "name")
  685. }
  686. if portalUrl != nil {
  687. aCoder.encode(portalUrl, forKey: "portalUrl")
  688. }
  689. if portalCategory != nil {
  690. aCoder.encode(portalCategory, forKey: "portalCategory")
  691. }
  692. if type != nil {
  693. aCoder.encode(type, forKey: "type")
  694. }
  695. if enable != nil {
  696. aCoder.encode(enable, forKey: "enable")
  697. }
  698. }
  699. @objc public required init?(coder aDecoder: NSCoder) {
  700. id = aDecoder.decodeObject(forKey: "id") as? String
  701. name = aDecoder.decodeObject(forKey: "name") as? String
  702. portalUrl = aDecoder.decodeObject(forKey: "portalUrl") as? String
  703. portalCategory = aDecoder.decodeObject(forKey: "portalCategory") as? String
  704. type = aDecoder.decodeObject(forKey: "type") as? String
  705. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  706. }
  707. }