58 lines
1.4 KiB
Swift
58 lines
1.4 KiB
Swift
//
|
||
// NoticeModels.swift
|
||
// Crush
|
||
//
|
||
// Created by Leon on 2025/8/28.
|
||
//
|
||
|
||
struct MessageStat: Codable {
|
||
var unRead: Int?
|
||
var latestContent: String?
|
||
/// 时间戳
|
||
var latestTime: Int?
|
||
}
|
||
|
||
struct MessageNotice: Codable {
|
||
var id: Int? // 消息ID
|
||
var sendUserId: Int? // 发送人用户ID
|
||
var type: MessageType? // 消息类型
|
||
var bizId: String? // 业务ID
|
||
var status: Int? // 消息状态(0未读、1已读)
|
||
var title: String? // 消息标题
|
||
var content: String? // 消息内容
|
||
/// "{\"aiId\":439059452002305}"
|
||
var extras: String? // 消息扩展内容
|
||
var replaceJson: String? // 国际化翻译替换数据
|
||
var createTime: Int?
|
||
|
||
func getExtra() -> MessageNoticeExtra?{
|
||
guard let extrasString = extras, extrasString.count > 0 else{
|
||
return nil
|
||
}
|
||
return CodableHelper.decode(MessageNoticeExtra.self, from: extrasString)
|
||
}
|
||
}
|
||
|
||
struct MessageNoticeExtra: Codable{
|
||
var aiId: Int?
|
||
}
|
||
|
||
enum MessageType: Int, Codable{
|
||
case loginWelcome = 100
|
||
case aiwelcomeGreeting = 101
|
||
case vipRenewSuccess = 102
|
||
case vipRenewFail = 103
|
||
case myAiGifted = 104
|
||
case myAiAlbumPhotoUnlock = 105
|
||
case heartBeatLevelDown = 106
|
||
|
||
func hasNoCheckEntrance()-> Bool{
|
||
switch self{
|
||
case .loginWelcome, .aiwelcomeGreeting:
|
||
return true
|
||
default:
|
||
return false
|
||
}
|
||
}
|
||
}
|