|
@@ -0,0 +1,175 @@
|
|
|
+//
|
|
|
+// PQUserInfoModel.swift
|
|
|
+// PQSpeed
|
|
|
+//
|
|
|
+// Created by SanW on 2020/5/27.
|
|
|
+// Copyright © 2020 BytesFlow. All rights reserved.
|
|
|
+//
|
|
|
+
|
|
|
+import UIKit
|
|
|
+import BFCommonKit
|
|
|
+
|
|
|
+open class PQUserInfoModel: BFBaseModel {
|
|
|
+ public var avatarUrl: String? // 头像地址
|
|
|
+ public var backgroundImage: String? // 背景图
|
|
|
+
|
|
|
+ public var bothFollow: Bool = false // 是否相互关注
|
|
|
+ public var fans: Int = 0 // 粉丝数
|
|
|
+ public var followed: Int = 0 // 是否关注
|
|
|
+ public var idols: Int = 0 // 关注的人数
|
|
|
+ public var introduction: String?
|
|
|
+ public var nickName: String? // 昵称
|
|
|
+
|
|
|
+ public var otherVideoShowCount: Int = 0
|
|
|
+ public var playCountTotal: Int = 0 // 用户视频总播放数,按人去重 ,
|
|
|
+ public var playCountFormatStr: String? // 用户视频总播放数,格式化后的值,前端直接显示 ,
|
|
|
+ public var positionType: Int = 0
|
|
|
+ public var sensitiveStatus: Int = 0
|
|
|
+ public var subscribeStatus: Int = 0 // 0:未订阅,1:已订阅
|
|
|
+ public var mySubscribes: Int = 0 // 我的订阅数
|
|
|
+ public var otherSubscribes: Int = 0 // 别人订阅我的数量
|
|
|
+ public var uid: Int = 0
|
|
|
+ public var uploadDate: String?
|
|
|
+ public var userType: Int = 0
|
|
|
+ public var videos: Int = 0 // 视频数
|
|
|
+ public var videosDescr: String = "0" // 视频数
|
|
|
+ public var vipStatus: Int = 0 // vip状态,0:不是vip,1:是vip
|
|
|
+ public var vipDesc: String? // vip身份描述
|
|
|
+ public var tagList: [String]? // 标签
|
|
|
+ public var picPathList: [[String: Any]]? // 推荐列表
|
|
|
+ public var isLoginUser: Bool = false // 是否是登录用户
|
|
|
+ public var gmtCreateTimestamp: Int = 0
|
|
|
+ public var intimacy: Int = 0
|
|
|
+ public var isBothFollow: Int = 0 // 是否相互关注 ,
|
|
|
+ public var isFollowed: Bool = false // 是否关注
|
|
|
+ public var lastTimestamp: Int = 0
|
|
|
+ public var latestSendvideoId: Int = 0
|
|
|
+ public var updated: Int = 0
|
|
|
+ public var favoriteCount: Int = 0 // 喜欢的视频数
|
|
|
+ public var shareCount: Int = 0 // 分享的视频数
|
|
|
+ public var isBanned: Bool = false // 是否被拉黑
|
|
|
+ public var tab_pageType: TAB_PAGETYPE = .TAB_PAGETYPE_NORMAL // 0-推荐 1-关注
|
|
|
+
|
|
|
+ required public init() {
|
|
|
+ super.init()
|
|
|
+ }
|
|
|
+
|
|
|
+ public override init(jsonDict: [String: Any]) {
|
|
|
+ super.init()
|
|
|
+ if jsonDict.keys.contains("avatarUrl") {
|
|
|
+ avatarUrl = "\(jsonDict["avatarUrl"] ?? "")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("bothFollow") {
|
|
|
+ bothFollow = Bool("\(jsonDict["bothFollow"] ?? "")") ?? false
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("fans") {
|
|
|
+ fans = Int("\(jsonDict["fans"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("followed") {
|
|
|
+ followed = Int("\(jsonDict["followed"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("idols") {
|
|
|
+ idols = Int("\(jsonDict["idols"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("introduction") {
|
|
|
+ introduction = "\(jsonDict["introduction"] ?? "0")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("nickName") {
|
|
|
+ nickName = "\(jsonDict["nickName"] ?? "0")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("otherVideoShowCount") {
|
|
|
+ otherVideoShowCount = Int("\(jsonDict["otherVideoShowCount"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("playCountTotal") {
|
|
|
+ playCountTotal = Int("\(jsonDict["playCountTotal"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("playCountFormatStr") {
|
|
|
+ playCountFormatStr = "\(jsonDict["playCountFormatStr"] ?? "0")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("positionType") {
|
|
|
+ positionType = Int("\(jsonDict["positionType"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("favoriteCount") {
|
|
|
+ favoriteCount = Int("\(jsonDict["favoriteCount"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("shareCount") {
|
|
|
+ shareCount = Int("\(jsonDict["shareCount"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("sensitiveStatus") {
|
|
|
+ sensitiveStatus = Int("\(jsonDict["sensitiveStatus"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("subscribeStatus") {
|
|
|
+ subscribeStatus = Int("\(jsonDict["subscribeStatus"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("mySubscribes") {
|
|
|
+ mySubscribes = Int("\(jsonDict["mySubscribes"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("otherSubscribes") {
|
|
|
+ otherSubscribes = Int("\(jsonDict["otherSubscribes"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("uid") {
|
|
|
+ uid = Int("\(jsonDict["uid"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("uploadDate") {
|
|
|
+ uploadDate = "\(jsonDict["uploadDate"] ?? "0")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("userType") {
|
|
|
+ userType = Int("\(jsonDict["userType"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("videos") {
|
|
|
+ videos = Int("\(jsonDict["videos"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("videosDescr") {
|
|
|
+ videosDescr = "\(jsonDict["videosDescr"] ?? "")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("vipStatus") {
|
|
|
+ vipStatus = Int("\(jsonDict["vipStatus"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("tagList") {
|
|
|
+ tagList = jsonDict["tagList"] as? [String]
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("picPathList") {
|
|
|
+ picPathList = jsonDict["picPathList"] as? [[String: Any]]
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("vipDesc") {
|
|
|
+ vipDesc = "\(jsonDict["vipDesc"] ?? "")"
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("isLoginUser") {
|
|
|
+ isLoginUser = Bool("\(jsonDict["isLoginUser"] ?? "")") ?? false
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("gmtCreateTimestamp") {
|
|
|
+ gmtCreateTimestamp = Int("\(jsonDict["gmtCreateTimestamp"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("intimacy") {
|
|
|
+ intimacy = Int("\(jsonDict["intimacy"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("isBothFollow") {
|
|
|
+ isBothFollow = Int("\(jsonDict["isBothFollow"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("isFollowed") {
|
|
|
+ isFollowed = jsonDict["isFollowed"] as! Bool
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("lastTimestamp") {
|
|
|
+ lastTimestamp = Int("\(jsonDict["lastTimestamp"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("latestSendvideoId") {
|
|
|
+ latestSendvideoId = Int("\(jsonDict["latestSendvideoId"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ if jsonDict.keys.contains("updated") {
|
|
|
+ updated = Int("\(jsonDict["updated"] ?? "0")") ?? 0
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 创建虚拟用户数据
|
|
|
+ /// - Parameter virtual: <#virtual description#>
|
|
|
+ public init(avatarIcon: String?, userName: String?) {
|
|
|
+ super.init()
|
|
|
+ avatarUrl = avatarIcon
|
|
|
+ nickName = userName
|
|
|
+ fans = Int(arc4random() % 10)
|
|
|
+ followed = Int(arc4random() % 10)
|
|
|
+ idols = Int(arc4random() % 10)
|
|
|
+ mySubscribes = Int(arc4random() % 10)
|
|
|
+ otherSubscribes = Int(arc4random() % 10)
|
|
|
+ }
|
|
|
+}
|