forked from all_user/stat_center
280 lines
15 KiB
Go
280 lines
15 KiB
Go
package proto
|
|
|
|
import (
|
|
"stat/common"
|
|
"stat/models/channelmod"
|
|
"time"
|
|
)
|
|
|
|
type AgentLoginReq struct {
|
|
Account *string `form:"account" json:"account" binding:"required"` // 账号
|
|
Password *string `form:"password" json:"password" binding:"required"` // 密码
|
|
ImgCode string `form:"imgCode" json:"imgCode"` // 图片验证码
|
|
ImgID string `form:"imgID" json:"imgID"` // 图片编号
|
|
}
|
|
|
|
type AgentLoginRes struct {
|
|
Token string `json:"token"` // token
|
|
Channel string `json:"channel"` // 渠道
|
|
Detail *ChannelAgentInfo `json:"detail"` // 渠道详情
|
|
}
|
|
|
|
type AgentImgVerifyCode struct {
|
|
VerifyImg []byte `form:"verifyImg" json:"verifyImg"` // 验证码数据
|
|
ImgId string `form:"imgId" json:"imgId"` // 验证码ID
|
|
}
|
|
|
|
type AgentChannelInfoSearch struct {
|
|
ID *string `json:"id"` // ID
|
|
AppId *int32 `json:"appId"` // 渠道对应的appId
|
|
Type *channelmod.ChannelType `json:"Type"` // 渠道类型:1 一级 2:二级
|
|
common.Page
|
|
}
|
|
|
|
type ChannelAppInfoReq struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
}
|
|
type ChannelAppInfo struct {
|
|
AppId int32 `bson:"appId" json:"appId"` // 应用ID
|
|
AppName string `bson:"appName" json:"appName"` // 应用名称
|
|
LandingPage string `bson:"landingPage" json:"landingPage"` // 落地页
|
|
}
|
|
type ChannelAppInfoResp struct {
|
|
List []ChannelAppInfo `bson:"list" json:"list"`
|
|
}
|
|
|
|
type ChannelAgentInfo struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
AppIds []int32 `bson:"appIds" json:"appIds"` // 渠道对应的app
|
|
UserName string `bson:"userName" json:"userName"` // 所有者
|
|
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
|
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
|
Status bool `bson:"status" json:"status"` // 状态 开/关
|
|
Mobile string `bson:"mobile" json:"mobile"` // 手机号
|
|
Type channelmod.ChannelType `bson:"type" json:"type"` // 渠道类型:1 一级 2:二级
|
|
Remark string `bson:"remark" json:"remark"` // 备注
|
|
Lock bool `bson:"lock" json:"lock"` // 禁止登陆
|
|
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
|
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
|
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
|
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
|
ChildShowDivideRate bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 下级是否显示分成比例
|
|
Wallet channelmod.Wallet `bson:"wallet" json:"wallet"` // 钱包地址
|
|
AppType channelmod.AppType `bson:"appType" json:"appType"` // 应用类型
|
|
PromoteMode channelmod.PromoteMode `bson:"promoteMode" json:"promoteMode"` // 推广类型
|
|
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // 创建时间
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
|
}
|
|
type AgentChannelInfoSearchResp struct {
|
|
Total int64 `json:"total"`
|
|
List []ChannelAgentInfo `json:"list"`
|
|
}
|
|
|
|
type AgentChannelRuleUpdate struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
CPAPrice *int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
|
CPSRate *int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
|
DivideRate *int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
|
ChildShowDivideRate *bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 渠道:下级是否显示分成比例
|
|
Remark *string `bson:"remark" json:"remark"` // 备注
|
|
}
|
|
|
|
type AgentChannelInfoUpdate struct {
|
|
Channel string `json:"channel"` // 渠道
|
|
Mobile *string `json:"mobile"` // 手机号
|
|
WalletAddr1 *string `json:"walletAddr1"` // 钱包地址1
|
|
WalletAddr2 *string `json:"walletAddr2"` // 钱包地址2
|
|
Status *bool `json:"status"` // 状态 开/关
|
|
}
|
|
|
|
type AgentChannelPasswordUpdate struct {
|
|
OldPassword string `json:"oldPassword"` // 代理商旧密码
|
|
NewPassword string `json:"newPassword"` // 代理商新密码
|
|
}
|
|
|
|
type AgentChannelPasswordReset struct {
|
|
Channel string `json:"channel"` // 下级渠道
|
|
Password string `json:"password"` // 新密码
|
|
}
|
|
|
|
// AgentChannelInfoAdd 新增渠道
|
|
type AgentChannelInfoAdd struct {
|
|
Password string `json:"password"` // 代理商密码
|
|
Mobile string `json:"mobile"` // 手机号
|
|
WalletAddr1 string `json:"walletAddr1"` // 钱包地址1
|
|
WalletAddr2 string `json:"walletAddr2"` // 钱包地址2
|
|
Status bool `bson:"status"` // 状态 开/关
|
|
Remark string `json:"remark"` // 备注
|
|
}
|
|
|
|
// AgentDeductedStat 渠道后台查询结算
|
|
type AgentDeductedStat struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
AppName string `bson:"appName" json:"appName"` // 应用名称
|
|
AppId int32 `bson:"appId" json:"appId"` // appId
|
|
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
|
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
|
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
|
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
|
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间
|
|
VisitCount int64 `bson:"visitCount" json:"visitCount"` // 访问量
|
|
DirectCount int64 `bson:"directCount" json:"directCount"` // 新增量(包含子渠道和渠道本身)
|
|
DirectCountSelf int64 `bson:"directCountSelf" json:"directCountSelf"` // 自身渠道新增量
|
|
DirectCountChild int64 `bson:"directCountChild" json:"directCountChild"` // 子渠道新增量
|
|
Recharge int64 `bson:"recharge" json:"recharge"` // 充值金额(包含子渠道和渠道本身)
|
|
RechargeSelf int64 `bson:"rechargeSelf" json:"rechargeSelf"` // 来自自身渠道充值金额
|
|
RechargeChild int64 `bson:"rechargeChild" json:"rechargeChild"` // 来自子渠道充值金额
|
|
Income int64 `bson:"income" json:"income"` // 当日收益(自身+子渠道)
|
|
IncomeChild int64 `bson:"incomeChild" json:"incomeChild"` // 来自子渠道的当日收益
|
|
IncomeSelf int64 `bson:"incomeSelf" json:"incomeSelf"` // 来自自身渠道的当日收益
|
|
ChildRebate int64 `bson:"childRebate" json:"childRebate"` // 子渠道返佣
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
|
}
|
|
|
|
type AgentChannelStatSearch struct {
|
|
AppId *int32 `json:"appId"` // appId
|
|
Channel *string `bson:"channel" json:"channel"` // 渠道
|
|
Start *time.Time `json:"start"` // 开始时间
|
|
End *time.Time `json:"end"` // 结束时间
|
|
common.Page
|
|
}
|
|
|
|
type AgentChannelStatResp struct {
|
|
Total int64 `json:"total"`
|
|
List []*AgentDeductedStat `json:"list"`
|
|
TotalInfo AgentDeductedStat `json:"totalInfo"`
|
|
}
|
|
|
|
type AgentChannelStatOldSearch struct {
|
|
AppId *int32 `json:"appId"` // appId
|
|
Channel *string `bson:"channel" json:"channel"` // 渠道
|
|
Start *time.Time `json:"start"` // 开始时间
|
|
End *time.Time `json:"end"` // 结束时间
|
|
common.Page
|
|
}
|
|
|
|
// AgentChannelStat 渠道后台查询结算
|
|
type AgentChannelStatOld struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
AppName string `bson:"appName" json:"appName"` // 应用名称
|
|
AppId int32 `bson:"appId" json:"appId"` // appId
|
|
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间
|
|
DirectCount int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 下载量
|
|
VisitCount int64 `bson:"directVisitCount" json:"directVisitCount"` // 访问量
|
|
RechargeAmount int64 `bson:"directAmount" json:"directAmount"` // 充值金额
|
|
TodayIncome int64 `bson:"todayIncome" json:"todayIncome"` // 当日收益
|
|
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
|
}
|
|
|
|
type AgentChannelStatOldResp struct {
|
|
Total int64 `json:"total"`
|
|
List []AgentChannelStatOld `json:"list"`
|
|
TotalInfo AgentChannelStatOld `json:"totalInfo"`
|
|
}
|
|
|
|
type StatDataSimple struct {
|
|
VisitCount int64 `bson:"visitCount" json:"visitCount"` // 访问总量(包含子渠道和渠道本身)
|
|
DirectCount int64 `bson:"directCount" json:"directCount"` // 新增总量(包含子渠道和渠道本身)
|
|
Recharge int64 `bson:"recharge" json:"recharge"` // 充值金额(包含子渠道和渠道本身)
|
|
Income int64 `bson:"income" json:"income"` // 收益(自身+子渠道)
|
|
}
|
|
|
|
type StatDataDetail struct {
|
|
StatDataSimple
|
|
DirectCountSelf int64 `bson:"directCountSelf" json:"directCountSelf"` // 自身渠道新增量
|
|
DirectCountChild int64 `bson:"directCountChild" json:"directCountChild"` // 子渠道新增量
|
|
RechargeSelf int64 `bson:"rechargeSelf" json:"rechargeSelf"` // 来自自身渠道充值金额
|
|
RechargeChild int64 `bson:"rechargeChild" json:"rechargeChild"` // 来自子渠道充值金额
|
|
IncomeChild int64 `bson:"incomeChild" json:"incomeChild"` // 子渠道的收益
|
|
IncomeSelf int64 `bson:"incomeSelf" json:"incomeSelf"` // 自身渠道的收益
|
|
ChildRebate int64 `bson:"childRebate" json:"childRebate"` // 子渠道返佣
|
|
}
|
|
|
|
func (s *StatDataDetail) ToStatDataSimple() *StatDataSimple {
|
|
return &s.StatDataSimple
|
|
}
|
|
|
|
// AgentSummaryStatHome 渠道汇总
|
|
type AgentSummaryStatHome struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
|
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
|
AppName string `bson:"appName" json:"appName"` // 应用名称
|
|
AppId int32 `bson:"appId" json:"appId"` // appId
|
|
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
|
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
|
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
|
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
|
TotalStat *StatDataDetail `bson:"totalStat" json:"totalStat"` // 所有统计
|
|
TodayStat *StatDataDetail `bson:"todayStat" json:"todayStat"` // 今日统计
|
|
WeekStat *StatDataDetail `bson:"weekStat" json:"weekStat"` // 本周统计
|
|
MonthStat *StatDataDetail `bson:"monthStat" json:"monthStat"` // 本月统计
|
|
YearStat *StatDataDetail `bson:"yearStat" json:"yearStat"` // 本年统计
|
|
}
|
|
|
|
func (s *AgentSummaryStatHome) ToAgentSummaryStatChild() *AgentSummaryStatChild {
|
|
stat := &AgentSummaryStatChild{
|
|
Channel: s.Channel,
|
|
ParentAgent: s.ParentAgent,
|
|
ChildCount: s.ChildCount,
|
|
AppName: s.AppName,
|
|
AppId: s.AppId,
|
|
Settlement: s.Settlement,
|
|
CPAPrice: s.CPAPrice,
|
|
CPSRate: s.CPSRate,
|
|
DivideRate: s.DivideRate,
|
|
TotalStat: s.TotalStat.ToStatDataSimple(),
|
|
TodayStat: s.TodayStat.ToStatDataSimple(),
|
|
WeekStat: s.WeekStat.ToStatDataSimple(),
|
|
MonthStat: s.MonthStat.ToStatDataSimple(),
|
|
YearStat: s.YearStat.ToStatDataSimple(),
|
|
}
|
|
return stat
|
|
}
|
|
|
|
type AgentSummaryStatHomeList []*AgentSummaryStatHome
|
|
|
|
func (a AgentSummaryStatHomeList) Len() int { return len(a) }
|
|
func (a AgentSummaryStatHomeList) Less(i, j int) bool {
|
|
return a[i].TotalStat.Income > a[j].TotalStat.Income
|
|
}
|
|
func (a AgentSummaryStatHomeList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
|
|
type AgentSummaryStatHomeSearch struct {
|
|
common.Page
|
|
}
|
|
|
|
type AgentSummaryStatHomeResp struct {
|
|
Total int64 `json:"total"`
|
|
List AgentSummaryStatHomeList `json:"list"`
|
|
}
|
|
|
|
// AgentSummaryStatChild 下级渠道汇总
|
|
type AgentSummaryStatChild struct {
|
|
Channel string `bson:"channel" json:"channel"` // 渠道
|
|
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理
|
|
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
|
AppName string `bson:"appName" json:"appName"` // 应用名称
|
|
AppId int32 `bson:"appId" json:"appId"` // appId
|
|
Settlement channelmod.SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
|
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
|
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
|
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 分成比例
|
|
TotalStat *StatDataSimple `bson:"totalStat" json:"totalStat"` // 所有统计
|
|
TodayStat *StatDataSimple `bson:"todayStat" json:"todayStat"` // 今日统计
|
|
WeekStat *StatDataSimple `bson:"weekStat" json:"weekStat"` // 本周统计
|
|
MonthStat *StatDataSimple `bson:"monthStat" json:"monthStat"` // 本月统计
|
|
YearStat *StatDataSimple `bson:"yearStat" json:"yearStat"` // 本年统计
|
|
}
|
|
|
|
type AgentSummaryStatChildList []*AgentSummaryStatChild
|
|
|
|
type AgentSummaryStatChildSearch struct {
|
|
common.Page
|
|
}
|
|
|
|
type AgentSummaryStatChildResp struct {
|
|
Total int64 `json:"total"`
|
|
List AgentSummaryStatChildList `json:"list"`
|
|
}
|