bbsModel.swift 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. //
  2. // bbsModel.swift
  3. // O2Platform
  4. //
  5. // Created by 刘振兴 on 2016/11/3.
  6. // Copyright © 2016年 zoneland. All rights reserved.
  7. //
  8. import Foundation
  9. import ObjectMapper
  10. ///论坛分区
  11. class BBSForumListData:Mappable {
  12. var id:String?
  13. var createTime:String?
  14. var updateTime:String?
  15. var sequence:String?
  16. var forumName:String?
  17. var forumManagerName:String?
  18. var forumNotice:String?
  19. var forumVisiable:String?
  20. var subjectPublishAble:String?
  21. var replyPublishAble:String?
  22. var indexListStyle:String?
  23. var forumIndexStyle:String?
  24. var indexRecommendable:String?
  25. var subjectNeedAudit:Bool?
  26. var replyNeedAudit:Bool?
  27. var sectionCreateAble:Bool?
  28. var sectionTotal:Int?
  29. var subjectTotal:Int?
  30. var replyTotal:Int?
  31. var subjectTotalToday:Int?
  32. var replyTotalToday:Int?
  33. var creatorName:String?
  34. var forumStatus:String?
  35. var orderNumber:Int?
  36. var sectionInfoList:[BBSectionListData]?
  37. required init?(map: Map) {
  38. }
  39. func mapping(map: Map) {
  40. id<-map["id"]
  41. createTime<-map["createTime"]
  42. updateTime<-map["updateTime"]
  43. sequence<-map["sequence"]
  44. forumName<-map["forumName"]
  45. forumManagerName<-map["forumManagerName"]
  46. forumNotice<-map["forumNotice"]
  47. forumVisiable<-map["forumVisiable"]
  48. subjectPublishAble<-map["subjectPublishAble"]
  49. replyPublishAble<-map["replyPublishAble"]
  50. indexListStyle<-map["indexListStyle"]
  51. forumIndexStyle<-map["forumIndexStyle"]
  52. indexRecommendable<-map["indexRecommendable"]
  53. subjectNeedAudit<-map["subjectNeedAudit"]
  54. replyNeedAudit<-map["replyNeedAudit"]
  55. sectionCreateAble<-map["sectionCreateAble"]
  56. sectionTotal<-map["sectionTotal"]
  57. subjectTotal<-map["subjectTotal"]
  58. replyTotal<-map["replyTotal"]
  59. subjectTotalToday<-map["subjectTotalToday"]
  60. replyTotalToday<-map["replyTotalToday"]
  61. creatorName<-map["creatorName"]
  62. forumStatus<-map["forumStatus"]
  63. orderNumber<-map["orderNumber"]
  64. sectionInfoList<-map["sectionInfoList"]
  65. }
  66. }
  67. ///论坛板块
  68. class BBSectionListData:Mappable{
  69. var id:String?
  70. var createTime:String?
  71. var updateTime:String?
  72. var sequence:String?
  73. var sectionName:String?
  74. var forumId:String?
  75. var forumName:String?
  76. var mainSectionId:String?
  77. var mainSectionName:String?
  78. var sectionLevel:String?
  79. var sectionDescription:String?
  80. var sectionNotice:String?
  81. var icon:String?
  82. var sectionVisiable:String?
  83. var subjectPublishAble:String?
  84. var replyPublishAble:String?
  85. var moderatorNames:String?
  86. var sectionType:String?
  87. var indexRecommendable:Bool?
  88. var subjectNeedAudit:Bool?
  89. var replyNeedAudit:Bool?
  90. var sectionCreateAble:Bool?
  91. var subjectTotal:Int?
  92. var replyTotal:Int?
  93. var subjectTotalToday:Int?
  94. var replyTotalToday:Int?
  95. var creatorName:String?
  96. var sectionStatus:String?
  97. var orderNumber:Int?
  98. required init?(map: Map) {
  99. }
  100. func mapping(map: Map) {
  101. id<-map["id"]
  102. createTime<-map["createTime"]
  103. updateTime<-map["updateTime"]
  104. sequence<-map["sequence"]
  105. sectionName<-map["sectionName"]
  106. forumId<-map["forumId"]
  107. forumName<-map["forumName"]
  108. mainSectionId<-map["mainSectionId"]
  109. mainSectionName<-map["mainSectionName"]
  110. sectionLevel<-map["sectionLevel"]
  111. sectionDescription<-map["sectionDescription"]
  112. sectionNotice<-map["sectionNotice"]
  113. icon<-map["icon"]
  114. sectionVisiable<-map["sectionVisiable"]
  115. subjectPublishAble<-map["subjectPublishAble"]
  116. replyPublishAble<-map["replyPublishAble"]
  117. moderatorNames<-map["moderatorNames"]
  118. sectionType<-map["sectionType"]
  119. indexRecommendable<-map["indexRecommendable"]
  120. subjectNeedAudit<-map["subjectNeedAudit"]
  121. replyNeedAudit<-map["replyNeedAudit"]
  122. sectionCreateAble<-map["sectionCreateAble"]
  123. subjectTotal<-map["subjectTotal"]
  124. replyTotal<-map["replyTotal"]
  125. subjectTotalToday<-map["subjectTotalToday"]
  126. replyTotalToday<-map["replyTotalToday"]
  127. creatorName<-map["creatorName"]
  128. sectionStatus<-map["sectionStatus"]
  129. orderNumber<-map["orderNumber"]
  130. }
  131. }
  132. //论坛帖子
  133. class BBSSubjectData: Mappable {
  134. var id:String?
  135. var createTime:String?
  136. var updateTime:String?
  137. var title:String?
  138. var type:String?
  139. var summary:String?
  140. var content:String?
  141. var latestReplyTime:String?
  142. var latestReplyUser:String?
  143. var latestReplyId:String?
  144. var replyTotal:Int?
  145. var viewTotal:Int?
  146. var hot:Int?
  147. var stopReply:Bool?
  148. var recommendToBBSIndex:Bool?
  149. var bBSIndexSetterName:String?
  150. var recommendToForumIndex:Bool?
  151. var forumIndexSetterName:String?
  152. var topToSection:Bool?
  153. var topToMainSection:Bool?
  154. var topToForum:Bool?
  155. var topToBBS:Bool?
  156. var isTopSubject:Bool?
  157. var isCreamSubject:Bool?
  158. var screamSetterName:String?
  159. var screamSetterTime:String?
  160. var isOriginalSubject:Bool?
  161. var originalSetterName:String?
  162. var isRecommendSubject:Bool?
  163. var recommendorName:String?
  164. var recommendTime:String?
  165. var creatorName:String?
  166. var subjectAuditStatus:String?
  167. var auditorName:String?
  168. var subjectStatus:String?
  169. var orderNumber:Int?
  170. var attachmentList:[String]?
  171. var machineName:String?
  172. var systemType:String?
  173. var hostIp:String?
  174. var subjectAttachmentList:[BBSSubjectAttachmentData]?//附件对象列表
  175. required init?(map: Map) {
  176. }
  177. func mapping(map: Map) {
  178. id<-map["id"]
  179. createTime<-map["createTime"]
  180. updateTime<-map["updateTime"]
  181. title<-map["title"]
  182. type<-map["type"]
  183. summary<-map["summary"]
  184. content<-map["content"]
  185. latestReplyTime<-map["latestReplyTime"]
  186. latestReplyUser<-map["latestReplyUser"]
  187. latestReplyId<-map["latestReplyId"]
  188. replyTotal<-map["replyTotal"]
  189. viewTotal<-map["viewTotal"]
  190. hot<-map["hot"]
  191. stopReply<-map["stopReply"]
  192. recommendToBBSIndex<-map["recommendToBBSIndex"]
  193. bBSIndexSetterName<-map["bBSIndexSetterName"]
  194. recommendToForumIndex<-map["recommendToForumIndex"]
  195. forumIndexSetterName<-map["forumIndexSetterName"]
  196. topToSection<-map["topToSection"]
  197. topToMainSection<-map["topToMainSection"]
  198. topToForum<-map["topToForum"]
  199. topToBBS<-map["topToBBS"]
  200. isTopSubject<-map["isTopSubject"]
  201. isCreamSubject<-map["isCreamSubject"]
  202. screamSetterName<-map["screamSetterName"]
  203. screamSetterTime<-map["screamSetterTime"]
  204. isOriginalSubject<-map["isOriginalSubject"]
  205. originalSetterName<-map["originalSetterName"]
  206. isRecommendSubject<-map["isRecommendSubject"]
  207. recommendorName<-map["recommendorName"]
  208. recommendTime<-map["recommendTime"]
  209. creatorName<-map["creatorName"]
  210. subjectAuditStatus<-map["subjectAuditStatus"]
  211. auditorName<-map["auditorName"]
  212. subjectStatus<-map["subjectStatus"]
  213. orderNumber<-map["orderNumber"]
  214. attachmentList<-map["attachmentList"]
  215. machineName<-map["machineName"]
  216. systemType<-map["systemType"]
  217. hostIp<-map["hostIp"]
  218. subjectAttachmentList<-map["subjectAttachmentList"]
  219. }
  220. }
  221. //附件对象列表
  222. class BBSSubjectAttachmentData:Mappable{
  223. var id:String?
  224. var createTime:String?
  225. var updateTime:String?
  226. var sequence:String?
  227. var lastUpdateTime:String?
  228. var storage:String?
  229. var forumId:String?
  230. var forumName:String?
  231. var sectionId:String?
  232. var sectionName:String?
  233. var mainSectionId:String?
  234. var mainSectionName:String?
  235. var subjectId:String?
  236. var title:String?
  237. var name:String?
  238. var fileName:String?
  239. var fileHost:String?
  240. var filePath:String?
  241. var storageName:String?
  242. var description:String?
  243. var creatorUid:String?
  244. var `extension`:String?
  245. var length:CLongLong?
  246. var url:String?//计算后的地址 下载地址
  247. required init?(map: Map) {
  248. }
  249. func mapping(map: Map) {
  250. id<-map["id"]
  251. createTime<-map["createTime"]
  252. updateTime<-map["updateTime"]
  253. sequence<-map["sequence"]
  254. lastUpdateTime<-map["lastUpdateTime"]
  255. storage<-map["storage"]
  256. forumId<-map["forumId"]
  257. forumName<-map["forumName"]
  258. sectionId<-map["sectionId"]
  259. sectionName<-map["sectionName"]
  260. mainSectionId<-map["mainSectionId"]
  261. mainSectionName<-map["mainSectionName"]
  262. subjectId<-map["subjectId"]
  263. title<-map["title"]
  264. name<-map["name"]
  265. fileName<-map["fileName"]
  266. fileHost<-map["fileHost"]
  267. filePath<-map["filePath"]
  268. storageName<-map["storageName"]
  269. description<-map["description"]
  270. creatorUid<-map["creatorUid"]
  271. `extension`<-map["extension"]
  272. length<-map["length"]
  273. }
  274. }
  275. struct SubjectReplayRequestEntity:Mappable {
  276. var creatorName:String?
  277. var content:String?
  278. var subjectId:String?
  279. var parentId:String?
  280. init() {
  281. }
  282. init?(map: Map) {
  283. }
  284. mutating func mapping(map: Map) {
  285. creatorName<-map["creatorName"]
  286. content<-map["content"]
  287. subjectId<-map["subjectId"]
  288. parentId<-map["parentId"]
  289. }
  290. }
  291. struct PublishSubjectEntity:Mappable{
  292. var type:String?
  293. var title:String?
  294. var summary:String?
  295. var content:String?
  296. var sectionId:String?
  297. init() {
  298. }
  299. init?(map: Map) {
  300. }
  301. mutating func mapping(map: Map) {
  302. type<-map["type"]
  303. title<-map["title"]
  304. summary<-map["summary"]
  305. content<-map["content"]
  306. sectionId<-map["sectionId"]
  307. }
  308. }
  309. //分页模型
  310. struct SubjectPageModel {
  311. var pageNumber:Int = 1
  312. let pageSize:Int = 20
  313. var pageTotal:Int = 0
  314. mutating func setPageTotal(_ pageTotal:Int){
  315. self.pageTotal = pageTotal
  316. }
  317. mutating func nextPage(){
  318. if pageTotal > 0 && pageNumber * pageSize < pageTotal {
  319. pageNumber += 1
  320. }else{
  321. }
  322. }
  323. func isLast() -> Bool {
  324. return pageNumber * pageSize >= pageTotal
  325. }
  326. }