O2AuthenticationModels.swift 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859
  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. var tokenName: String? { get set }
  244. }
  245. open class O2CenterServerModel: NSObject, DataModel, NSCoding, IO2CenterServerModel {
  246. @objc open var assembles:[String: O2APIServerModel]?
  247. @objc open var webServer: O2WebServerModel?
  248. @objc open var tokenName: String? // tokenName是可修改的 x-token是默认值
  249. public func encode(with aCoder: NSCoder) {
  250. if assembles != nil {
  251. aCoder.encode(assembles, forKey: "assembles")
  252. }
  253. if webServer != nil {
  254. aCoder.encode(webServer, forKey: "webServer")
  255. }
  256. if tokenName != nil {
  257. aCoder.encode(tokenName, forKey: "tokenName")
  258. }
  259. }
  260. public required init?(coder aDecoder: NSCoder) {
  261. assembles = aDecoder.decodeObject(forKey: "assembles") as? [String : O2APIServerModel]
  262. webServer = aDecoder.decodeObject(forKey: "webServer") as? O2WebServerModel
  263. tokenName = aDecoder.decodeObject(forKey: "tokenName") as? String
  264. }
  265. required public override init() {}
  266. open override var description: String {
  267. return toJSONString(prettyPrint: true) ?? ""
  268. }
  269. }
  270. //MARK: - 登录认证相关的对象
  271. /// 当前登录用户对象信息
  272. public protocol IO2LoginAccountModel: HandyJSON, CustomStringConvertible {
  273. var changePasswordTime : String? { get set }
  274. var controllerList : [AnyObject]? { get set }
  275. var createTime : String? { get set }
  276. var distinguishedName : String? { get set }
  277. var employee : String? { get set }
  278. var genderType : String? { get set }
  279. var icon : String? { get set }
  280. var id : String? { get set }
  281. var lastLoginAddress : String? { get set }
  282. var lastLoginClient : String? { get set }
  283. var lastLoginTime : String? { get set }
  284. var mail : String? { get set }
  285. var mobile : String? { get set }
  286. var name : String? { get set }
  287. var passwordExpired : Bool? { get set }
  288. var pinyin : String? { get set }
  289. var pinyinInitial : String? { get set }
  290. var qq : String? { get set }
  291. var roleList : [AnyObject]? { get set }
  292. var token : String? { get set }
  293. var tokenType : String? { get set }
  294. var unique : String? { get set }
  295. var updateTime : String? { get set }
  296. var weixin : String? { get set }
  297. }
  298. open class O2LoginAccountModel: NSObject, DataModel, NSCoding, IO2LoginAccountModel {
  299. @objc open var changePasswordTime : String?
  300. @objc open var controllerList : [AnyObject]?
  301. @objc open var createTime : String?
  302. @objc open var distinguishedName : String?
  303. @objc open var employee : String?
  304. @objc open var genderType : String?
  305. @objc open var icon : String?
  306. @objc open var id : String?
  307. @objc open var lastLoginAddress : String?
  308. @objc open var lastLoginClient : String?
  309. @objc open var lastLoginTime : String?
  310. @objc open var mail : String?
  311. @objc open var mobile : String?
  312. @objc open var name : String?
  313. open var passwordExpired : Bool?
  314. @objc open var pinyin : String?
  315. @objc open var pinyinInitial : String?
  316. @objc open var qq : String?
  317. @objc open var roleList : [AnyObject]?
  318. @objc open var token : String?
  319. @objc open var tokenType : String?
  320. @objc open var unique : String?
  321. @objc open var updateTime : String?
  322. @objc open var weixin : String?
  323. @objc open var signature: String?
  324. public func encode(with aCoder: NSCoder) {
  325. if changePasswordTime != nil{
  326. aCoder.encode(changePasswordTime, forKey: "changePasswordTime")
  327. }
  328. if controllerList != nil{
  329. aCoder.encode(controllerList, forKey: "controllerList")
  330. }
  331. if createTime != nil{
  332. aCoder.encode(createTime, forKey: "createTime")
  333. }
  334. if distinguishedName != nil{
  335. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  336. }
  337. if employee != nil{
  338. aCoder.encode(employee, forKey: "employee")
  339. }
  340. if genderType != nil{
  341. aCoder.encode(genderType, forKey: "genderType")
  342. }
  343. if icon != nil{
  344. aCoder.encode(icon, forKey: "icon")
  345. }
  346. if id != nil{
  347. aCoder.encode(id, forKey: "id")
  348. }
  349. if lastLoginAddress != nil{
  350. aCoder.encode(lastLoginAddress, forKey: "lastLoginAddress")
  351. }
  352. if lastLoginClient != nil{
  353. aCoder.encode(lastLoginClient, forKey: "lastLoginClient")
  354. }
  355. if lastLoginTime != nil{
  356. aCoder.encode(lastLoginTime, forKey: "lastLoginTime")
  357. }
  358. if mail != nil{
  359. aCoder.encode(mail, forKey: "mail")
  360. }
  361. if mobile != nil{
  362. aCoder.encode(mobile, forKey: "mobile")
  363. }
  364. if name != nil{
  365. aCoder.encode(name, forKey: "name")
  366. }
  367. if passwordExpired != nil{
  368. aCoder.encode(passwordExpired, forKey: "passwordExpired")
  369. }
  370. if pinyin != nil{
  371. aCoder.encode(pinyin, forKey: "pinyin")
  372. }
  373. if pinyinInitial != nil{
  374. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  375. }
  376. if qq != nil{
  377. aCoder.encode(qq, forKey: "qq")
  378. }
  379. if roleList != nil{
  380. aCoder.encode(roleList, forKey: "roleList")
  381. }
  382. if token != nil{
  383. aCoder.encode(token, forKey: "token")
  384. }
  385. if tokenType != nil{
  386. aCoder.encode(tokenType, forKey: "tokenType")
  387. }
  388. if unique != nil{
  389. aCoder.encode(unique, forKey: "unique")
  390. }
  391. if updateTime != nil{
  392. aCoder.encode(updateTime, forKey: "updateTime")
  393. }
  394. if weixin != nil{
  395. aCoder.encode(weixin, forKey: "weixin")
  396. }
  397. if signature != nil {
  398. aCoder.encode(signature, forKey: "signature")
  399. }
  400. }
  401. public required init?(coder aDecoder: NSCoder) {
  402. changePasswordTime = aDecoder.decodeObject(forKey: "changePasswordTime") as? String
  403. controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [AnyObject]
  404. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  405. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  406. employee = aDecoder.decodeObject(forKey: "employee") as? String
  407. genderType = aDecoder.decodeObject(forKey: "genderType") as? String
  408. icon = aDecoder.decodeObject(forKey: "icon") as? String
  409. id = aDecoder.decodeObject(forKey: "id") as? String
  410. lastLoginAddress = aDecoder.decodeObject(forKey: "lastLoginAddress") as? String
  411. lastLoginClient = aDecoder.decodeObject(forKey: "lastLoginClient") as? String
  412. lastLoginTime = aDecoder.decodeObject(forKey: "lastLoginTime") as? String
  413. mail = aDecoder.decodeObject(forKey: "mail") as? String
  414. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  415. name = aDecoder.decodeObject(forKey: "name") as? String
  416. passwordExpired = aDecoder.decodeObject(forKey: "passwordExpired") as? Bool
  417. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  418. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  419. qq = aDecoder.decodeObject(forKey: "qq") as? String
  420. roleList = aDecoder.decodeObject(forKey: "roleList") as? [AnyObject]
  421. token = aDecoder.decodeObject(forKey: "token") as? String
  422. tokenType = aDecoder.decodeObject(forKey: "tokenType") as? String
  423. unique = aDecoder.decodeObject(forKey: "unique") as? String
  424. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  425. weixin = aDecoder.decodeObject(forKey: "weixin") as? String
  426. signature = aDecoder.decodeObject(forKey: "signature") as? String
  427. }
  428. required public override init() {}
  429. open override var description: String {
  430. return toJSONString(prettyPrint: true) ?? ""
  431. }
  432. }
  433. //MARK: - customStyle 移动端样式配置相关对象
  434. /// 自定义图片对象
  435. public protocol IO2CustomImageModel: HandyJSON, CustomStringConvertible {
  436. var name : String? { get set }
  437. var value : String? { get set }
  438. }
  439. open class O2CustomImageModel: NSObject, DataModel, NSCoding, IO2CustomImageModel {
  440. @objc open var name : String?
  441. @objc open var value : String? // base64 图片
  442. public func encode(with aCoder: NSCoder) {
  443. if name != nil {
  444. aCoder.encode(name, forKey: "name")
  445. }
  446. if value != nil {
  447. aCoder.encode(value, forKey: "value")
  448. }
  449. }
  450. public required init?(coder aDecoder: NSCoder) {
  451. name = aDecoder.decodeObject(forKey: "name") as? String
  452. value = aDecoder.decodeObject(forKey: "value") as? String
  453. }
  454. required public override init() {}
  455. open override var description: String {
  456. return toJSONString(prettyPrint: true) ?? ""
  457. }
  458. }
  459. public protocol IO2CustomIosModel: HandyJSON, CustomStringConvertible {
  460. var category : String? { get set }
  461. var storyboard : String? { get set }
  462. var subcategory : String? { get set }
  463. var vcname : String? { get set }
  464. }
  465. open class O2CustomIosModel: NSObject, DataModel, NSCoding, IO2CustomIosModel {
  466. @objc open var category : String?
  467. @objc open var storyboard : String?
  468. @objc open var subcategory : String?
  469. @objc open var vcname : String?
  470. public func encode(with aCoder: NSCoder) {
  471. if category != nil {
  472. aCoder.encode(category, forKey: "category")
  473. }
  474. if storyboard != nil {
  475. aCoder.encode(storyboard, forKey: "storyboard")
  476. }
  477. if subcategory != nil {
  478. aCoder.encode(subcategory, forKey: "subcategory")
  479. }
  480. if vcname != nil {
  481. aCoder.encode(vcname, forKey: "vcname")
  482. }
  483. }
  484. public required init?(coder aDecoder: NSCoder) {
  485. category = aDecoder.decodeObject(forKey: "category") as? String
  486. storyboard = aDecoder.decodeObject(forKey: "storyboard") as? String
  487. subcategory = aDecoder.decodeObject(forKey: "subcategory") as? String
  488. vcname = aDecoder.decodeObject(forKey: "vcname") as? String
  489. }
  490. required public override init() {}
  491. open override var description: String {
  492. return toJSONString(prettyPrint: true) ?? ""
  493. }
  494. }
  495. public protocol IO2CustomNativeAppModel: HandyJSON, CustomStringConvertible {
  496. var enable : Bool? { get set }
  497. var iOS : O2CustomIosModel? { get set }
  498. var id : Int? { get set }
  499. var key : String? { get set }
  500. var name : String? { get set }
  501. }
  502. open class O2CustomNativeAppModel: NSObject, DataModel, NSCoding, IO2CustomNativeAppModel {
  503. open var enable : Bool?
  504. @objc open var iOS : O2CustomIosModel?
  505. open var id : Int?
  506. @objc open var key : String?
  507. @objc open var name : String?
  508. public func encode(with aCoder: NSCoder) {
  509. if enable != nil {
  510. aCoder.encode(enable, forKey: "enable")
  511. }
  512. if iOS != nil {
  513. aCoder.encode(iOS, forKey: "iOS")
  514. }
  515. if id != nil {
  516. aCoder.encode(id, forKey: "id")
  517. }
  518. if key != nil {
  519. aCoder.encode(key, forKey: "key")
  520. }
  521. if name != nil {
  522. aCoder.encode(name, forKey: "name")
  523. }
  524. }
  525. public required init?(coder aDecoder: NSCoder) {
  526. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  527. iOS = aDecoder.decodeObject(forKey: "iOS") as? O2CustomIosModel
  528. id = aDecoder.decodeObject(forKey: "id") as? Int
  529. key = aDecoder.decodeObject(forKey: "key") as? String
  530. name = aDecoder.decodeObject(forKey: "name") as? String
  531. }
  532. required public override init() {}
  533. open override var description: String {
  534. return toJSONString(prettyPrint: true) ?? ""
  535. }
  536. }
  537. public protocol IO2CustomPortalAppModel: HandyJSON, CustomStringConvertible {
  538. var alias : String? { get set }
  539. var createTime : String? { get set }
  540. var creatorPerson : String? { get set }
  541. var descriptionField : String? { get set }
  542. var enable : Bool? { get set }
  543. var firstPage : String? { get set }
  544. var id : String? { get set }
  545. var lastUpdatePerson : String? { get set }
  546. var lastUpdateTime : String? { get set }
  547. var name : String? { get set }
  548. var portalCategory : String? { get set }
  549. var updateTime : String? { get set }
  550. }
  551. open class O2CustomPortalAppModel: NSObject, DataModel, NSCoding, IO2CustomPortalAppModel {
  552. @objc open var alias : String?
  553. @objc open var createTime : String?
  554. @objc open var creatorPerson : String?
  555. @objc open var descriptionField : String?
  556. open var enable : Bool?
  557. @objc open var firstPage : String?
  558. @objc open var id : String?
  559. @objc open var lastUpdatePerson : String?
  560. @objc open var lastUpdateTime : String?
  561. @objc open var name : String?
  562. @objc open var portalCategory : String?
  563. @objc open var updateTime : String?
  564. public func encode(with aCoder: NSCoder) {
  565. if alias != nil {
  566. aCoder.encode(alias, forKey: "alias")
  567. }
  568. if createTime != nil {
  569. aCoder.encode(createTime, forKey: "createTime")
  570. }
  571. if creatorPerson != nil {
  572. aCoder.encode(creatorPerson, forKey: "creatorPerson")
  573. }
  574. if descriptionField != nil {
  575. aCoder.encode(descriptionField, forKey: "descriptionField")
  576. }
  577. if enable != nil {
  578. aCoder.encode(enable, forKey: "enable")
  579. }
  580. if firstPage != nil {
  581. aCoder.encode(firstPage, forKey: "firstPage")
  582. }
  583. if id != nil {
  584. aCoder.encode(id, forKey: "id")
  585. }
  586. if lastUpdatePerson != nil {
  587. aCoder.encode(lastUpdatePerson, forKey: "lastUpdatePerson")
  588. }
  589. if lastUpdateTime != nil {
  590. aCoder.encode(lastUpdateTime, forKey: "lastUpdateTime")
  591. }
  592. if name != nil {
  593. aCoder.encode(name, forKey: "name")
  594. }
  595. if portalCategory != nil {
  596. aCoder.encode(portalCategory, forKey: "portalCategory")
  597. }
  598. if updateTime != nil {
  599. aCoder.encode(updateTime, forKey: "updateTime")
  600. }
  601. }
  602. public required init?(coder aDecoder: NSCoder) {
  603. alias = aDecoder.decodeObject(forKey: "alias") as? String
  604. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  605. creatorPerson = aDecoder.decodeObject(forKey: "creatorPerson") as? String
  606. descriptionField = aDecoder.decodeObject(forKey: "descriptionField") as? String
  607. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  608. firstPage = aDecoder.decodeObject(forKey: "firstPage") as? String
  609. id = aDecoder.decodeObject(forKey: "id") as? String
  610. lastUpdatePerson = aDecoder.decodeObject(forKey: "lastUpdatePerson") as? String
  611. lastUpdateTime = aDecoder.decodeObject(forKey: "lastUpdateTime") as? String
  612. name = aDecoder.decodeObject(forKey: "name") as? String
  613. portalCategory = aDecoder.decodeObject(forKey: "portalCategory") as? String
  614. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  615. }
  616. required public override init() {}
  617. open override var description: String {
  618. return toJSONString(prettyPrint: true) ?? ""
  619. }
  620. }
  621. /// 样式配置对象
  622. public protocol IO2CustomStyleModel: HandyJSON, CustomStringConvertible {
  623. var images : [O2CustomImageModel]? { get set }
  624. var indexPortal : String? { get set }
  625. var indexType : String? { get set }
  626. var nativeAppList : [O2CustomNativeAppModel]? { get set }
  627. var portalList : [O2CustomPortalAppModel]? { get set }
  628. var simpleMode: Bool? { get set } /// 简易模式
  629. }
  630. open class O2CustomStyleModel: NSObject, DataModel, NSCoding, IO2CustomStyleModel {
  631. @objc open var images : [O2CustomImageModel]?
  632. @objc open var indexPortal : String?
  633. @objc open var indexType : String?
  634. @objc open var contactPermissionView: String? = O2.CUSTOM_STYLE_CONTACT_PERMISSION_DEFAULT
  635. @objc open var nativeAppList : [O2CustomNativeAppModel]?
  636. @objc open var portalList : [O2CustomPortalAppModel]?
  637. open var simpleMode: Bool?
  638. @objc public func encode(with aCoder: NSCoder) {
  639. if images != nil {
  640. aCoder.encode(images, forKey: "images")
  641. }
  642. if indexPortal != nil {
  643. aCoder.encode(indexPortal, forKey: "indexPortal")
  644. }
  645. if indexType != nil {
  646. aCoder.encode(indexType, forKey: "indexType")
  647. }
  648. if contactPermissionView != nil {
  649. aCoder.encode(contactPermissionView, forKey: "contactPermissionView")
  650. }
  651. if nativeAppList != nil {
  652. aCoder.encode(nativeAppList, forKey: "nativeAppList")
  653. }
  654. if portalList != nil {
  655. aCoder.encode(portalList, forKey: "portalList")
  656. }
  657. if simpleMode != nil {
  658. aCoder.encode(simpleMode, forKey: "simpleMode")
  659. }
  660. }
  661. @objc public required init?(coder aDecoder: NSCoder) {
  662. images = aDecoder.decodeObject(forKey: "images") as? [O2CustomImageModel]
  663. indexPortal = aDecoder.decodeObject(forKey: "indexPortal") as? String
  664. indexType = aDecoder.decodeObject(forKey: "indexType") as? String
  665. contactPermissionView = aDecoder.decodeObject(forKey: "contactPermissionView") as? String
  666. nativeAppList = aDecoder.decodeObject(forKey: "nativeAppList") as? [O2CustomNativeAppModel]
  667. portalList = aDecoder.decodeObject(forKey: "portalList") as? [O2CustomPortalAppModel]
  668. simpleMode = aDecoder.decodeObject(forKey: "simpleMode") as? Bool
  669. }
  670. required public override init() {}
  671. open override var description: String {
  672. return toJSONString(prettyPrint: true) ?? ""
  673. }
  674. }
  675. /// 移动端应用对象, 服务器提供移动端 可以展现的应用列表
  676. public protocol IO2AppModel: HandyJSON, CustomStringConvertible {
  677. var id : String? { get set } // native应用里面的key portal应用里面的id
  678. var name: String? { get set }
  679. var portalUrl: String? { get set } // portal应用的访问地址
  680. var portalCategory : String? { get set } //
  681. var type: String? { get set } //分类 native portal
  682. var enable : Bool? { get set } // 是否启用
  683. }
  684. open class O2AppModel: NSObject, DataModel, NSCoding, IO2AppModel {
  685. @objc open var id: String?
  686. @objc open var name: String?
  687. @objc open var portalUrl: String?
  688. @objc open var portalCategory: String?
  689. @objc open var type: String?
  690. open var enable: Bool?
  691. required public override init() {}
  692. open override var description: String {
  693. return toJSONString(prettyPrint: true) ?? ""
  694. }
  695. @objc public func encode(with aCoder: NSCoder) {
  696. if id != nil {
  697. aCoder.encode(id, forKey: "id")
  698. }
  699. if name != nil {
  700. aCoder.encode(name, forKey: "name")
  701. }
  702. if portalUrl != nil {
  703. aCoder.encode(portalUrl, forKey: "portalUrl")
  704. }
  705. if portalCategory != nil {
  706. aCoder.encode(portalCategory, forKey: "portalCategory")
  707. }
  708. if type != nil {
  709. aCoder.encode(type, forKey: "type")
  710. }
  711. if enable != nil {
  712. aCoder.encode(enable, forKey: "enable")
  713. }
  714. }
  715. @objc public required init?(coder aDecoder: NSCoder) {
  716. id = aDecoder.decodeObject(forKey: "id") as? String
  717. name = aDecoder.decodeObject(forKey: "name") as? String
  718. portalUrl = aDecoder.decodeObject(forKey: "portalUrl") as? String
  719. portalCategory = aDecoder.decodeObject(forKey: "portalCategory") as? String
  720. type = aDecoder.decodeObject(forKey: "type") as? String
  721. enable = aDecoder.decodeObject(forKey: "enable") as? Bool
  722. }
  723. }