Files
stat_center/api/proto/channelinfo.go
T
2026-05-20 16:13:58 +08:00

404 lines
23 KiB
Go

package proto
import (
"stat/common"
"stat/models/channelmod"
"stat/models/channelsettlementrecord"
"stat/models/registermod"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
// ChannelInfoSearch 渠道信息查询
type ChannelInfoSearch struct {
ID *string `json:"id"` // ID
Channel *string `json:"channel"` // 渠道
AppId *int32 `json:"appId"` // 渠道对应的appId
Type *channelmod.ChannelType `json:"Type"` // 渠道类型:1 一级 2:二级
ParentChannel *string `json:"parentChannel"` // 父渠道 二级:存在父渠道
UserName *string `json:"userName"` // 所有者
Status *bool `json:"status"` // 状态 开/关
Remark *string `json:"remark"` // 备注
Mobile *string `json:"mobile"` // 手机号
common.Page
}
type ChannelInfoSearchResp struct {
Total int64 `json:"total"`
List channelmod.ChannelInfoList `json:"list"`
}
// ChannelInfoUpdate 渠道更新
type ChannelInfoUpdate struct {
ID string `json:"id,omitempty" binding:"required"` // ID
Password *string `json:"password" bson:"password,omitempty"` // 渠道密码
Status *bool `json:"status" bson:"status,omitempty"` // 状态 开/关
Remark *string `json:"remark" bson:"remark,omitempty"` // 备注
Mobile *string `json:"mobile" bson:"mobile,omitempty"` // 手机号
ShowMagic *int32 `json:"showMagic" bson:"showMagic,omitempty"` // 异常登陆次数
Lock *bool `json:"lock" bson:"lock,omitempty"` // 禁止登陆
WalletAddr1 *string `json:"walletAddr1" bson:"wallet.addr1,omitempty"` // 钱包地址1
WalletAddr2 *string `json:"walletAddr2" bson:"wallet.addr2,omitempty"` // 钱包地址2
AutoGenApk *bool `bson:"autoGenApk" json:"autoGenApk,omitempty"` // 自动生成渠道包
ChildShowDivideRate *bool `bson:"childShowDivideRate" json:"childShowDivideRate,omitempty"` // 下级是否显示分成比例
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
}
// ChannelOwnerUpdate 渠道所有者更新
type ChannelOwnerUpdate struct {
Channel string `json:"channel" bson:"channel" binding:"required"` // 渠道ID
UserName string `json:"userName" bson:"userName"` // 所有者名字
Mark string `json:"mark" bson:"mark"` // 备注
}
// ChannelInfoAdd 新增渠道
type ChannelInfoAdd struct {
Channel string `json:"channel" binding:"required"` // 渠道
Type channelmod.ChannelType `json:"type" binding:"required"` // 渠道类型:1 一级 2:二级
ParentChannel string `json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
Password string `json:"password"` // 代理商密
Status bool `json:"status"` // 状态 开/关
Remark string `json:"remark"` // 备注
Mobile string `json:"mobile"` // 手机号
Lock bool `json:"lock"` // 禁止登陆
ChildShowDivideRate bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 下级是否显示分成比例
}
// ChannelInfoDelete 删除渠道信息
type ChannelInfoDelete struct {
ID string `json:"id,omitempty" binding:"required"` // ID
}
// ChannelDeductionRuleSearch 渠道扣量规则查询
type ChannelDeductionRuleSearch struct {
AppId *int32 `json:"appId"` // 应用ID
Channel *string `json:"channel"` // 渠道
common.Page
}
type ChannelDeductionRuleSearchResp struct {
Total int64 `json:"total"`
List channelmod.ChannelDeductionRuleList `json:"list"`
}
// ChannelDeductionRuleUpdate 更新扣量规则
type ChannelDeductionRuleUpdate struct {
ID string `json:"id" binding:"required"` // ID
AppType *channelmod.AppType `json:"appType" bson:"appType,omitempty"` // 应用类型
PromoteMode *channelmod.PromoteMode `json:"promoteMode" bson:"promoteMode,omitempty"` // 推广类型
First *int32 `json:"first" bson:"first,omitempty" ` // 一阶(1单)
Second *int32 `json:"second" bson:"second,omitempty"` // 二阶(2-3单)
Third *int32 `json:"third" bson:"third,omitempty"` // 三阶(4-5单)
Fourth *int32 `json:"fourth" bson:"fourth,omitempty"` // 四阶(6-10单)
Fifth *int32 `json:"fifth" bson:"fifth,omitempty"` // 5阶(11单以上)
CPAPrice *int64 `json:"cpaPrice" bson:"cpaPrice,omitempty"` // 单价
CPSRate *int64 `json:"cpsRate" bson:"cpsRate,omitempty"` // CPS分成比列 0-100
CPSBegin *int64 `json:"cpsBegin" bson:"cpsBegin,omitempty"` // CPS 开始扣量金额
CPSDeductionRate *int64 `json:"cpsDeductionRate" bson:"cpsDeductionRate,omitempty"` // CPS 扣量比例
BeginTime *time.Time `json:"deductionAt" bson:"deductionAt,omitempty"` // 扣量开始时间
LandingPage *string `json:"landingPage" bson:"landingPage,omitempty"` // 落地页
ProxyDeduction *int64 `json:"proxyDeduction" bson:"proxyDeduction,omitempty"` // 代理扣量比例
DivideRate *int64 `json:"divideRate" bson:"divideRate,omitempty"` // 代理分成比例
UpdatedAt *time.Time `json:"updatedAt" bson:"updatedAt,omitempty"` // 更新时间
AutoDeduction *bool `json:"autoDeduction" bson:"autoDeduction,omitempty"` // 自动扣量开关
LessIncomeRate *float64 `json:"lessIncomeRate" bson:"lessIncomeRate,omitempty"` // 最低收益比 CPA低于该值开启扣量(0.1 - 3.0)
}
// ChannelDeductionRuleAdd 新增扣量规则
type ChannelDeductionRuleAdd struct {
AppId int32 `json:"appId" binding:"required"` // 应用ID
Channel string `json:"channel" binding:"required"` // 渠道
Settlement channelmod.SettlementWay `json:"settlement" binding:"required"` // 结算方式 cps/cpa/cpt/cpc (cpt/cpc 1-5阶设置100 不可编辑)
AppType channelmod.AppType `json:"appType" bson:"appType,omitempty"` // 应用类型
PromoteMode channelmod.PromoteMode `json:"promoteMode" bson:"promoteMode,omitempty"` // 推广类型
First int32 `json:"first" binding:"min=0,max=100"` // 一阶
Second int32 `json:"second" binding:"min=0,max=100"` // 二阶
Third int32 `json:"third" binding:"min=0,max=100"` // 三阶
Fourth int32 `json:"fourth" binding:"min=0,max=100"` // 四阶
Fifth int32 `json:"fifth" binding:"min=0,max=100"` // 5阶
CPAPrice int64 `json:"cpaPrice"` // 单价(分) 前端可设置1.80
CPSRate int64 `json:"cpsRate" binding:"min=0,max=100"` // CPS分成比列
CPSBegin int64 `json:"cpsBegin"` // CPS 开始扣量金额
CPSDeductionRate int64 `json:"cpsDeductionRate"` // CPS 扣量比例
LandingPage string `json:"landingPage"` // 落地页
ProxyDeduction int64 `json:"proxyDeduction" binding:"min=0,max=100"` // 代理扣量比例
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 代理分成比例
BeginTime time.Time `json:"deductionAt"` // 扣量开始时间(默认当前时间)
AutoDeduction bool `json:"autoDeduction" bson:"autoDeduction"` // 自动扣量开关
LessIncomeRate *float64 `json:"lessIncomeRate" bson:"lessIncomeRate"` // 最低收益比 CPA低于该值开启扣量(0.1 - 3.0)
}
type ChannelDeductionRuleDelete struct {
ID string `json:"id,omitempty" binding:"required"` // ID
}
// ChannelStatSearch 渠道统计(每天)查询
type ChannelStatSearch struct {
DayType *int8 `json:"dayType"` // 天数
RankType *int8 `json:"rankType"` // 排序方式:统计时间+1充值,2新增,3收益
Channel *string `json:"channel"` // 渠道
AppId *[]int32 `json:"appId"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
WithChild *bool `json:"withChild"` // 包含子渠道
Detail *bool `json:"detail"` // true 渠道详细
SumDate *time.Time `json:"sumDate"` // 哪一天
UserName *string `json:"userName"` // 所有者
Settlement *channelmod.SettlementWay `bson:"settlement"` // 结算方式 cps/cpa/cpt/cpc
common.Page
}
func (s *ChannelStatSearch) CanCalcTotal() bool {
return s.Start != nil && s.End != nil && s.AppId != nil && s.Channel != nil
}
type ChannelStatSearchResp struct {
Total int64 `json:"total"`
TotalInfo channelmod.ChannelStat `json:"totalInfo"`
List channelmod.ChannelStatList `json:"list"`
Income int64 `bson:"income" json:"income"` // 总收益
Desc string `bson:"desc" json:"desc"` // 描述
}
// 结算对话框搜索
type ChannelStatSettlementSearch struct {
Channel *string `json:"channel" binding:"required"` // 渠道
AppId *int32 `json:"appId" binding:"required"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
WithChild *bool `json:"withChild"` // 包含子渠道
UserName *string `json:"userName"` // 所有者
Settlement *channelmod.SettlementWay `json:"settlement"` // 结算方式 cps/cpa/cpt/cpc/hz
common.Page
}
type ChannelStatSettlementSearchResp struct {
Total int64 `json:"total"`
TotalInfo channelmod.ChannelStat `json:"totalInfo"`
List channelmod.ChannelStatList `json:"list"`
Income int64 `bson:"income" json:"income"` // 总收益
Desc string `bson:"desc" json:"desc"` // 描述
}
type ChannelStatSettlementSearch2 struct {
Channel *string `json:"channel" binding:"required"` // 渠道
AppId *int32 `json:"appId" binding:"required"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
IsPayed *bool `json:"isPayed"` // 结算状态 true:已结算或正在结算,false:未结算
UserName *string `json:"userName"` // 所有者
common.Page
}
type ChannelStatSettlementSearch2Resp struct {
Channel string `json:"channel"` // 渠道
AppId int32 `json:"appId"` // appId
TotalCount int64 `json:"totalCount"` // 总条数
TotalInfo channelmod.ChannelStat `json:"totalInfo"` // 按总条数合计的数据
TotalIncome int64 `json:"totalIncome"` // 总收益(列表的所有数据合计)
TotalDesc string `json:"totalDesc"` // 总收益描述
ValidCount int64 `json:"validCount"` // 有效条数
ValidInfo channelmod.ChannelStat `json:"validInfo"` // 按有效条数合计的数据
ValidIncome int64 `json:"validIncome"` // 有效收益(可结算的收益)
ValidDesc string `json:"validDesc"` // 有效收益描述
InvalidCount int64 `json:"invalidCount"` // 无效条数
InvalidInfo channelmod.ChannelStat `json:"invalidInfo"` // 按无效条数合计的数据
InvalidIncome int64 `json:"invalidIncome"` // 无效收益(不可结算的收益)
InvalidDesc string `json:"invalidDesc"` // 无效收益描述
List channelmod.ChannelStatList `json:"list"` // 全部记录
RuleId primitive.ObjectID `json:"ruleId"` // 扣量规则ID
Wallet channelmod.Wallet `json:"wallet"` // 钱包信息
}
// ChannelSettlementSearch 渠道结算(每15分钟)
type ChannelSettlementSearch struct {
Channel *string `json:"channel"` // 渠道
AppId *int32 `json:"appId"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
WithChild *bool `json:"withChild"` // 包含子渠道
common.Page
}
type ChannelSettlementSearchResp struct {
Total int64 `json:"total"`
List channelmod.ChannelSettlementList `json:"list"`
}
type UserInfoSearch struct {
UserId *int64 `json:"id"` // 用户ID
AppId *int32 `json:"appId"` // 渠道对应的appId
Channel *string `json:"channel"` // 渠道
IP *string `json:"ip"` // IP
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
common.Page
}
type UserInfoSearchResp struct {
Total int64 `json:"total"`
List []registermod.RegisterMod `json:"list"`
}
type GetSettlementApplicantListReq struct {
}
type GetSettlementApplicantListResp struct {
List []string `json:"list" bson:"list"`
}
type GetApplyFormReq struct {
AppId *int32 `json:"appId"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
common.Page
}
type ApplyFormRecord struct {
ID primitive.ObjectID `json:"id,omitempty"` // ID
Channel string `json:"channel"` // 渠道
AppId int32 `json:"appId"` // appId
BeginTime time.Time `json:"beginTime"` // 开始时间
EndTime time.Time `json:"endTime"` // 结束时间
TotalMoney int64 `json:"totalMoney"` // 计算出的总金额
SettleMoney int64 `json:"settleMoney"` // 手动输入的要结算的真实金额()
Settlement channelmod.SettlementWay `json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
Wallet channelmod.Wallet `json:"wallet"` // 钱包地址
PayMoney int64 `json:"payMoney"` // 打款金额
Usdt int64 `json:"usdt"` // 打款Usdt 还是分
Status channelsettlementrecord.SettlementStatus `json:"status"` // 状态
Remark string `json:"remark"` // 备注
Pictures []string `json:"pictures"` // 上传的图片
UpdatedAt time.Time `json:"updatedAt"` // 更新时间
CreatedAt time.Time `json:"createdAt"` // 创建时间
}
type ApplyFormRecordList []*ApplyFormRecord
type GetApplyFormResp struct {
Total int64 `json:"total"`
List ApplyFormRecordList `json:"list"`
}
type SettlementInfoSearch struct {
PayType *int8 `json:"payType"` // 支付类型,1ERC 2TRC 3銀行卡 4支付寶
Channel *string `json:"channel"` // 渠道
AppId *int32 `json:"appId"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
Remark *string `json:"remark"` // 备注
Status []channelsettlementrecord.SettlementStatus `json:"status"` // 状态数组
Applicants []string `json:"applicants"` // 申请人列表
common.Page
}
type SettlementInfoSearchResp struct {
Total int64 `json:"total"`
List channelsettlementrecord.ChannelSettlementRecordList `json:"list"`
}
type SettlementInfoUpdate struct {
ID primitive.ObjectID `json:"id" binding:"required"` // ID
PayMoney *int64 `json:"payMoney"` // 打款金额
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
Remark *string `json:"remark"` // 备注
Usdt *int64 `json:"usdt"` // 打款Usdt 还是分
}
type SettlementInfoUpdate2 struct {
ID primitive.ObjectID `json:"id" binding:"required"` // ID
Remark *string `json:"remark"` // 备注
Status *channelsettlementrecord.SettlementStatus `json:"status"` // 状态
// 财务(可修改)
PayMoney *int64 `json:"payMoney"` // 打款金额
Usdt *int64 `json:"usdt"` // 打款Usdt 还是分
SettleMoney *int64 `json:"settleMoney"` // 申请结算的金额
// 图片
Pictures []string `json:"pictures"` // 上传的图片
}
// SettlementInfoAdd 渠道结算信息
type SettlementInfoAdd struct {
AppId int32 `json:"appId" binding:"required"` // 应用ID
Channel string `json:"channel" binding:"required"` // 渠道
BeginTime time.Time `json:"beginTime" binding:"required"` // 开始时间
EndTime time.Time `json:"endTime" binding:"required"` // 结束时间
TotalMoney int64 `json:"totalMoney" binding:"required"` // 总金额
}
// SettlementInfoAdd2 渠道结算信息
type SettlementInfoAdd2 struct {
AppId int32 `json:"appId" binding:"required"` // 应用ID
Channel string `json:"channel" binding:"required"` // 渠道
TotalMoney int64 `json:"totalMoney"` // 总金额(提交的总金额,必须和按ids条数合计出来数据按ruleId扣量后一致)
SettleMoney int64 `json:"settleMoney" binding:"required"` // 手动输入的要结算的金额(为什么和TotalMoney不一致,因为可能已经预付过了)
RuleId primitive.ObjectID `json:"ruleId" binding:"required"` // 扣量RuleId
SettleIds []primitive.ObjectID `json:"settleIds" binding:"required"` // 要结算的天记录ID列表
BeginTime *time.Time `json:"beginTime"` // 开始时间
EndTime *time.Time `json:"endTime"` // 结束时间
Remark *string `json:"remark"` // 备注
WalletAddr1 *string `json:"walletAddr1"` // 钱包地址1
WalletAddr2 *string `json:"walletAddr2"` // 钱包地址2
}
type SettlementCalcReq struct {
AppId int32 `json:"appId" binding:"required"` // 应用ID
Channel string `json:"channel" binding:"required"` // 渠道
BeginTime *time.Time `json:"beginTime"` // 开始时间
EndTime *time.Time `json:"endTime"` // 结束时间
RuleId primitive.ObjectID `json:"ruleId" binding:"required"` // 扣量RuleId
SettleIds []primitive.ObjectID `json:"settleIds" binding:"required"` // 要结算的天记录ID列表
}
type SettlementCalcResp struct {
TotalCount int64 `json:"totalCount"` // 总条数
TotalInfo channelmod.ChannelStat `json:"totalInfo"` // 按总条数合计的数据
TotalIncome int64 `json:"totalIncome"` // 总收益(列表的所有数据合计)
TotalDesc string `json:"totalDesc"` // 总收益描述
}
type SettlementInfoDelete struct {
ID primitive.ObjectID `json:"id" binding:"required"` // ID
}
type SettlementInfoDetail struct {
ID primitive.ObjectID `json:"id" binding:"required"` // ID
common.Page
}
type SettlementInfoDetailResp struct {
Count int64 `json:"count"` // 总条数
List channelmod.ChannelStatList `json:"list"` // 全部记录
}
type SearchChannelStatComparedReq struct {
Channel *string `json:"channel"` // 渠道
AppId *int32 `json:"appId"` // appId
Start *time.Time `json:"start"` // 开始时间
End *time.Time `json:"end"` // 结束时间
WithChild *bool `json:"withChild"` // 包含子渠道
Settlement *channelmod.SettlementWay `bson:"settlement"` // 结算方式 cps/cpa/cpt/cpc
common.Page
}
type SearchChannelStatComparedResp struct {
Total int64 `json:"total"`
List channelmod.ChannelStatYestodayList `json:"list"`
}
// ChannelOwnerChangeInfoSearch 渠道所有者变更信息查询
type ChannelOwnerChangeInfoSearch struct {
ID *primitive.ObjectID `json:"id"` // ID
Channel *string `json:"channel"` // 渠道
OldUser *string `json:"oldUser"` // 变更前的所有者
NewUser *string `json:"newUser"` // 变更后的所有者
common.Page
}
type ChannelOwnerChangeInfoSearchResp struct {
Total int64 `json:"total"`
List channelmod.ChannelOwnerChangeList `json:"list"`
}