package dbstruct import ( "encoding/json" ) // 订单状态 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) 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 // 消费明细,联系方式 CHSTypeCostRefund = 10002 // 消费明细,金币退款 CHSTypeCostMembership = 10003 // 消费明细,会员资格解锁(伪金币记录,会员资格解锁中间无转金币过程) CHSTypeCostRefundMembership = 10004 // 消费明细,会员资格解锁退款(伪金币记录,会员资格解锁中间无转金币过程) CHSTypeChargeUser = 20001 // 充值明细,用户自己冲 CHSTypeChargeOp = 20002 // 充值明细,OP充值 CHSTypeChargeRefund = 20003 // 充值明细,现金退款 CHSTypeChargeRefundMembership = 20004 // 充值明细,会员退款 CHSTypeIncomeContact = 30001 // 收入明细,联系方式 CHSTypeIncomeInvite = 30002 // 收入明细,邀请分成 CHSTypeIncomeRefund = 30003 // 收入明细,退款 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" bson:"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 "" }