166 lines
8.4 KiB
Go
166 lines
8.4 KiB
Go
package commod
|
||
|
||
import (
|
||
"time"
|
||
|
||
"github.com/shopspring/decimal"
|
||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||
)
|
||
|
||
//统计中心Model
|
||
|
||
type KFKTopic string
|
||
|
||
const (
|
||
KFK_APPID int32 = 204 // 205:91PORN
|
||
KFK_APP_NAME = "91PORN" // app名字
|
||
USER_REG KFKTopic = "user_register" // 用户注册
|
||
USER_RECH KFKTopic = "user_recharge" // 用户充值
|
||
USER_RECH_ALL KFKTopic = "user_recharge_all" // 全部订单
|
||
USER_ACCE KFKTopic = "user_access" // 用户访问
|
||
USER_WOTHDRAW KFKTopic = "user_withdraw" // 用户提现
|
||
USER_BINDING KFKTopic = "user_binding" // 用户绑定
|
||
USER_INVITE KFKTopic = "user_invite" // 用户邀请
|
||
ConsumeRecordJob = "consume_record" // 产品消费流水
|
||
CardSellJob KFKTopic = "card_sell" // 会员卡特权卡销售流水
|
||
AiSellJob = "ai_sell" // AI销售流水
|
||
AdsTimeLongVideo = 15 // 长视频广告时间(单位: 秒)
|
||
)
|
||
|
||
type AiSellMsg struct {
|
||
AppID int32 `json:"appID" bson:"appID"` // AppID
|
||
UID uint64 `json:"uid" bson:"uid"` // UID
|
||
UniqID string `json:"uniqID" bson:"uniqID"` // 唯一ID,各个app内部交易ID
|
||
Amount int64 `json:"amount" bson:"amount"` // 金币数
|
||
TranType string `json:"tranType" bson:"tranType"` // 交易类型
|
||
SysType string `json:"sysType" bson:"sysType"` // 系统类型
|
||
CurrencyType string `json:"currencyType" bson:"currencyType"` // 交易类型,pay、free
|
||
TranCreatedAt time.Time `json:"tranCreatedAt" bson:"tranCreatedAt"` // 交易完成时间
|
||
IsRepurchase string `json:"isRepurchase" bson:"isRepurchase"` // 是否复购,yes、no
|
||
|
||
}
|
||
|
||
// UserRegisterMsg 用户注册
|
||
type UserRegisterMsg struct {
|
||
UserId uint64 `json:"userId"`
|
||
AppId int32 `json:"appId"`
|
||
PlatformId string `json:"platformId"` // 原始平台流水Id
|
||
SysType string `json:"sysType"`
|
||
DevType string `json:"devType"`
|
||
Mobile string `json:"mobile"`
|
||
Name string `json:"name"`
|
||
IP string `json:"ip"`
|
||
IsDirect bool `json:"isDirect"`
|
||
DistrictCode string `json:"districtCode"` // 渠道推广 dc
|
||
PromSeqe string `json:"promSeqe"` // 代理推广 pc
|
||
PUC string `json:"puc" bson:"puc"` //
|
||
PromCode string `json:"promCode"` // 用户推广序列(全名代理)
|
||
RegisterTime time.Time `json:"registerTime"`
|
||
}
|
||
|
||
// UserAccessMsg 用户访问 用户每天第一访问
|
||
type UserAccessMsg struct {
|
||
UserId uint64 `json:"userId"`
|
||
PlatformId string `json:"platformId"` // 原始平台流水Id
|
||
AppId int32 `json:"appId"`
|
||
SysType string `json:"sysType"`
|
||
DevType string `json:"devType"`
|
||
IP string `json:"ip"`
|
||
Version string `json:"version"`
|
||
DevID string `json:"devID"`
|
||
VisitAt time.Time `json:"visitAt"`
|
||
|
||
IsDirect bool `json:"isDirect,omitempty"` // true:是直推用户
|
||
DistrictCode string `json:"districtCode,omitempty"` // 渠道码
|
||
RegisterTime time.Time `json:"registerTime,omitempty"` //用户注册时间
|
||
IsDeduction bool `json:"isDeduction,omitempty"` // true:CPA扣量用户
|
||
}
|
||
|
||
// UserBindingMsg 用户绑定
|
||
type UserBindingMsg struct {
|
||
UserId uint64 `json:"userId"` // 用户ID
|
||
AppId int32 `json:"appId"` // appID
|
||
PlatformId string `json:"platformId"` // 原始平台流水Id
|
||
SysType string `json:"sysType"` // 操作系统类型 安卓 IOS
|
||
DevType string `json:"devType"` // 设备类型
|
||
Mobile string `json:"mobile"` // 手机号
|
||
BindingTime *time.Time `json:"bindingTime"` // 绑定时间
|
||
}
|
||
|
||
type UserInviteBindMsg struct {
|
||
UserId uint64 `json:"userId" bson:"userId" binding:"required"` // 用户ID
|
||
AppId int32 `json:"appId" bson:"appId" binding:"required"` // appID
|
||
ParentPromCode string `json:"parentPromCode,omitempty" bson:"promSeqe"` // 邀请人推广码
|
||
InviteTime time.Time `json:"inviteTime,omitempty" bson:"inviteTime" binding:"required"` // 邀请码绑定时间
|
||
}
|
||
|
||
const (
|
||
StatVipCard = iota //会员卡
|
||
StatLouFeng //楼凤
|
||
StatValueAddSer //增值服务
|
||
)
|
||
|
||
const (
|
||
CurrencyTypeGold = iota //金币
|
||
CurrencyTypeCash //现金
|
||
)
|
||
|
||
type ConsumeRecordMsg struct {
|
||
AppID int32 `json:"appID" bson:"appID"`
|
||
UID uint64 `json:"uid" bson:"uid"` //
|
||
Type int `json:"type" bson:"type"` //消费类型
|
||
CurrencyType int `json:"currencyType" bson:"currencyType"` //货币类型 0金币 1人民币
|
||
Money decimal.Decimal `json:"money" bson:"money"` //人民币 元
|
||
Amount decimal.Decimal `json:"amount" bson:"amount"` //金币(角)
|
||
Uniq string `json:"uniq" bson:"uniq"` //唯一号码
|
||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"` //记录创建时间
|
||
}
|
||
|
||
// 用户充值消息
|
||
type UserRechargeMsg struct {
|
||
UserId uint64 `json:"userId" bson:"userId" binding:"required"` // 用户ID
|
||
AppId int32 `json:"appId" bson:"appId" binding:"required"` // appID
|
||
PlatformId string `json:"platformId" bson:"platformId"` // 原始平台流水Id
|
||
SysType string `json:"sysType" bson:"sysType" binding:"required"` // 操作系统类型 安卓 IOS
|
||
DevType string `json:"devType" bson:"devType"` // 设备类型
|
||
ChannelName string `json:"channelName" bson:"channelName"` // 支付渠道名字
|
||
CID string `json:"cid" bson:"cid"` // 渠道id
|
||
Type string `bson:"type" json:"type"` // 充值方式
|
||
OrderId string `json:"orderId" bson:"orderId" binding:"required"` // 流水id
|
||
OID string `json:"oid" bson:"oid"` //第三方支付流水id
|
||
Money int64 `json:"money" bson:"money" binding:"required"` // 充值金额 订单金额
|
||
PayMoney int64 `json:"payMoney" bson:"payMoney" binding:"required"` // 实际到账金额 用户实际支付金额
|
||
Status int `json:"status" bson:"status"` // 2付款失败 3付款成功(目前只有成功才发送)
|
||
Rate string `json:"rate"` //渠道费率
|
||
SuccessAt time.Time `json:"successAt,omitempty" bson:"successAt"` // 成功时间
|
||
ProductType int `json:"productType" bson:"productType"`
|
||
ChanShareMod int `json:"chanShareMod" bson:"chanShareMod"` //渠道分成 0消费分成 1金币分成 2不分成
|
||
/*......*/
|
||
}
|
||
|
||
type CardSellMsg struct {
|
||
AppID int32 `json:"appID" bson:"appID"` // AppID
|
||
UID uint64 `json:"uid" bson:"uid"` // UID
|
||
UniqID string `json:"uniqID" bson:"uniqID"` // 唯一ID,各个app内部交易ID
|
||
Amount int64 `json:"amount" bson:"amount"` // 金币数
|
||
TranTypeInt int64 `json:"tranTypeInt" bson:"tranTypeInt"` // 交易类型码
|
||
TranType string `json:"tranType" bson:"tranType"` // 交易类型文字描述
|
||
SysType string `json:"sysType" bson:"sysType"` // 系统类型
|
||
CurrencyType int `json:"currencyType" bson:"currencyType"` // 交易类型(0 金币 1 现金)
|
||
TranCreatedAt time.Time `json:"tranCreatedAt" bson:"tranCreatedAt"` // 交易完成时间
|
||
Product Product `json:"product" bson:"product"` // 产品信息
|
||
}
|
||
|
||
type Position struct {
|
||
ID primitive.ObjectID `json:"id" bson:"id"` // 位置ID
|
||
Name string `json:"name" bson:"name"` // 位置名称
|
||
}
|
||
|
||
type Product struct {
|
||
ID string `json:"id"` // ID
|
||
Name string `json:"name"` // 产品名称
|
||
DiscountedPrice int64 `bson:"discountedPrice" json:"discountedPrice"` // 现价 单位角(金币)
|
||
ProductType ProductType `bson:"productType" json:"productType"` // 产品类型
|
||
Position Position `json:"position"` // 产品位置
|
||
}
|