|
@@ -131,7 +131,7 @@ public func kf_imageCacheImage(originUrl: String, completeHandle: @escaping (_ i
|
|
}
|
|
}
|
|
|
|
|
|
/** 打印 */
|
|
/** 打印 */
|
|
-public func BFLog<T>(message: T) {
|
|
|
|
|
|
+public func BFLog<T>(message _: T) {
|
|
// if PQBFConfig.shared.enableBFLog {
|
|
// if PQBFConfig.shared.enableBFLog {
|
|
// let logger = NXLogger.shared
|
|
// let logger = NXLogger.shared
|
|
//
|
|
//
|
|
@@ -143,17 +143,15 @@ public func BFLog<T>(message: T) {
|
|
// BuglyLog.level(.warn, logs: message as? String)
|
|
// BuglyLog.level(.warn, logs: message as? String)
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
-public func HHZPrint<T>(_ message:T,file:String = #file,funcName:String = #function,lineNum:Int = #line){
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+public func HHZPrint<T>(_: T, file _: String = #file, funcName _: String = #function, lineNum _: Int = #line) {
|
|
#if DEBUG
|
|
#if DEBUG
|
|
-
|
|
|
|
|
|
+
|
|
// let file = (file as NSString).lastPathComponent;
|
|
// let file = (file as NSString).lastPathComponent;
|
|
-//
|
|
|
|
|
|
+//
|
|
// print("hhz-\(file):(\(lineNum))--\(message)");
|
|
// print("hhz-\(file):(\(lineNum))--\(message)");
|
|
-
|
|
|
|
|
|
+
|
|
#endif
|
|
#endif
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
// MARK: 获取公共参数
|
|
// MARK: 获取公共参数
|
|
@@ -670,37 +668,38 @@ public func timeIntervalToDateString(timeInterval: TimeInterval) -> String {
|
|
}
|
|
}
|
|
|
|
|
|
public func updateTimeToCurrenTime(timeInterval: TimeInterval) -> String {
|
|
public func updateTimeToCurrenTime(timeInterval: TimeInterval) -> String {
|
|
- //获取当前的时间戳
|
|
|
|
- let currentTime = Date().timeIntervalSince1970
|
|
|
|
- print(currentTime, timeInterval, "sdsss")
|
|
|
|
- //时间戳为毫秒级要 / 1000, 秒就不用除1000,参数带没带000
|
|
|
|
|
|
+ // 获取当前的时间戳
|
|
|
|
+ let currentTime = Date().timeIntervalSince1970
|
|
|
|
+ print(currentTime, timeInterval, "sdsss")
|
|
|
|
+ // 时间戳为毫秒级要 / 1000, 秒就不用除1000,参数带没带000
|
|
// let timeSta:TimeInterval = TimeInterval(timeInterval / 1000)
|
|
// let timeSta:TimeInterval = TimeInterval(timeInterval / 1000)
|
|
- //时间差
|
|
|
|
- let reduceTime : TimeInterval = currentTime - timeInterval
|
|
|
|
- //时间差小于60秒
|
|
|
|
- if reduceTime < 60 {
|
|
|
|
- return "刚刚"
|
|
|
|
- }
|
|
|
|
- //时间差大于一分钟小于60分钟内
|
|
|
|
- let mins = Int(reduceTime / 60)
|
|
|
|
- if mins < 60 {
|
|
|
|
- return "\(mins)分钟前"
|
|
|
|
- }
|
|
|
|
- let hours = Int(reduceTime / 3600)
|
|
|
|
- if hours < 24 {
|
|
|
|
- return "\(hours)小时前"
|
|
|
|
- }
|
|
|
|
- let days = Int(reduceTime / 3600 / 24)
|
|
|
|
- if days < 30 {
|
|
|
|
- return "\(days)天前"
|
|
|
|
- }
|
|
|
|
- //不满足上述条件---或者是未来日期-----直接返回日期
|
|
|
|
- let date = NSDate(timeIntervalSince1970: timeInterval)
|
|
|
|
- let dfmatter = DateFormatter()
|
|
|
|
- //yyyy-MM-dd HH:mm:ss
|
|
|
|
- dfmatter.dateFormat="yyyy年MM月dd日 HH:mm:ss"
|
|
|
|
- return dfmatter.string(from: date as Date)
|
|
|
|
- }
|
|
|
|
|
|
+ // 时间差
|
|
|
|
+ let reduceTime: TimeInterval = currentTime - timeInterval
|
|
|
|
+ // 时间差小于60秒
|
|
|
|
+ if reduceTime < 60 {
|
|
|
|
+ return "刚刚"
|
|
|
|
+ }
|
|
|
|
+ // 时间差大于一分钟小于60分钟内
|
|
|
|
+ let mins = Int(reduceTime / 60)
|
|
|
|
+ if mins < 60 {
|
|
|
|
+ return "\(mins)分钟前"
|
|
|
|
+ }
|
|
|
|
+ let hours = Int(reduceTime / 3600)
|
|
|
|
+ if hours < 24 {
|
|
|
|
+ return "\(hours)小时前"
|
|
|
|
+ }
|
|
|
|
+// let days = Int(reduceTime / 3600 / 24)
|
|
|
|
+// if days < 30 {
|
|
|
|
+// return "\(days)天前"
|
|
|
|
+// }
|
|
|
|
+ // 不满足上述条件---或者是未来日期-----直接返回日期
|
|
|
|
+ let date = NSDate(timeIntervalSince1970: timeInterval)
|
|
|
|
+ let dfmatter = DateFormatter()
|
|
|
|
+ // yyyy-MM-dd HH:mm:ss
|
|
|
|
+ dfmatter.dateFormat = "MM月dd号"
|
|
|
|
+ return dfmatter.string(from: date as Date)
|
|
|
|
+}
|
|
|
|
+
|
|
/// 判断字符串或者字典是否为空
|
|
/// 判断字符串或者字典是否为空
|
|
/// - Parameter object: <#object description#>
|
|
/// - Parameter object: <#object description#>
|
|
/// - Returns: <#description#>
|
|
/// - Returns: <#description#>
|