CommunityRecommendMusicListModel.swift 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // CommunityRecommendMusicListModel.swift
  3. // RainbowPlanet
  4. //
  5. // Created by Christopher on 2019/7/17.
  6. // Copyright © 2019 RainbowPlanet. All rights reserved.
  7. //
  8. import Foundation
  9. import ObjectMapper
  10. // 推荐&&分类のModelList
  11. class CommunityRecommendMusicListModel : NSObject, Mappable{
  12. var data : [CommunityMusicItemModel]?
  13. var pagination : PaginationModel?
  14. class func newInstance(map: Map) -> Mappable?{
  15. return CommunityRecommendMusicListModel()
  16. }
  17. required init?(map: Map){}
  18. private override init(){}
  19. func mapping(map: Map)
  20. {
  21. data <- map["data"]
  22. pagination <- map["pagination"]
  23. }
  24. }
  25. // 歌曲Model
  26. class CommunityMusicItemModel : NSObject, Mappable{
  27. var id : Int?
  28. var img : String?
  29. var musicDuration : Int?
  30. var name : String?
  31. var singer : String?
  32. var url : String?
  33. // 本地添加,用于控制状态
  34. var isPlaying : Bool? = false
  35. // 本地名字
  36. var musicName : String?
  37. // 是否选中
  38. var isSelected : Bool? = false
  39. // 是否使用
  40. var isUse :Bool? = false
  41. /// 使用中的音乐路径
  42. var publishNewMusicURL : URL? = nil
  43. class func newInstance(map: Map) -> Mappable?{
  44. return CommunityMusicItemModel()
  45. }
  46. required init?(map: Map){}
  47. public override init(){}
  48. func mapping(map: Map)
  49. {
  50. id <- map["id"]
  51. img <- map["img"]
  52. musicDuration <- map["music_duration"]
  53. name <- map["name"]
  54. singer <- map["singer"]
  55. url <- map["url"]
  56. }
  57. }