Visual_Novel_iOS/crush/Crush/Src/Models/WalletModels.swift

245 lines
5.9 KiB
Swift
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// WalletModels.swift
// Crush
//
// Created by Leon on 2025/9/10.
//
import Foundation
// MARK: - VIP
//
struct MemberDetailOutput: Codable {
var userMemberInfo: UserSubscription?
var memberPrivList: [MemberPrivDict]?
}
//
struct UserSubscription: Codable {
var id: Int?
/// Need to be "APPLE"
var platform: String?
var userId: Int?
var subscriptionId: String?
var productId: String?
var memberType: MemberType?
var priceType: PriceType?
var purchaseToken: String?
var refundTimeMs: Int?
/// 1758289340000
var purchaseTime: Int?
var expTime: Int?
var autoRenewStatus: Bool?
var status: String?
var createTime: Int?
var editTime: Int?
var ip: String?
///
var remind: Bool?
func getVIPValid() -> Bool{
if let expTimeTimestamp = expTime{
if Date().timeStamp < expTimeTimestamp{
return true
}
}
return false
}
}
//
enum MemberType: String, Codable {
case vip = "VIP"
}
//
enum PriceType: String, Codable {
case month = "SUB_MONTH"
case season = "SUB_SEASON"
case year = "SUB_YEAR"
}
//
struct MemberPrivDict: Codable {
var id: Int?
///
var title: String?
///
var desc: String?
var img: String?
var sort: Int?
var isDelete: Int?
var createTime: Int?
/// code , ADD_CRUSH_COINADD_CREATE_AI
var code: String?
}
// MARK: - Charge
struct CoinRechargePreOrderResponse: Codable{
var tradeNo: String?
}
// MARK: - Bill
struct BillListRequest: Codable{
var page: RequestPageData?
var type: String?
var startTime: Int?
var endTime: Int?
}
struct BillListResponse:Codable{
///
var incomeTotal: Int?
///
var outcomeTotal: Int?
var pageList: ResponseContentPageData<BillListInfo>?
}
///
struct BillListInfo: Codable{
var tradeNo: String?
var desUid: Int?
var status: String?
var time: Int?
var amount: Int?
var item: String?
var nickname: String?
var period: String?
var headImg: String?
var custId: String?
var bizNum: String?
var inOrOut: InOrOut?
var periodAmount: Int?
var id: Int?
/// Buff
var payment: String?
var platform: String?
///
var bizType: String?
var message: String?
var giftId: Int?
var toWithdrawableIncomeTime: Int?
/// BALANCE. AWAITING_INCOME
var buffType: BuffType?
/// Jsonstring: like { "aiId":.xxx, "giftId" : 1, "num": 12}
var extend: String?
func getExtendObj()-> BillListExtentObj?{
if let extentString = extend {
return CodableHelper.decode(BillListExtentObj.self, from: extentString)
}
return nil
}
/*
{
"tradeNo" : "12025091718400465000014",
"desUid" : null,
"status" : "WITHDRAW_SUCCESS",
"time" : 1758105605000,
"amount" : 7000,
"item" : "Create AI Image",
"nickname" : null,
"period" : null,
"headImg" : null,
"custId" : null,
"bizNum" : "2025091718400464367010",
"inOrOut" : "OUT",
"periodAmount" : null,
"id" : 161,
"payment" : "Buff",
"platform" : "Balance",
"bizType" : "CREATE_AI_IMAGE",
"message" : null,
"giftId" : null,
"toWithdrawableIncomeTime" : null,
"buffType" : "BALANCE",
"extend" : null
}
*/
}
struct BillListExtentObj: Codable{
var aiId: Int?
var giftId: Int?
var num: Int?
}
// MARK: - Enums
enum BuffClassify: String, Codable {
case bCharge = "B_CHARGE"
case bPurchase = "B_PURCHASE"
case bRefund = "B_REFUND"
case bTip = "B_TIP"
case bGift = "B_GIFT"
case bEpalSubscription = "B_EPAL_SUBSCRIPTION"
case bLuckyDraw = "B_LUCKY_DRAW"
case bStore = "B_STORE"
case bEpalPrize = "B_EPAL_PRIZE"
case bOther = "B_OTHER"
case iWithdraw = "I_WITHDRAW"
case iServiceIncome = "I_SERVICE_INCOME"
case iRefund = "I_REFUND"
case iTipIncome = "I_TIP_INCOME"
case iGiftIncome = "I_GIFT_INCOME"
case iSubscriptionIncome = "I_SUBSCRIPTION_INCOME"
case iEpalReward = "I_EPAL_REWARD"
case iStoreReward = "I_STORE_REWARD"
case iOther = "I_OTHER"
}
enum BizType: String, Codable {
case game = "GAME"
case charge = "CHARGE"
case sub = "SUB"
case withdraw = "WITHDRAW"
case refund = "REFUND"
case frozenBalance = "FROZEN_BALANCE"
case unfrozenBalance = "UNFROZEN_BALANCE"
case createAIImage = "CREATE_AI_IMAGE"
case textModel = "TEXT_MODEL"
case chatAssistant = "CHAT_ASSISTANT"
case sendVoice = "SEND_VOICE"
case voiceCall = "VOICE_CALL"
case imageUnlock = "IMAGE_UNLOCK"
case heartbeatPurchase = "HEARTBEAT_PURCHASE"
case gift = "GIFT"
case unlockAdmirers = "UNLOCK_ADMIRERS"
case newUserGift = "NEW_USER_GIFT"
case vipBuffGift = "VIP_BUFF_GIFT"
case subscribeMember = "SUBSCRIBE_MEMBER"
case SIGN_IN_GIFT = "SIGN_IN_GIFT"
}
enum InOrOut: String, Codable {
case `in` = "IN"
case out = "OUT"
}
enum BuffType: String, Codable {
case balance = "BALANCE"
case withdrawableIncome = "WITHDRAWABLE_INCOME"
case awaitingIncome = "AWAITING_INCOME"
case refund = "REFUND"
case frozenIncome = "FROZEN_INCOME"
case frozenBalance = "FROZEN_BALANCE"
}
enum BillStatus: String, Codable {
case created = "CREATED"
case rollBack = "ROLL_BACK"
case settled = "SETTLED"
}
enum WithdrawStatus: String, Codable {
case inReview = "IN_REVIEW"
case reviewFail = "REVIEW_FAIL"
case withdrawIng = "WITHDRAW_ING"
case withdrawFail = "WITHDRAW_FAIL"
case withdrawSuccess = "WITHDRAW_SUCCESS"
case withdrawFailBack = "WITHDRAW_FAIL_BACK"
}