package dbstruct import ( "encoding/json" "strconv" "time" ) // 订单状态 const ( VasOrderStatusNone = -1 VasOrderStatusInit = 0 // 初始化 VasOrderStatusPaySuccess = 1 // 付款成功(第三方回调成功) VasOrderStatusFinish = 2 // 订单完成,不再参与业务 VasOrderStatusRefund = 3 // 已退款 ) var OrderStatusDescMap = map[int32]string{ VasOrderStatusNone: "零状态", VasOrderStatusInit: "初始化", VasOrderStatusPaySuccess: "已支付", VasOrderStatusFinish: "已完成", VasOrderStatusRefund: "已退款", } // 现金订单 type Order struct { ID *string `json:"id" db:"id"` // 订单id Mid *int64 `json:"mid" db:"mid"` // 用户id Uid *int64 `json:"uid" db:"uid"` // 关联用户id Oid1 *string `json:"oid1" db:"oid1"` // 辅助id1 Oid2 *string `json:"oid2" db:"oid2"` // 辅助id2 Oid3 *string `json:"oid3" db:"oid3"` // 辅助id3 ProductId *string `json:"product_id" db:"product_id"` // 商品id PayType *string `json:"pay_type" db:"pay_type"` // 支付类型,见 vasproto.PayType* PayAmount *int64 `json:"pay_amount" db:"pay_amount"` // 支付金额 OutOrderID *string `json:"out_order_id" db:"out_order_id"` // 分别对应于支付宝、微信、苹果方的订单ID ReceiptData *string `json:"receipt_data" db:"receipt_data"` // ios收据 Coins *int64 `json:"coins" db:"coins"` // 虚拟货币 OrderStatus *int32 `json:"order_status" db:"order_status"` // 订单状态,见 OrderStatus* OrderFrom *string `json:"order_from" db:"order_from"` // 订单创建来源,见 OrderFrom* Ct *int64 `json:"ct" db:"ct"` // 创建时间 Ut *int64 `json:"ut" db:"ut"` // 更新时间 Operator *string `json:"operator" db:"operator"` // 操作人 Ext *string `json:"ext" db:"ext"` // 额外业务信息 // 公共信息 Did *string `json:"b_did" db:"b_did"` // 设备id Version *string `json:"b_ver" db:"b_ver"` // 版本 OsVersion *string `json:"b_osver" db:"b_osver"` // 系统版本 DevType *int32 `json:"b_dt" db:"b_dt"` // 设备类型 Channel *string `json:"b_ch" db:"b_ch"` // 渠道 Model *string `json:"b_model" db:"b_model"` // 机型 NetType *string `json:"b_nt" db:"b_nt"` // 网络类型 Ip *string `json:"ip" db:"ip"` // 下单时的ip } func (p *Order) GetZid() int64 { switch p.GetProductId() { case ProductIdH5ZoneMoment, ProductIdH5ZoneAdmission, ProductIdH5ZoneIronfanship, ProductIdH5ZoneSuperfanship: n, _ := strconv.Atoi(p.GetOid1()) return int64(n) } return 0 } func (p *Order) GetMomentId() int64 { switch p.GetProductId() { case ProductIdH5ZoneMoment: n, _ := strconv.Atoi(p.GetOid2()) return int64(n) } return 0 } func (p *Order) GetSuperfanshipUntil() int64 { switch p.GetProductId() { case ProductIdH5ZoneSuperfanship: n, _ := strconv.Atoi(p.GetOid2()) return int64(n) } return 0 } func (p *Order) ToString() string { bs, _ := json.Marshal(p) return string(bs) } func (p *Order) GetID() string { if p != nil && p.ID != nil { return *p.ID } return "" } func (p *Order) GetOid1() string { if p != nil && p.Oid1 != nil { return *p.Oid1 } return "" } func (p *Order) GetOid2() string { if p != nil && p.Oid2 != nil { return *p.Oid2 } return "" } func (p *Order) GetOid3() string { if p != nil && p.Oid3 != nil { return *p.Oid3 } return "" } func (p *Order) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *Order) GetUid() int64 { if p != nil && p.Uid != nil { return *p.Uid } return 0 } func (p *Order) GetProductId() string { if p != nil && p.ProductId != nil { return *p.ProductId } return "" } func (p *Order) GetPayType() string { if p != nil && p.PayType != nil { return *p.PayType } return "" } func (p *Order) GetPayAmount() int64 { if p != nil && p.PayAmount != nil { return *p.PayAmount } return 0 } func (p *Order) GetOutOrderID() string { if p != nil && p.OutOrderID != nil { return *p.OutOrderID } return "" } func (p *Order) GetReceiptData() string { if p != nil && p.ReceiptData != nil { return *p.ReceiptData } return "" } func (p *Order) GetCoins() int64 { if p != nil && p.Coins != nil { return *p.Coins } return 0 } func (p *Order) GetOrderStatus() int32 { if p != nil && p.OrderStatus != nil { return *p.OrderStatus } return 0 } func (p *Order) GetOrderFrom() string { if p != nil && p.OrderFrom != nil { return *p.OrderFrom } return "" } func (p *Order) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *Order) GetUt() int64 { if p != nil && p.Ut != nil { return *p.Ut } return 0 } func (p *Order) GetExt() string { if p != nil && p.Ext != nil { return *p.Ext } return "" } func (p *Order) GetDid() string { if p != nil && p.Did != nil { return *p.Did } return "" } func (p *Order) GetVersion() string { if p != nil && p.Version != nil { return *p.Version } return "" } func (p *Order) GetOsVersion() string { if p != nil && p.OsVersion != nil { return *p.OsVersion } return "" } func (p *Order) GetDevType() int32 { if p != nil && p.DevType != nil { return *p.DevType } return 0 } func (p *Order) GetChannel() string { if p != nil && p.Channel != nil { return *p.Channel } return "" } func (p *Order) GetModel() string { if p != nil && p.Model != nil { return *p.Model } return "" } func (p *Order) GetNetType() string { if p != nil && p.NetType != nil { return *p.NetType } return "" } func (p *Order) GetIp() string { if p != nil && p.Ip != nil { return *p.Ip } return "" } // 钱包 type Wallet struct { ID *int64 `json:"id" db:"id"` // mid Coins *int64 `json:"coins" db:"coins"` Diamonds *int64 `json:"diamonds" db:"diamonds"` WithdrawDiamonds *int64 `json:"withdraw_diamonds" db:"withdraw_diamonds"` } func (p *Wallet) GetID() int64 { if p != nil && p.ID != nil { return *p.ID } return 0 } func (p *Wallet) GetCoins() int64 { if p != nil && p.Coins != nil { return *p.Coins } return 0 } func (p *Wallet) GetDiamonds() int64 { if p != nil && p.Diamonds != nil { return *p.Diamonds } return 0 } func (p *Wallet) GetWithdrawDiamonds() int64 { if p != nil && p.WithdrawDiamonds != nil { return *p.WithdrawDiamonds } return 0 } // 金币消费订单 // 金币订单状态 const ( VasCoinOrderStatusNone = -1 VasCoinOrderStatusInit = 0 // 初始化 VasCoinOrderStatusPaySuccess = 1 // 已付款 VasCoinOrderStatusNotFill = 2 // 未填写联系方式 VasCoinOrderStatusWaitDeal = 3 // 等待处理 VasCoinOrderStatusDeal = 4 // 已处理 VasCoinOrderStatusFinish = 5 // 订单完成 VasCoinOrderStatusRefund = 6 // 已退款 ) var CoinOrderStatusDescMap = map[int32]string{ VasCoinOrderStatusNone: "零状态", VasCoinOrderStatusInit: "初始化", VasCoinOrderStatusPaySuccess: "已支付", VasCoinOrderStatusNotFill: "支付成功未填写地址", VasCoinOrderStatusWaitDeal: "等待处理", VasCoinOrderStatusDeal: "已处理", VasCoinOrderStatusFinish: "已完成", VasCoinOrderStatusRefund: "已退款", } const ( VasCoinOrderFromApp = "app" // app应用内 VasCoinOrderFromH5 = "h5" // h5 VasCoinOrderFromOp = "op" // op ) type CoinOrder struct { ID *string `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // 用户id Uid *int64 `json:"uid" db:"uid"` // 关联id Oid1 *string `json:"oid1" db:"oid1"` // 辅助id1 Oid2 *string `json:"oid2" db:"oid2"` // 辅助id2 Oid3 *string `json:"oid3" db:"oid3"` // 辅助id3 ProductId *string `json:"product_id" db:"product_id"` Coins *int64 `json:"coins" db:"coins"` OrderStatus *int32 `json:"order_status" db:"order_status"` // 订单状态,见 CoinOrderStatus* OrderFrom *string `json:"order_from" db:"order_from"` // 订单创建来源,见 CoinOrderFrom* QQ *string `json:"qq" db:"qq"` Wechat *string `json:"wechat" db:"wechat"` Phone *string `json:"phone" db:"phone"` Addr *string `json:"addr" db:"addr"` Note *string `json:"note" db:"note"` OpNote *string `json:"op_note" db:"op_note"` Ct *int64 `json:"ct" db:"ct"` Ut *int64 `json:"ut" db:"ut"` Ext *string `json:"ext" db:"ext"` // 公共信息 Did *string `json:"b_did" db:"b_did"` // 设备id Version *string `json:"b_ver" db:"b_ver"` // 版本 OsVersion *string `json:"b_osver" db:"b_osver"` // 系统版本 DevType *int32 `json:"b_dt" db:"b_dt"` // 设备类型 Channel *string `json:"b_ch" db:"b_ch"` // 渠道 Model *string `json:"b_model" db:"b_model"` // 机型 NetType *string `json:"b_nt" db:"b_nt"` // 网络类型 Ip *string `json:"ip" db:"ip"` // 下单时的ip } func (p *CoinOrder) ToString() string { bs, _ := json.Marshal(p) return string(bs) } func (p *CoinOrder) GetID() string { if p != nil && p.ID != nil { return *p.ID } return "" } func (p *CoinOrder) GetOid1() string { if p != nil && p.Oid1 != nil { return *p.Oid1 } return "" } func (p *CoinOrder) GetOid2() string { if p != nil && p.Oid2 != nil { return *p.Oid2 } return "" } func (p *CoinOrder) GetOid3() string { if p != nil && p.Oid3 != nil { return *p.Oid3 } return "" } func (p *CoinOrder) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *CoinOrder) GetUid() int64 { if p != nil && p.Uid != nil { return *p.Uid } return 0 } func (p *CoinOrder) GetProductId() string { if p != nil && p.ProductId != nil { return *p.ProductId } return "" } func (p *CoinOrder) GetCoins() int64 { if p != nil && p.Coins != nil { return *p.Coins } return 0 } func (p *CoinOrder) GetOrderStatus() int32 { if p != nil && p.OrderStatus != nil { return *p.OrderStatus } return VasCoinOrderStatusNone } func (p *CoinOrder) GetOrderFrom() string { if p != nil && p.OrderFrom != nil { return *p.OrderFrom } return "" } func (p *CoinOrder) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *CoinOrder) GetUt() int64 { if p != nil && p.Ut != nil { return *p.Ut } return 0 } func (p *CoinOrder) GetExt() string { if p != nil && p.Ext != nil { return *p.Ext } return "" } func (p *CoinOrder) GetDid() string { if p != nil && p.Did != nil { return *p.Did } return "" } func (p *CoinOrder) GetVersion() string { if p != nil && p.Version != nil { return *p.Version } return "" } func (p *CoinOrder) GetOsVersion() string { if p != nil && p.OsVersion != nil { return *p.OsVersion } return "" } func (p *CoinOrder) GetDevType() int32 { if p != nil && p.DevType != nil { return *p.DevType } return 0 } func (p *CoinOrder) GetChannel() string { if p != nil && p.Channel != nil { return *p.Channel } return "" } func (p *CoinOrder) GetModel() string { if p != nil && p.Model != nil { return *p.Model } return "" } func (p *CoinOrder) GetNetType() string { if p != nil && p.NetType != nil { return *p.NetType } return "" } func (p *CoinOrder) GetIp() string { if p != nil && p.Ip != nil { return *p.Ip } return "" } // 消费记录 const ( CHTypeCost = 1 // 消费明细(金币) CHTypeCharge = 2 // 充值明细(金币) CHTypeIncome = 3 // 收入明细(钻石) CHTypeWithdraw = 4 // 提现明细(钻石) CHSTypeCostContact = 10001 // 消费明细,联系方式 CHSTypeCostRefundContactWechat = 10002 // 消费明细,微信联系方式退款 CHSTypeCostMembership = 10003 // 消费明细,会员资格解锁(伪金币记录,会员资格解锁中间无转金币过程) CHSTypeCostRefundMembership = 10004 // 消费明细,会员资格解锁退款(伪金币记录,会员资格解锁中间无转金币过程) CHSTypeChargeUser = 20001 // 充值明细,用户自己冲 CHSTypeChargeOp = 20002 // 充值明细,OP充值 CHSTypeChargeRefundCoins = 20003 // 充值明细,金币退款 CHSTypeChargeRefundMembership = 20004 // 充值明细,会员退款 CHSTypeChargeMembership = 20005 // 充值明细,会员充值 CHSTypeChargeRefundContactWechat = 20006 // 充值明细,微信金币退款 CHSTypeChargeZoneMoment = 20007 // 充值明细,动态解锁 CHSTypeChargeZoneAdmission = 20008 // 充值明细,空间会员 CHSTypeChargeZoneSuperfanship = 20009 // 充值明细,空间超粉 CHSTypeChargeZoneRefundAdmission = 20010 // 充值明细,空间普通会员退款 CHSTypeChargeZoneRefundMoment = 20011 // 充值明细,空间动态退款 CHSTypeChargeZoneRefundSuperfanship = 20012 // 充值明细,空间动态退款 CHSTypeIncomeContact = 30001 // 收入明细,联系方式 CHSTypeIncomeInvite = 30002 // 收入明细,邀请分成 CHSTypeIncomeRefundMembership = 30003 // 收入明细,会员退款 CHSTypeIncomeRefundContactWechat = 30004 // 收入明细,微信退款 CHSTypeIncomeThirdPartner = 30005 // 收入明细,代运营 CHSTypeIncomeCollaborator = 30006 // 收入明细,协作者 CHSTypeIncomeZoneStreamer = 30007 // 收入明细,主播空间收益 CHSTypeIncomeMembership = 30008 // 收入明细,会员 CHSTypeIncomeRefundZoneAdmission = 30009 // 收入明细,空间普通会员分成退款 CHSTypeIncomeRefundThirdPartner = 30010 // 收入明细,代运营 CHSTypeIncomeRefundCollaborator = 30011 // 收入明细,协作者 CHSTypeIncomeRefundZoneStreamer = 30012 // 收入明细,主播空间收益 CHSTypeWithdrawDiamondAuto = 40001 // 自动提现明细 ) type ConsumeHistory struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` Uid *int64 `json:"uid" db:"uid"` Did *string `json:"did" db:"did"` Type *int32 `json:"type" db:"type"` SType *int32 `json:"stype" db:"stype"` TypeId *string `json:"type_id" db:"type_id"` OrderId *string `json:"order_id" db:"order_id"` Change *int64 `json:"change" db:"change"` Before *int64 `json:"before" db:"before"` After *int64 `json:"after" db:"after"` Count *int64 `json:"count" db:"count"` Ct *int64 `json:"ct" db:"ct"` } func (p *ConsumeHistory) GetId() int64 { if p != nil && p.Id != nil { return *p.Id } return 0 } func (p *ConsumeHistory) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ConsumeHistory) GetUid() int64 { if p != nil && p.Uid != nil { return *p.Uid } return 0 } func (p *ConsumeHistory) GetDid() string { if p != nil && p.Did != nil { return *p.Did } return "" } func (p *ConsumeHistory) GetType() int32 { if p != nil && p.Type != nil { return *p.Type } return 0 } func (p *ConsumeHistory) GetSType() int32 { if p != nil && p.SType != nil { return *p.SType } return 0 } func (p *ConsumeHistory) GetTypeId() string { if p != nil && p.TypeId != nil { return *p.TypeId } return "" } func (p *ConsumeHistory) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } func (p *ConsumeHistory) GetChange() int64 { if p != nil && p.Change != nil { return *p.Change } return 0 } func (p *ConsumeHistory) GetBefore() int64 { if p != nil && p.Before != nil { return *p.Before } return 0 } func (p *ConsumeHistory) GetAfter() int64 { if p != nil && p.After != nil { return *p.After } return 0 } func (p *ConsumeHistory) GetCount() int64 { if p != nil && p.Count != nil { return *p.Count } return 0 } func (p *ConsumeHistory) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } // 用户增值信息解锁记录 const ( UserVasUnlockStatusWait = 0 // 等待解锁 UserVasUnlockStatusFinish = 1 // 已解锁 ) const ( UserVasUnlockMeansCoins = "coins" // 金币解锁 UserVasUnlockMeansMoney = "money" // 现金解锁 ) const ( UserVasUnlockMembershipMeansCoins = "coins" // 金币解锁 UserVasUnlockMembershipMeansMoney = "money" // 现金解锁 ) type UserVasUnlock struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` Uid *int64 `json:"uid" db:"uid"` ProductId *string `json:"product_id" db:"product_id"` Ct *int64 `json:"ct" db:"ct"` LockType *int32 `json:"lock_type" db:"lock_type"` // 网红当时的私密类型,见dbstruct.UserVasLockType* Status *int32 `json:"status" db:"status"` // 状态,UserVasUnlockStatus Means *string `json:"means" db:"means"` // 解锁方式,UserVasUnlockMeans OrderId *string `json:"order_id" db:"order_id"` // 关联的订单id } func (p *UserVasUnlock) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *UserVasUnlock) GetUid() int64 { if p != nil && p.Uid != nil { return *p.Uid } return 0 } func (p *UserVasUnlock) GetLockType() int32 { if p != nil && p.LockType != nil { return *p.LockType } return 0 } func (p *UserVasUnlock) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } type VasOrderStatusCount struct { OrderStatus *int32 `json:"order_status" db:"order_status"` Count *int32 `json:"count" db:"count"` } // 钱包 const ( VasWithdrawOrderStatusFail = -2 // 失败 VasWithdrawOrderStatusNone = -1 // 零状态 VasWithdrawOrderStatusInit = 0 // 初始化 VasWithdrawOrderStatusWaitDeal = 1 // 等待运营处理 VasWithdrawOrderStatusAuto = 2 // 小额自动提现 VasWithdrawOrderStatusDeal = 3 // 已处理 ) var WithdrawOrderStatusDescMap = map[int32]string{ VasWithdrawOrderStatusFail: "提现失败", VasWithdrawOrderStatusNone: "零状态", VasWithdrawOrderStatusInit: "初始化", VasWithdrawOrderStatusWaitDeal: "等待运营处理", VasWithdrawOrderStatusAuto: "小额自动提醒", VasWithdrawOrderStatusDeal: "已处理", } type WithdrawOrder struct { ID *string `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // mid Did *string `json:"did" db:"did"` // 设备id ApplyTime *int64 `json:"apply_time" db:"apply_time"` // 申请时间 AlipayId *string `json:"alipay_id" db:"alipay_id"` // 支付宝账号 AlipayName *string `json:"alipay_name" db:"alipay_name"` // 支付宝姓名 WithdrawDias *int64 `json:"withdraw_dias" db:"withdraw_dias"` // 提现钻石数 WithdrawMoney *int64 `json:"withdraw_money" db:"withdraw_money"` // 提现金额 Ip *string `json:"ip" db:"ip"` // ip OrderStatus *int32 `json:"order_status" db:"order_status"` // 订单状态 Operator *string `json:"operator" db:"operator"` // 操作的运营同学 OpTime *int64 `json:"op_time" db:"op_time"` // op操作时间 } func (p *WithdrawOrder) ToString() string { bs, _ := json.Marshal(p) return string(bs) } func (p *WithdrawOrder) GetID() string { if p != nil && p.ID != nil { return *p.ID } return "" } func (p *WithdrawOrder) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *WithdrawOrder) GetDid() string { if p != nil && p.Did != nil { return *p.Did } return "" } func (p *WithdrawOrder) GetApplyTime() int64 { if p != nil && p.ApplyTime != nil { return *p.ApplyTime } return 0 } func (p *WithdrawOrder) GetAlipayId() string { if p != nil && p.AlipayId != nil { return *p.AlipayId } return "" } func (p *WithdrawOrder) GetAlipayName() string { if p != nil && p.AlipayName != nil { return *p.AlipayName } return "" } func (p *WithdrawOrder) GetWithdrawDias() int64 { if p != nil && p.WithdrawDias != nil { return *p.WithdrawDias } return 0 } func (p *WithdrawOrder) GetWithdrawMoney() int64 { if p != nil && p.WithdrawMoney != nil { return *p.WithdrawMoney } return 0 } func (p *WithdrawOrder) GetIp() string { if p != nil && p.Ip != nil { return *p.Ip } return "" } func (p *WithdrawOrder) GetOrderStatus() int32 { if p != nil && p.OrderStatus != nil { return *p.OrderStatus } return VasWithdrawOrderStatusNone } func (p *WithdrawOrder) GetOperator() string { if p != nil && p.Operator != nil { return *p.Operator } return "" } func (p *WithdrawOrder) GetOpTime() int64 { if p != nil && p.OpTime != nil { return *p.OpTime } return 0 } // 处理记录 type WithdrawDiamondsHis struct { Mid *int64 `json:"mid" db:"mid"` IncomeChId *int64 `json:"income_ch_id" db:"income_ch_id"` OrderId *string `json:"order_id" db:"order_id"` Ct *int64 `json:"ct" db:"ct"` BeforeWithdrawDiamonds *int64 `json:"before_withdraw_diamonds" db:"before_withdraw_diamonds"` AfterWithdrawDiamonds *int64 `json:"after_withdraw_diamonds" db:"after_withdraw_diamonds"` Change *int64 `json:"change" db:"change"` ProductId *string `json:"product_id" db:"product_id"` } func (p *WithdrawDiamondsHis) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *WithdrawDiamondsHis) GetIncomeChId() int64 { if p != nil && p.IncomeChId != nil { return *p.IncomeChId } return 0 } func (p *WithdrawDiamondsHis) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } func (p *WithdrawDiamondsHis) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *WithdrawDiamondsHis) GetBeforeWithdrawDiamonds() int64 { if p != nil && p.BeforeWithdrawDiamonds != nil { return *p.BeforeWithdrawDiamonds } return 0 } func (p *WithdrawDiamondsHis) GetAfterWithdrawDiamonds() int64 { if p != nil && p.AfterWithdrawDiamonds != nil { return *p.AfterWithdrawDiamonds } return 0 } func (p *WithdrawDiamondsHis) GetChange() int64 { if p != nil && p.Change != nil { return *p.Change } return 0 } func (p *WithdrawDiamondsHis) GetProductId() string { if p != nil && p.ProductId != nil { return *p.ProductId } return "" } type UserVasMembershipUnlock struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` ProductId *string `json:"product_id" db:"product_id"` Ct *int64 `json:"ct" db:"ct"` Means *string `json:"means" db:"means"` // 解锁方式,UserVasUnlockMeans OrderId *string `json:"order_id" db:"order_id"` // 关联的订单id } func (p *UserVasMembershipUnlock) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *UserVasMembershipUnlock) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } // 用户解锁空间详情 const ( ZoneUnlockTypeRefund = -2 // 空间退款 ZoneUnlockTypeExit = -1 // 主动退出空间 ZoneUnlockTypeFree = 1 // 免费解锁 ZoneUnlockTypePay = 2 // 付费解锁 ZoneUnlockTypeReachConsume = 3 // 满足消费额解锁 ZoneUnlockTypeThirdPartner = 4 // 代运营直接解锁 ZoneUnlockTypeCollaborator = 5 // 协作者直接解锁 ) var ValidZoneUnlockType = map[int32]bool{ ZoneUnlockTypeFree: true, ZoneUnlockTypePay: true, ZoneUnlockTypeReachConsume: true, ZoneUnlockTypeThirdPartner: true, ZoneUnlockTypeCollaborator: true, } type ZoneUnlock struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // 用户mid Zid *int64 `json:"zid" db:"zid"` // 空间id Oid1 *string `json:"oid1" db:"oid1"` // 辅助id1 Oid2 *string `json:"oid2" db:"oid2"` // 辅助id2 Oid3 *string `json:"oid3" db:"oid3"` // 辅助id3 Oid4 *string `json:"oid4" db:"oid4"` // 辅助id4 Oid5 *string `json:"oid5" db:"oid5"` // 辅助id5 Consume *int64 `json:"consume" db:"consume"` // 空间总消费 AdmissionCt *int64 `json:"admission_ct" db:"admission_ct"` // 普通会员开通时间 AdmissionUntil *int64 `json:"admission_until" db:"admission_until"` // 普通会员到期时间,时间戳,-1: 永久 AdmissionOrderId *string `json:"admission_order_id" db:"admission_order_id"` // 普通会员订单 AdmissionUnlockType *int32 `json:"admission_unlock_type" db:"admission_unlock_type"` // 普通会员解锁类型,见:ZoneUnlockType* IronfanshipCt *int64 `json:"ironfanship_ct" db:"ironfanship_ct"` // 铁粉开通时间 IronfanshipUntil *int64 `json:"ironfanship_until" db:"ironfanship_until"` // 铁粉到期时间,时间戳,-1:永久 IronfanshipOrderId *string `json:"ironfanship_order_id" db:"ironfanship_order_id"` // 铁粉订单 IronfanshipUnlockType *int32 `json:"ironfanship_unlock_type" db:"ironfanship_unlock_type"` // 铁粉解锁类型,见:ZoneUnlockType* SuperfanshipCt *int64 `json:"superfanship_ct" db:"superfanship_ct"` // 超粉开通时间 SuperfanshipUntil *int64 `json:"superfanship_until" db:"superfanship_until"` // 超粉到期时间,时间戳,-1:永久 SuperfanshipOrderId *string `json:"superfanship_order_id" db:"superfanship_order_id"` // 超粉订单id SuperfanshipUnlockType *int32 `json:"superfanship_unlock_type" db:"superfanship_unlock_type"` // 超粉解锁类型,见:ZoneUnlockType* } func (p *ZoneUnlock) IsUnlockAdmission() bool { if p.IsVIP() { return true } if ValidZoneUnlockType[p.GetAdmissionUnlockType()] && (p.GetAdmissionUntil() == -1 || p.GetAdmissionUntil() >= time.Now().Unix()) { return true } return false } func (p *ZoneUnlock) IsUnlockIronfanship() bool { if p.IsVIP() { return true } if ValidZoneUnlockType[p.GetIronfanshipUnlockType()] && p.IsUnlockAdmission() && (p.GetIronfanshipUntil() == -1 || p.GetIronfanshipUntil() >= time.Now().Unix()) { return true } return false } func (p *ZoneUnlock) IsUnlockSuperfanship() bool { if p.IsVIP() { return true } if ValidZoneUnlockType[p.GetSuperfanshipUnlockType()] && p.IsUnlockAdmission() && (p.GetSuperfanshipUntil() == -1 || p.GetSuperfanshipUntil() >= time.Now().Unix()) { return true } return false } func (p *ZoneUnlock) IsVIP() bool { if p.GetOid5() == "vip" { return true } return false } func (p *ZoneUnlock) GetId() int64 { if p != nil && p.AdmissionCt != nil { return *p.AdmissionCt } return 0 } func (p *ZoneUnlock) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ZoneUnlock) GetZid() int64 { if p != nil && p.Zid != nil { return *p.Zid } return 0 } func (p *ZoneUnlock) GetOid5() string { if p != nil && p.Oid5 != nil { return *p.Oid5 } return "" } func (p *ZoneUnlock) GetConsume() int64 { if p != nil && p.Consume != nil { return *p.Consume } return 0 } func (p *ZoneUnlock) GetAdmissionCt() int64 { if p != nil && p.AdmissionCt != nil { return *p.AdmissionCt } return 0 } func (p *ZoneUnlock) GetAdmissionUntil() int64 { if p != nil && p.AdmissionUntil != nil { return *p.AdmissionUntil } return 0 } func (p *ZoneUnlock) GetAdmissionOrderId() string { if p != nil && p.AdmissionOrderId != nil { return *p.AdmissionOrderId } return "" } func (p *ZoneUnlock) GetAdmissionUnlockType() int32 { if p != nil && p.AdmissionUnlockType != nil { return *p.AdmissionUnlockType } return 0 } func (p *ZoneUnlock) GetIronfanshipCt() int64 { if p != nil && p.IronfanshipCt != nil { return *p.IronfanshipCt } return 0 } func (p *ZoneUnlock) GetIronfanshipUntil() int64 { if p != nil && p.IronfanshipUntil != nil { return *p.IronfanshipUntil } return 0 } func (p *ZoneUnlock) GetIronfanshipOrderId() string { if p != nil && p.IronfanshipOrderId != nil { return *p.IronfanshipOrderId } return "" } func (p *ZoneUnlock) GetIronfanshipUnlockType() int32 { if p != nil && p.IronfanshipUnlockType != nil { return *p.IronfanshipUnlockType } return 0 } func (p *ZoneUnlock) GetSuperfanshipCt() int64 { if p != nil && p.SuperfanshipCt != nil { return *p.SuperfanshipCt } return 0 } func (p *ZoneUnlock) GetSuperfanshipUntil() int64 { if p != nil && p.SuperfanshipUntil != nil { return *p.SuperfanshipUntil } return 0 } func (p *ZoneUnlock) GetSuperfanshipOrderId() string { if p != nil && p.SuperfanshipOrderId != nil { return *p.SuperfanshipOrderId } return "" } func (p *ZoneUnlock) GetSuperfanshipUnlockType() int32 { if p != nil && p.SuperfanshipUnlockType != nil { return *p.SuperfanshipUnlockType } return 0 } // 空间消费详情 type ZoneConsumeHis struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // 用户mid Zid *int64 `json:"zid" db:"zid"` // 空间id Consume *int64 `json:"consume" db:"consume"` // 单笔消费 Ct *int64 `json:"ct" db:"ct"` // 解锁时间 OrderId *string `json:"order_id" db:"order_id"` // 绑定的订单id ProductId *string `json:"product_id" db:"product_id"` // 商品id } func (p *ZoneConsumeHis) GetId() int64 { if p != nil && p.Id != nil { return *p.Id } return 0 } func (p *ZoneConsumeHis) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ZoneConsumeHis) GetZid() int64 { if p != nil && p.Zid != nil { return *p.Zid } return 0 } func (p *ZoneConsumeHis) GetConsume() int64 { if p != nil && p.Consume != nil { return *p.Consume } return 0 } func (p *ZoneConsumeHis) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *ZoneConsumeHis) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } func (p *ZoneConsumeHis) GetProductId() string { if p != nil && p.ProductId != nil { return *p.ProductId } return "" } // 空间成员列表 const ( ZoneMemberTypeNormal = 1 // 普通会员 ZoneMemberTypeIronfan = 2 // 铁粉 ZoneMemberTypeSuperfan = 3 // 超粉 ) type ZoneMember struct { Id *int64 `json:"id" db:"id"` Zid *int64 `json:"zid" db:"zid"` // 空间id Mid *int64 `json:"mid" db:"mid"` // 用户id MemberType *int32 `json:"member_type" db:"member_type"` // 空间成员类型 ZoneMemberType* Ct *int64 `json:"ct" db:"ct"` // 成为成员的时间 } func (p *ZoneMember) GetId() int64 { if p != nil && p.Id != nil { return *p.Id } return 0 } func (p *ZoneMember) GetZid() int64 { if p != nil && p.Zid != nil { return *p.Zid } return 0 } func (p *ZoneMember) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ZoneMember) GetMemberType() int32 { if p != nil && p.MemberType != nil { return *p.MemberType } return 0 } func (p *ZoneMember) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } // 空间动态解锁 const ( ZoneMomentUnlockStatusRefund = -1 // 已退款 ZoneMomentUnlockStatusLock = 0 // 未解锁 ZoneMomentUnlockStatusUnlock = 1 // 已解锁 ) type ZoneMomentUnlock struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // 用户id Zid *int64 `json:"zid" db:"zid"` // 空间id MomentId *int64 `json:"moment_id" db:"moment_id"` // 动态id Status *int32 `json:"status" db:"status"` // 状态, ZoneMomentUnlockStatus* Ct *int64 `json:"ct" db:"ct"` // 解锁时间 OrderId *string `json:"order_id" db:"order_id"` // 绑定的订单id } func (p *ZoneMomentUnlock) IsUnlock() bool { if p.GetStatus() == ZoneMomentUnlockStatusUnlock { return true } return false } func (p *ZoneMomentUnlock) GetId() int64 { if p != nil && p.Id != nil { return *p.Id } return 0 } func (p *ZoneMomentUnlock) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ZoneMomentUnlock) GetZid() int64 { if p != nil && p.Zid != nil { return *p.Zid } return 0 } func (p *ZoneMomentUnlock) GetMomentId() int64 { if p != nil && p.MomentId != nil { return *p.MomentId } return 0 } func (p *ZoneMomentUnlock) GetStatus() int32 { if p != nil && p.Status != nil { return *p.Status } return 0 } func (p *ZoneMomentUnlock) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *ZoneMomentUnlock) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } // 空间退款记录 type ZoneRefundHis struct { Id *int64 `json:"id" db:"id"` Mid *int64 `json:"mid" db:"mid"` // 用户id Zid *int64 `json:"zid" db:"zid"` // 空间id Ct *int64 `json:"ct" db:"ct"` // 解锁时间 ContactName *string `json:"contact_name" db:"contact_name"` // 联系方式 ContactPhone *string `json:"contact_phone" db:"contact_phone"` // 联系电话 Note *string `json:"note" db:"note"` // 备注 OrderId *string `json:"order_id" db:"order_id"` // 绑定的订单id ProductId *string `json:"product_id" db:"product_id"` // 商品id } func (p *ZoneRefundHis) GetId() int64 { if p != nil && p.Id != nil { return *p.Id } return 0 } func (p *ZoneRefundHis) GetMid() int64 { if p != nil && p.Mid != nil { return *p.Mid } return 0 } func (p *ZoneRefundHis) GetZid() int64 { if p != nil && p.Zid != nil { return *p.Zid } return 0 } func (p *ZoneRefundHis) GetCt() int64 { if p != nil && p.Ct != nil { return *p.Ct } return 0 } func (p *ZoneRefundHis) GetContactName() string { if p != nil && p.ContactName != nil { return *p.ContactName } return "" } func (p *ZoneRefundHis) GetContactPhone() string { if p != nil && p.ContactPhone != nil { return *p.ContactPhone } return "" } func (p *ZoneRefundHis) GetNote() string { if p != nil && p.Note != nil { return *p.Note } return "" } func (p *ZoneRefundHis) GetOrderId() string { if p != nil && p.OrderId != nil { return *p.OrderId } return "" } func (p *ZoneRefundHis) GetProductId() string { if p != nil && p.ProductId != nil { return *p.ProductId } return "" }