forked from all_user/stat_center
Initial commit
This commit is contained in:
@@ -0,0 +1,710 @@
|
||||
package channelmod
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"stat/common/log"
|
||||
"stat/common/mongos"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
var dbChannel *mongos.MongoTool
|
||||
var dbRule *mongos.MongoTool
|
||||
var dbStat *mongos.MongoTool
|
||||
var dbSettlement *mongos.MongoTool
|
||||
var dbChannelOwnerChange *mongos.MongoTool
|
||||
|
||||
var dbStatYestoday *mongos.MongoTool
|
||||
|
||||
func Init() {
|
||||
ctx := context.Background()
|
||||
InitChannel(ctx)
|
||||
InitStat(ctx)
|
||||
InitRule(ctx)
|
||||
InitSettlement(ctx)
|
||||
InitStatYestoday(ctx)
|
||||
InitChannelOwnerChange(ctx)
|
||||
}
|
||||
|
||||
func InitRule(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbRule = mongos.New(mongos.MgoManager, TN.ChannelDeductionRule)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelDeductionRule.Channel, Value: 1}, {Key: FN.ChannelDeductionRule.AppId, Value: 1}},
|
||||
Options: options.Index().SetUnique(true),
|
||||
},
|
||||
}
|
||||
if _, err := dbRule.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelDeductionRule, err))
|
||||
}
|
||||
}
|
||||
|
||||
func InitStat(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbStat = mongos.New(mongos.MgoManager, TN.ChannelStat)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStat.Channel, Value: 1}, {Key: FN.ChannelStat.AppId, Value: 1}, {Key: FN.ChannelStat.SumDate, Value: 1}},
|
||||
Options: options.Index().SetUnique(true),
|
||||
},
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStat.SumDate, Value: -1}, {Key: FN.ChannelStat.NewDirectCount, Value: -1}},
|
||||
},
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStat.CreatedAt, Value: -1}},
|
||||
},
|
||||
// {
|
||||
// Keys: bson.D{{Key: FN.ChannelStat.NewDirectCount, Value: -1}},
|
||||
// },
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelStat.Channel, Value: 1},
|
||||
{Key: FN.ChannelStat.ParentChannel, Value: 1},
|
||||
{Key: FN.ChannelStat.AppId, Value: 1},
|
||||
{Key: FN.ChannelStat.SumDate, Value: -1},
|
||||
{Key: FN.ChannelStat.Type, Value: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStat.Type, Value: 1}},
|
||||
},
|
||||
// {
|
||||
// Keys: bson.D{{Key: FN.ChannelStat.IsPay, Value: 1}},
|
||||
// },
|
||||
// {
|
||||
// Keys: bson.D{{Key: FN.ChannelStat.SumDate, Value: -1}},
|
||||
// },
|
||||
// {
|
||||
// Keys: bson.D{{Key: FN.ChannelStat.AppId, Value: 1}},
|
||||
// },
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelStat.AppId, Value: 1},
|
||||
{Key: FN.ChannelStat.SumDate, Value: -1},
|
||||
},
|
||||
},
|
||||
}
|
||||
if _, err := dbStat.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelStat, err))
|
||||
}
|
||||
}
|
||||
|
||||
func InitStatYestoday(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbStatYestoday = mongos.New(mongos.MgoManager, TN.ChannelStatYestoday)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStatYestoday.Channel, Value: 1}, {Key: FN.ChannelStatYestoday.AppId, Value: 1}, {Key: FN.ChannelStatYestoday.SumDate, Value: 1}},
|
||||
Options: options.Index().SetUnique(true),
|
||||
},
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelStatYestoday.SumDate, Value: -1}, {Key: FN.ChannelStatYestoday.NewCount, Value: -1}},
|
||||
},
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelStatYestoday.SumDate, Value: -1},
|
||||
},
|
||||
Options: options.Index().SetExpireAfterSeconds(3 * 24 * 60 * 60),
|
||||
},
|
||||
}
|
||||
if _, err := dbStatYestoday.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelStatYestoday, err))
|
||||
}
|
||||
}
|
||||
|
||||
func InitSettlement(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbSettlement = mongos.New(mongos.MgoManager, TN.ChannelSettlement)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelSettlement.Channel, Value: 1}, {Key: FN.ChannelSettlement.AppId, Value: 1}, {Key: FN.ChannelSettlement.SumDate, Value: 1}},
|
||||
Options: options.Index().SetUnique(true),
|
||||
},
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelSettlement.CreatedAt, Value: -1}},
|
||||
Options: options.Index().SetExpireAfterSeconds(5 * 24 * 60 * 60),
|
||||
},
|
||||
}
|
||||
if _, err := dbSettlement.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelSettlement, err))
|
||||
}
|
||||
}
|
||||
|
||||
func InitChannel(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbChannel = mongos.New(mongos.MgoManager, TN.ChannelInfo)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelInfo.Channel, Value: 1}},
|
||||
Options: options.Index().SetUnique(true),
|
||||
},
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelInfo.ParentAgent, Value: 1},
|
||||
},
|
||||
},
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelInfo.ParentChannel, Value: 1},
|
||||
},
|
||||
},
|
||||
}
|
||||
if _, err := dbChannel.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelInfo, err))
|
||||
}
|
||||
}
|
||||
|
||||
func InitChannelOwnerChange(ctx context.Context) {
|
||||
// 获取数据库表
|
||||
dbChannelOwnerChange = mongos.New(mongos.MgoManager, TN.ChannelOwnerChange)
|
||||
|
||||
// 初始化
|
||||
indexes := []mongo.IndexModel{
|
||||
{
|
||||
Keys: bson.D{{Key: FN.ChannelOwnerChange.Channel, Value: -1}},
|
||||
},
|
||||
{
|
||||
Keys: bson.D{
|
||||
{Key: FN.ChannelOwnerChange.NewUser, Value: -1},
|
||||
{Key: FN.ChannelOwnerChange.OldUser, Value: -1},
|
||||
},
|
||||
},
|
||||
}
|
||||
if _, err := dbChannelOwnerChange.CreateIndex(context.Background(), indexes); err != nil {
|
||||
panic(fmt.Sprintf("%s model set index err ==>[%+v]", TN.ChannelOwnerChange, err))
|
||||
}
|
||||
}
|
||||
|
||||
// InsertOneChannelInfo 插入一个渠道信息
|
||||
func InsertOneChannelInfo(ctx context.Context, media *ChannelInfo) error {
|
||||
if _, err := dbChannel.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelInfo db.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindOneChannelInfo 查找一个渠道信息
|
||||
func FindOneChannelInfo(ctx context.Context, filter bson.M) (*ChannelInfo, error) {
|
||||
var ChannelInfo ChannelInfo
|
||||
if err := dbChannel.FindOne(ctx, &ChannelInfo, filter); err != nil {
|
||||
log.Warn("ChannelInfo:FindOneChannelInfo dbChannel.FindOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelInfo, nil
|
||||
}
|
||||
|
||||
// FindOneChannelInfo 查找一个渠道信息
|
||||
func FindOneChannelInfoEx(ctx context.Context, filter bson.M) (*ChannelInfo, error) {
|
||||
var ChannelInfo ChannelInfo
|
||||
if err := dbChannel.FindOneEx(ctx, &ChannelInfo, filter); err != nil {
|
||||
log.Warn("ChannelInfo:FindOneChannelInfoEx dbChannel.FindOneEx failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelInfo, nil
|
||||
}
|
||||
|
||||
// DelOneChannelInfo 删除一个渠道信息
|
||||
func DelOneChannelInfo(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbChannel.DeleteOne(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelInfo:DelOneChannelInfo dbChannel.DeleteOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateOneChannelInfo 更新一个渠道信息
|
||||
func UpdateOneChannelInfo(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbChannel.UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateOneChannelInfo dbChannel.UpdateOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelInfos 统计渠道信息数量
|
||||
func CountChannelInfos(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbChannel.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelInfo:CountChannelInfos dbChannel.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelInfo 更新满足条件的渠道信息
|
||||
func UpdateManyChannelInfo(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbChannel.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelInfo dbChannel.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelInfo 查找一批渠道信息数据
|
||||
func FindManyChannelInfo(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelInfoList, error) {
|
||||
data := make(ChannelInfoList, 0)
|
||||
if err := dbChannel.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelInfo:FindManyChannelInfo dbChannel.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// FindManyChannelInfoWithBind 用自己定义结构查找一批渠道信息数据
|
||||
func FindManyChannelInfoWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
|
||||
if err := dbChannel.Find(ctx, bind, filter, opts...); err != nil {
|
||||
log.Warn("ChannelInfo:FindManyChannelInfoWithBind dbChannel.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertOneChannelDeductionRule 插入一个渠道扣量规则
|
||||
func InsertOneChannelDeductionRule(ctx context.Context, media *ChannelDeductionRule) error {
|
||||
if _, err := dbRule.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelDeductionRule db.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindOneChannelDeductionRule 查找一个渠道扣量规则
|
||||
func FindOneChannelDeductionRule(ctx context.Context, filter bson.M) (*ChannelDeductionRule, error) {
|
||||
var ChannelDeductionRule ChannelDeductionRule
|
||||
if err := dbRule.FindOne(ctx, &ChannelDeductionRule, filter); err != nil {
|
||||
log.Warn("ChannelDeductionRule:FindOneChannelDeductionRule dbChannel.FindOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelDeductionRule, nil
|
||||
}
|
||||
|
||||
// FindOneChannelDeductionRuleEx 查找一个渠道扣量规则
|
||||
func FindOneChannelDeductionRuleEx(ctx context.Context, filter bson.M) (*ChannelDeductionRule, error) {
|
||||
var ChannelDeductionRule ChannelDeductionRule
|
||||
if err := dbRule.FindOneEx(ctx, &ChannelDeductionRule, filter); err != nil {
|
||||
log.Warn("ChannelDeductionRule:FindOneChannelDeductionRuleEx dbChannel.FindOneEx failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelDeductionRule, nil
|
||||
}
|
||||
|
||||
// DelOneChannelDeductionRule 删除一个渠道扣量规则
|
||||
func DelOneChannelDeductionRule(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbRule.DeleteOne(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelDeductionRule:DelOneChannelDeductionRule dbChannel.DeleteOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateOneChannelDeductionRule 更新一个渠道扣量规则
|
||||
func UpdateOneChannelDeductionRule(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbRule.UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("UpdateOneChannelDeductionRule dbChannel.UpdateOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelDeductionRules 统计渠道扣量规则数量
|
||||
func CountChannelDeductionRules(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbRule.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelDeductionRule:CountChannelDeductionRules dbChannel.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelDeductionRule 更新满足条件的渠道扣量规则
|
||||
func UpdateManyChannelDeductionRule(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbRule.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelDeductionRule dbChannel.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelDeductionRule 查找一批渠道扣量规则数据
|
||||
func FindManyChannelDeductionRule(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelDeductionRuleList, error) {
|
||||
data := make(ChannelDeductionRuleList, 0)
|
||||
if err := dbRule.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelDeductionRule:FindManyChannelDeductionRule dbChannel.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// FindManyChannelDeductionRuleWithBind 用自己定义结构查找一批渠道扣量规则数据
|
||||
func FindManyChannelDeductionRuleWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
|
||||
if err := dbRule.Find(ctx, bind, filter, opts...); err != nil {
|
||||
log.Warn("ChannelDeductionRule:FindManyChannelDeductionRuleWithBind dbChannel.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertOneChannelStat 插入一个渠道统计信息
|
||||
func InsertOneChannelStat(ctx context.Context, media *ChannelStat) error {
|
||||
if _, err := dbStat.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelStat db.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindOneChannelStat 查找一个渠道日常统计
|
||||
func FindOneChannelStat(ctx context.Context, filter bson.M) (*ChannelStat, error) {
|
||||
var ChannelStat ChannelStat
|
||||
if err := dbStat.FindOne(ctx, &ChannelStat, filter); err != nil {
|
||||
log.Warn("ChannelStat:FindOneChannelStat dbStat.FindOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelStat, nil
|
||||
}
|
||||
|
||||
// DelOneChannelStat 删除一个渠道日常统计
|
||||
func DelOneChannelStat(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbStat.DeleteOne(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelStat:DelOneChannelStat dbStat.DeleteOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateOneChannelStat 更新一个渠道日常统计
|
||||
func UpdateOneChannelStat(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbStat.UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("UpdateOneChannelStat dbStat.UpdateOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelStats 统计渠道日常统计数量
|
||||
func CountChannelStats(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbStat.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelStat:CountChannelStats dbStat.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelStat 更新满足条件的渠道日常统计
|
||||
func UpdateManyChannelStat(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbStat.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelStat dbStat.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelStat 更新满足条件的渠道日常统计
|
||||
func UpdateManyChannelStatWithResult(ctx context.Context, filter bson.M, update bson.M) (int64, error) {
|
||||
result, err := dbStat.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelStatWithResult dbStat.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return result.MatchedCount, nil
|
||||
}
|
||||
|
||||
// FindManyChannelStat 查找一批渠道日常统计数据
|
||||
func FindManyChannelStat(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelStatList, error) {
|
||||
data := make(ChannelStatList, 0)
|
||||
if err := dbStat.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelStat:FindManyChannelStat dbStat.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
type OnItem func(item *ChannelStat)
|
||||
|
||||
// FindManyChannelStatShard 查找一批渠道日常统计数据
|
||||
func FindManyChannelStatShard(ctx context.Context, filter bson.M, shard int64, onItem OnItem) error {
|
||||
num := int64(0)
|
||||
for {
|
||||
opt := &options.FindOptions{}
|
||||
opt.SetSkip(num * shard)
|
||||
opt.SetLimit(shard)
|
||||
lst := make(ChannelStatList, 0)
|
||||
if err := dbStat.Find(ctx, &lst, filter, opt); err != nil {
|
||||
log.Warn("ChannelStat:FindManyChannelStatShard dbStat.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
for _, item := range lst {
|
||||
onItem(item)
|
||||
}
|
||||
if int64(len(lst)) < shard {
|
||||
break
|
||||
}
|
||||
lst = nil
|
||||
num++
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelStatWithBind 用自己定义结构查找一批渠道日常统计数据
|
||||
func FindManyChannelStatWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
|
||||
if err := dbStat.Find(ctx, bind, filter, opts...); err != nil {
|
||||
log.Warn("ChannelStat:FindManyChannelStatWithBind dbStat.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertOneChannelSettlement 插入一个渠道统计信息
|
||||
func InsertOneChannelSettlement(ctx context.Context, media *ChannelSettlement) error {
|
||||
if _, err := dbSettlement.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelSettlement dbSettlement.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindOneChannelSettlement 查找一个15分钟结算
|
||||
func FindOneChannelSettlement(ctx context.Context, filter bson.M) (*ChannelSettlement, error) {
|
||||
var ChannelSettlement ChannelSettlement
|
||||
if err := dbSettlement.FindOne(ctx, &ChannelSettlement, filter); err != nil {
|
||||
log.Warn("ChannelSettlement:FindOneChannelSettlement dbSettlement.FindOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelSettlement, nil
|
||||
}
|
||||
|
||||
// DelOneChannelSettlement 删除一个15分钟结算
|
||||
func DelOneChannelSettlement(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbSettlement.DeleteOne(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelSettlement:DelOneChannelSettlement dbSettlement.DeleteOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateOneChannelSettlement 更新一个15分钟结算
|
||||
func UpdateOneChannelSettlement(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbSettlement.UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("UpdateOneChannelSettlement dbSettlement.UpdateOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelSettlements 统计15分钟结算数量
|
||||
func CountChannelSettlements(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbSettlement.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelSettlement:CountChannelSettlements dbSettlement.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelSettlement 更新满足条件的15分钟结算
|
||||
func UpdateManyChannelSettlement(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbSettlement.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelSettlement dbSettlement.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelSettlement 查找一批渠道15分钟结算
|
||||
func FindManyChannelSettlement(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelSettlementList, error) {
|
||||
data := make(ChannelSettlementList, 0)
|
||||
if err := dbSettlement.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelSettlement:FindManyChannelSettlement dbSettlement.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// FindManyChannelSettlementWithBind 用自己定义结构查找一批渠道15分钟结算
|
||||
func FindManyChannelSettlementWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
|
||||
if err := dbSettlement.Find(ctx, bind, filter, opts...); err != nil {
|
||||
log.Warn("ChannelSettlement:FindManyChannelSettlementWithBind dbSettlement.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelStatYestoday 查找一批渠道日常统计数据
|
||||
func FindManyChannelStatYestoday(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelStatYestodayList, error) {
|
||||
data := make(ChannelStatYestodayList, 0)
|
||||
if err := dbStatYestoday.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelStat:FindManyChannelStat dbStat.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// InsertOneChannelStatYestoday 插入一个渠道统计信息
|
||||
func InsertOneChannelStatYestoday(ctx context.Context, media *ChannelStatYesterday) error {
|
||||
if _, err := dbStatYestoday.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelStat db.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelStatYestoday 统计渠道扣量规则数量
|
||||
func CountChannelStatYestoday(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbStatYestoday.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelDeductionRule:CountChannelStatYestoday dbChannel.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// InsertOneChannelOwnerChange 插入一个渠道信息
|
||||
func InsertOneChannelOwnerChange(ctx context.Context, media *ChannelOwnerChange) error {
|
||||
if _, err := dbChannelOwnerChange.InsertOne(ctx, media); err != nil {
|
||||
log.Warn("media:InsertOneChannelOwnerChange db.InsertOne failed", log.E(err))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindOneChannelOwnerChange 查找一个渠道信息
|
||||
func FindOneChannelOwnerChange(ctx context.Context, filter bson.M) (*ChannelOwnerChange, error) {
|
||||
var ChannelOwnerChange ChannelOwnerChange
|
||||
if err := dbChannelOwnerChange.FindOne(ctx, &ChannelOwnerChange, filter); err != nil {
|
||||
log.Warn("ChannelOwnerChange:FindOneChannelOwnerChange dbChannelOwnerChange.FindOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelOwnerChange, nil
|
||||
}
|
||||
|
||||
// FindOneChannelOwnerChange 查找一个渠道信息
|
||||
func FindOneChannelOwnerChangeEx(ctx context.Context, filter bson.M) (*ChannelOwnerChange, error) {
|
||||
var ChannelOwnerChange ChannelOwnerChange
|
||||
if err := dbChannelOwnerChange.FindOneEx(ctx, &ChannelOwnerChange, filter); err != nil {
|
||||
log.Warn("ChannelOwnerChange:FindOneChannelOwnerChangeEx dbChannelOwnerChange.FindOneEx failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return &ChannelOwnerChange, nil
|
||||
}
|
||||
|
||||
// DelOneChannelOwnerChange 删除一个渠道信息
|
||||
func DelOneChannelOwnerChange(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbChannelOwnerChange.DeleteOne(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelOwnerChange:DelOneChannelOwnerChange dbChannelOwnerChange.DeleteOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateOneChannelOwnerChange 更新一个渠道信息
|
||||
func UpdateOneChannelOwnerChange(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbChannelOwnerChange.UpdateOne(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateOneChannelOwnerChange dbChannelOwnerChange.UpdateOne failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// CountChannelOwnerChanges 统计渠道信息数量
|
||||
func CountChannelOwnerChanges(ctx context.Context, filter bson.M) (int64, error) {
|
||||
count, err := dbChannelOwnerChange.Count(ctx, filter)
|
||||
if err != nil {
|
||||
log.Warn("ChannelOwnerChange:CountChannelOwnerChanges dbChannelOwnerChange.Count failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return 0, err
|
||||
}
|
||||
return count, nil
|
||||
}
|
||||
|
||||
// UpdateManyChannelOwnerChange 更新满足条件的渠道信息
|
||||
func UpdateManyChannelOwnerChange(ctx context.Context, filter bson.M, update bson.M) error {
|
||||
_, err := dbChannelOwnerChange.UpdateMany(ctx, filter, update)
|
||||
if err != nil {
|
||||
log.Warn("user:UpdateManyChannelOwnerChange dbChannelOwnerChange.UpdateMany failed",
|
||||
log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// FindManyChannelOwnerChanges 查找一批渠道信息数据
|
||||
func FindManyChannelOwnerChanges(ctx context.Context, filter bson.M, opts ...*options.FindOptions) (ChannelOwnerChangeList, error) {
|
||||
data := make(ChannelOwnerChangeList, 0)
|
||||
if err := dbChannelOwnerChange.Find(ctx, &data, filter, opts...); err != nil {
|
||||
log.Warn("ChannelOwnerChange:FindManyChannelOwnerChange dbChannelOwnerChange.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return nil, err
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
// FindManyChannelOwnerChangeWithBind 用自己定义结构查找一批渠道信息数据
|
||||
func FindManyChannelOwnerChangeWithBind(ctx context.Context, bind interface{}, filter bson.M, opts ...*options.FindOptions) error {
|
||||
if err := dbChannelOwnerChange.Find(ctx, bind, filter, opts...); err != nil {
|
||||
log.Warn("ChannelOwnerChange:FindManyChannelOwnerChangeWithBind dbChannelOwnerChange.Find failed", log.E(err), log.Any("filter", filter))
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,810 @@
|
||||
package channelmod
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type CalcIncomeRateMode int
|
||||
|
||||
const (
|
||||
CalcIncomeRateModeDirect CalcIncomeRateMode = 0 // 直推模式:直推总额
|
||||
CalcIncomeRateModeTotal CalcIncomeRateMode = 1 // 总量模式:充值总额
|
||||
CalcIncomeRateModeMember CalcIncomeRateMode = 2 // 会员模式:会员总额
|
||||
CalcIncomeRateModeCustom CalcIncomeRateMode = 3 // 定制模式:会员总额+(金币总额*占比)
|
||||
)
|
||||
|
||||
type CalcIncomeRateConfig struct {
|
||||
Mode CalcIncomeRateMode // 计算模式
|
||||
CoinRatio float64 // 金币占比(最小为0,最大为1)
|
||||
}
|
||||
|
||||
var configDefault = &CalcIncomeRateConfig{
|
||||
Mode: CalcIncomeRateModeMember, // 默认收益率计算模式
|
||||
CoinRatio: 0,
|
||||
}
|
||||
|
||||
var configXcb = &CalcIncomeRateConfig{
|
||||
Mode: CalcIncomeRateModeTotal, // 总充值
|
||||
CoinRatio: 0,
|
||||
}
|
||||
|
||||
func getConfig(appId int32) *CalcIncomeRateConfig {
|
||||
if appId == 6666 {
|
||||
return configXcb
|
||||
} else {
|
||||
return configDefault
|
||||
}
|
||||
}
|
||||
|
||||
// GetIncome 收益率计算公式
|
||||
func (c *CalcIncomeRateConfig) GetIncome(stat *ChannelStat) int64 {
|
||||
switch c.Mode {
|
||||
case CalcIncomeRateModeDirect:
|
||||
return stat.DirectAmount
|
||||
case CalcIncomeRateModeTotal:
|
||||
return stat.TotalAmount
|
||||
case CalcIncomeRateModeMember:
|
||||
return stat.VipPayMoney + stat.VipPayDeduction
|
||||
case CalcIncomeRateModeCustom:
|
||||
rate := c.CoinRatio
|
||||
if rate > 1 {
|
||||
rate = 1
|
||||
}
|
||||
if rate < 0 {
|
||||
rate = 0
|
||||
}
|
||||
return (stat.VipPayMoney + stat.VipPayDeduction) + int64(float64(stat.VipPayCoin)*rate)
|
||||
default:
|
||||
return stat.VipPayMoney + stat.VipPayDeduction
|
||||
}
|
||||
}
|
||||
|
||||
func (t ChannelType) String() string {
|
||||
switch t {
|
||||
case ChannelTypeNone, ChannelTypeEnd:
|
||||
return "无效"
|
||||
case ChannelTypeParent:
|
||||
return "一级"
|
||||
case ChannelTypeSecond:
|
||||
return "二级"
|
||||
case ChannelTypeThird:
|
||||
return "三级"
|
||||
case ChannelTypeForth:
|
||||
return "四级"
|
||||
default:
|
||||
if t > ChannelTypeNone && t < ChannelTypeEnd {
|
||||
return fmt.Sprintf("【%d】级", t)
|
||||
}
|
||||
return "无效"
|
||||
}
|
||||
}
|
||||
|
||||
func (t ChannelType) IsTop() bool {
|
||||
if t == ChannelTypeParent {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t ChannelType) IsSecond() bool {
|
||||
if t == ChannelTypeSecond {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t ChannelType) IsChild() bool {
|
||||
if t > ChannelTypeParent && t < ChannelTypeEnd {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t ChannelType) Child() ChannelType {
|
||||
if t > ChannelTypeNone && t < ChannelTypeEnd {
|
||||
return t + 1
|
||||
} else {
|
||||
return ChannelTypeEnd
|
||||
}
|
||||
}
|
||||
|
||||
func (t ChannelType) Parent() ChannelType {
|
||||
if t > ChannelTypeNone && t < ChannelTypeEnd {
|
||||
return t - 1
|
||||
} else {
|
||||
return ChannelTypeNone
|
||||
}
|
||||
}
|
||||
|
||||
func (t ChannelType) IsValid() bool {
|
||||
if t > ChannelTypeNone && t < ChannelTypeEnd {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func (t ChannelType) IsNone() bool {
|
||||
if t > ChannelTypeNone && t < ChannelTypeEnd {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
func (a ChannelStatList) Len() int { return len(a) }
|
||||
func (a ChannelStatList) Less(i, j int) bool { return a[i].SumDate.After(a[j].SumDate) }
|
||||
func (a ChannelStatList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
|
||||
func (s *ChannelSettlement) AssignmentTo(d *ChannelStat) {
|
||||
d.ValidDirectCount = s.ValidDirectCount
|
||||
d.ValidDeductionCount = s.ValidDeductionCount
|
||||
d.ValidPayMoney = s.ValidPayMoney
|
||||
d.ValidPayCoin = s.ValidPayCoin
|
||||
|
||||
d.NewTotalIpCount = s.NewTotalIpCount
|
||||
d.NewTotalCount = s.NewTotalCount
|
||||
d.NewDirectCount = s.NewDirectCount
|
||||
d.NewFissionCount = s.NewFissionCount
|
||||
d.NewDeductionCount = s.NewDeductionCount
|
||||
|
||||
d.NewAndroidCount = s.NewAndroidCount
|
||||
d.NewAndroidDirectCount = s.NewAndroidDirectCount
|
||||
d.NewAndroidFissionCount = s.NewAndroidFissionCount
|
||||
d.NewAndroidDeductionCount = s.NewAndroidDeductionCount
|
||||
|
||||
d.NewIosCount = s.NewIosCount
|
||||
d.NewIosDirectCount = s.NewIosDirectCount
|
||||
d.NewIosFissionCount = s.NewIosFissionCount
|
||||
d.NewIosDeductionCount = s.NewIosDeductionCount
|
||||
|
||||
d.NewLightCount = s.NewLightCount
|
||||
d.NewLightGuestCount = s.NewLightGuestCount
|
||||
d.NewLightGuestDirectCount = s.NewLightGuestDirectCount
|
||||
d.NewLightGuestFissionCount = s.NewLightGuestFissionCount
|
||||
d.NewLightGuestDeductionCount = s.NewLightGuestDeductionCount
|
||||
|
||||
d.NewLightFormalCount = s.NewLightFormalCount
|
||||
d.NewLightFormalDirectCount = s.NewLightFormalDirectCount
|
||||
d.NewLightFormalFissionCount = s.NewLightFormalFissionCount
|
||||
d.NewLightFormalDeductionCount = s.NewLightFormalDeductionCount
|
||||
|
||||
d.NewLightDirectCount = s.NewLightDirectCount
|
||||
d.NewLightFissionCount = s.NewLightFissionCount
|
||||
d.NewLightDeductionCount = s.NewLightDeductionCount
|
||||
d.NewLightNaturalCount = s.NewLightNaturalCount
|
||||
d.NewH5Count = s.NewH5Count
|
||||
d.NewH5DirectCount = s.NewH5DirectCount
|
||||
d.NewH5FissionCount = s.NewH5FissionCount
|
||||
d.NewH5DeductionCount = s.NewH5DeductionCount
|
||||
|
||||
d.NewH5AndroidCount = s.NewH5AndroidCount
|
||||
d.NewH5IosCount = s.NewH5IosCount
|
||||
d.NewH5PcCount = s.NewH5PcCount
|
||||
d.NewH5FormalCount = s.NewH5FormalCount
|
||||
d.NewH5FormalDirectCount = s.NewH5FormalDirectCount
|
||||
d.NewH5FormalFissionCount = s.NewH5FormalFissionCount
|
||||
d.NewH5FormalDeductionCount = s.NewH5FormalDeductionCount
|
||||
// 访问
|
||||
d.TotalVisitCount = s.TotalVisitCount
|
||||
d.DirectVisitCount = s.DirectVisitCount
|
||||
d.FissionVisitCount = s.FissionVisitCount
|
||||
d.AndroidVisitCount = s.AndroidVisitCount
|
||||
d.IosVisitCount = s.IosVisitCount
|
||||
d.LightVisitCount = s.LightVisitCount
|
||||
d.LightVisitDirectCount = s.LightVisitDirectCount
|
||||
d.LightVisitFissionCount = s.LightVisitFissionCount
|
||||
d.LightVisitDeductionCount = s.LightVisitDeductionCount
|
||||
d.LightVisitNaturalCount = s.LightVisitNaturalCount
|
||||
d.H5VisitCount = s.H5VisitCount
|
||||
d.H5AndroidVisitCount = s.H5AndroidVisitCount
|
||||
d.H5IosVisitCount = s.H5IosVisitCount
|
||||
d.H5PcVisitCount = s.H5PcVisitCount
|
||||
// 充值
|
||||
d.TotalAmount = s.TotalAmount
|
||||
d.DirectAmount = s.DirectAmount
|
||||
d.DirectAmountCount = s.DirectAmountCount
|
||||
d.FissionAmount = s.FissionAmount
|
||||
d.FissionAmountCount = s.FissionAmountCount
|
||||
d.NaturalAmount = s.NaturalAmount
|
||||
d.NaturalAmountCount = s.NaturalAmountCount
|
||||
d.DeductionAmount = s.DeductionAmount
|
||||
d.DeductionAmountCount = s.DeductionAmountCount
|
||||
d.AndroidAmount = s.AndroidAmount
|
||||
d.AndroidAmountCount = s.AndroidAmountCount
|
||||
d.IosAmount = s.IosAmount
|
||||
d.IosAmountCount = s.IosAmountCount
|
||||
d.H5Amount = s.H5Amount
|
||||
d.H5AmountCount = s.H5AmountCount
|
||||
d.LightAmount = s.LightAmount
|
||||
d.LightAmountCount = s.LightAmountCount
|
||||
d.LightDirectAmount = s.LightDirectAmount
|
||||
d.LightDirectAmountCount = s.LightDirectAmountCount
|
||||
d.LightFissionAmount = s.LightFissionAmount
|
||||
d.LightFissionAmountCount = s.LightFissionAmountCount
|
||||
d.LightDeductionAmount = s.LightDeductionAmount
|
||||
d.LightDeductionAmountCount = s.LightDeductionAmountCount
|
||||
d.LightNaturalAmount = s.LightNaturalAmount
|
||||
d.LightNaturalAmountCount = s.LightNaturalAmountCount
|
||||
// 其他充值
|
||||
d.NewRechargeAmount = s.NewRechargeAmount
|
||||
d.VipPayMoney = s.VipPayMoney
|
||||
d.VipPayCoin = s.VipPayCoin
|
||||
d.VipPayDeduction = s.VipPayDeduction
|
||||
d.GameRechageAmount = s.GameRechageAmount
|
||||
d.GameWithdrawAmount = s.GameWithdrawAmount
|
||||
// 落地页访问
|
||||
d.LandPageVisitCount = s.LandPageVisitCount
|
||||
d.LandpageAndroidClick = s.LandpageAndroidClick
|
||||
d.LandpageIosAppstoreClick = s.LandpageIosAppstoreClick
|
||||
d.LandpageIosAthorClick = s.LandpageIosAthorClick
|
||||
d.LandpageIosH5Click = s.LandpageIosH5Click
|
||||
}
|
||||
|
||||
func (s *ChannelSettlement) AccumulateTo(d *ChannelStat) {
|
||||
d.ValidDirectCount += s.ValidDirectCount
|
||||
d.ValidDeductionCount += s.ValidDeductionCount
|
||||
d.ValidPayMoney += s.ValidPayMoney
|
||||
d.ValidPayCoin += s.ValidPayCoin
|
||||
|
||||
d.NewTotalIpCount += s.NewTotalIpCount
|
||||
d.NewTotalCount += s.NewTotalCount
|
||||
d.NewDirectCount += s.NewDirectCount
|
||||
d.NewFissionCount += s.NewFissionCount
|
||||
d.NewDeductionCount += s.NewDeductionCount
|
||||
d.NewAndroidCount += s.NewAndroidCount
|
||||
|
||||
d.NewAndroidDirectCount += s.NewAndroidDirectCount
|
||||
d.NewAndroidFissionCount += s.NewAndroidFissionCount
|
||||
d.NewAndroidDeductionCount += s.NewAndroidDeductionCount
|
||||
|
||||
d.NewIosCount += s.NewIosCount
|
||||
d.NewIosDirectCount += s.NewIosDirectCount
|
||||
d.NewIosFissionCount += s.NewIosFissionCount
|
||||
d.NewIosDeductionCount += s.NewIosDeductionCount
|
||||
|
||||
d.NewLightCount += s.NewLightCount
|
||||
d.NewLightGuestCount += s.NewLightGuestCount
|
||||
d.NewLightGuestDirectCount += s.NewLightGuestDirectCount
|
||||
d.NewLightGuestFissionCount += s.NewLightGuestFissionCount
|
||||
d.NewLightGuestDeductionCount += s.NewLightGuestDeductionCount
|
||||
|
||||
d.NewLightFormalCount += s.NewLightFormalCount
|
||||
d.NewLightFormalDirectCount += s.NewLightFormalDirectCount
|
||||
d.NewLightFormalFissionCount += s.NewLightFormalFissionCount
|
||||
d.NewLightFormalDeductionCount += s.NewLightFormalDeductionCount
|
||||
|
||||
d.NewLightDirectCount += s.NewLightDirectCount
|
||||
d.NewLightFissionCount += s.NewLightFissionCount
|
||||
d.NewLightDeductionCount += s.NewLightDeductionCount
|
||||
d.NewLightNaturalCount += s.NewLightNaturalCount
|
||||
d.NewH5Count += s.NewH5Count
|
||||
|
||||
d.NewH5DirectCount += s.NewH5DirectCount
|
||||
d.NewH5FissionCount += s.NewH5FissionCount
|
||||
d.NewH5DeductionCount += s.NewH5DeductionCount
|
||||
|
||||
d.NewH5AndroidCount += s.NewH5AndroidCount
|
||||
d.NewH5IosCount += s.NewH5IosCount
|
||||
d.NewH5PcCount += s.NewH5PcCount
|
||||
d.NewH5FormalCount += s.NewH5FormalCount
|
||||
d.NewH5FormalDirectCount += s.NewH5FormalDirectCount
|
||||
d.NewH5FormalFissionCount += s.NewH5FormalFissionCount
|
||||
d.NewH5FormalDeductionCount += s.NewH5FormalDeductionCount
|
||||
// 访问
|
||||
d.TotalVisitCount += s.TotalVisitCount
|
||||
d.DirectVisitCount += s.DirectVisitCount
|
||||
d.FissionVisitCount += s.FissionVisitCount
|
||||
d.AndroidVisitCount += s.AndroidVisitCount
|
||||
d.IosVisitCount += s.IosVisitCount
|
||||
d.LightVisitCount += s.LightVisitCount
|
||||
d.LightVisitDirectCount += s.LightVisitDirectCount
|
||||
d.LightVisitFissionCount += s.LightVisitFissionCount
|
||||
d.LightVisitDeductionCount += s.LightVisitDeductionCount
|
||||
d.LightVisitNaturalCount += s.LightVisitNaturalCount
|
||||
d.H5VisitCount += s.H5VisitCount
|
||||
d.H5AndroidVisitCount += s.H5AndroidVisitCount
|
||||
d.H5IosVisitCount += s.H5IosVisitCount
|
||||
d.H5PcVisitCount += s.H5PcVisitCount
|
||||
// 充值
|
||||
d.TotalAmount += s.TotalAmount
|
||||
d.DirectAmount += s.DirectAmount
|
||||
d.DirectAmountCount += s.DirectAmountCount
|
||||
d.FissionAmount += s.FissionAmount
|
||||
d.FissionAmountCount += s.FissionAmountCount
|
||||
d.NaturalAmount += s.NaturalAmount
|
||||
d.NaturalAmountCount += s.NaturalAmountCount
|
||||
d.DeductionAmount += s.DeductionAmount
|
||||
d.DeductionAmountCount += s.DeductionAmountCount
|
||||
d.AndroidAmount += s.AndroidAmount
|
||||
d.AndroidAmountCount += s.AndroidAmountCount
|
||||
d.IosAmount += s.IosAmount
|
||||
d.IosAmountCount += s.IosAmountCount
|
||||
|
||||
d.H5Amount += s.H5Amount
|
||||
d.H5AmountCount += s.H5AmountCount
|
||||
d.LightAmount += s.LightAmount
|
||||
d.LightAmountCount += s.LightAmountCount
|
||||
d.LightDirectAmount += s.LightDirectAmount
|
||||
d.LightDirectAmountCount += s.LightDirectAmountCount
|
||||
d.LightFissionAmount += s.LightFissionAmount
|
||||
d.LightFissionAmountCount += s.LightFissionAmountCount
|
||||
d.LightDeductionAmount += s.LightDeductionAmount
|
||||
d.LightDeductionAmountCount += s.LightDeductionAmountCount
|
||||
d.LightNaturalAmount += s.LightNaturalAmount
|
||||
d.LightNaturalAmountCount += s.LightNaturalAmountCount
|
||||
// 其他充值
|
||||
d.NewRechargeAmount += s.NewRechargeAmount
|
||||
d.VipPayMoney += s.VipPayMoney
|
||||
d.VipPayCoin += s.VipPayCoin
|
||||
d.VipPayDeduction += s.VipPayDeduction
|
||||
d.GameRechageAmount += s.GameRechageAmount
|
||||
d.GameWithdrawAmount += s.GameWithdrawAmount
|
||||
// 落地页访问
|
||||
d.LandPageVisitCount += s.LandPageVisitCount
|
||||
d.LandpageAndroidClick += s.LandpageAndroidClick
|
||||
d.LandpageIosAppstoreClick += s.LandpageIosAppstoreClick
|
||||
d.LandpageIosAthorClick += s.LandpageIosAthorClick
|
||||
d.LandpageIosH5Click += s.LandpageIosH5Click
|
||||
}
|
||||
|
||||
func (s *ChannelStat) AssignmentTo(d *ChannelSettlement) {
|
||||
d.ValidDirectCount = s.ValidDirectCount
|
||||
d.ValidDeductionCount = s.ValidDeductionCount
|
||||
d.ValidPayMoney = s.ValidPayMoney
|
||||
d.ValidPayCoin = s.ValidPayCoin
|
||||
|
||||
d.NewTotalIpCount = s.NewTotalIpCount
|
||||
d.NewTotalCount = s.NewTotalCount
|
||||
d.NewDirectCount = s.NewDirectCount
|
||||
d.NewFissionCount = s.NewFissionCount
|
||||
d.NewDeductionCount = s.NewDeductionCount
|
||||
d.NewAndroidCount = s.NewAndroidCount
|
||||
d.NewAndroidDirectCount = s.NewAndroidDirectCount
|
||||
d.NewAndroidFissionCount = s.NewAndroidFissionCount
|
||||
d.NewAndroidDeductionCount = s.NewAndroidDeductionCount
|
||||
|
||||
d.NewIosCount = s.NewIosCount
|
||||
d.NewIosDirectCount = s.NewIosDirectCount
|
||||
d.NewIosFissionCount = s.NewIosFissionCount
|
||||
d.NewIosDeductionCount = s.NewIosDeductionCount
|
||||
|
||||
d.NewLightCount = s.NewLightCount
|
||||
d.NewLightGuestCount = s.NewLightGuestCount
|
||||
d.NewLightGuestDirectCount = s.NewLightGuestDirectCount
|
||||
d.NewLightGuestFissionCount = s.NewLightGuestFissionCount
|
||||
d.NewLightGuestDeductionCount = s.NewLightGuestDeductionCount
|
||||
|
||||
d.NewLightFormalCount = s.NewLightFormalCount
|
||||
d.NewLightFormalDirectCount = s.NewLightFormalDirectCount
|
||||
d.NewLightFormalFissionCount = s.NewLightFormalFissionCount
|
||||
d.NewLightFormalDeductionCount = s.NewLightFormalDeductionCount
|
||||
|
||||
d.NewLightDirectCount = s.NewLightDirectCount
|
||||
d.NewLightFissionCount = s.NewLightFissionCount
|
||||
d.NewLightDeductionCount = s.NewLightDeductionCount
|
||||
d.NewLightNaturalCount = s.NewLightNaturalCount
|
||||
d.NewH5Count = s.NewH5Count
|
||||
d.NewH5DirectCount = s.NewH5DirectCount
|
||||
d.NewH5FissionCount = s.NewH5FissionCount
|
||||
d.NewH5DeductionCount = s.NewH5DeductionCount
|
||||
|
||||
d.NewH5AndroidCount = s.NewH5AndroidCount
|
||||
d.NewH5IosCount = s.NewH5IosCount
|
||||
d.NewH5PcCount = s.NewH5PcCount
|
||||
d.NewH5FormalCount = s.NewH5FormalCount
|
||||
d.NewH5FormalDirectCount = s.NewH5FormalDirectCount
|
||||
d.NewH5FormalFissionCount = s.NewH5FormalFissionCount
|
||||
d.NewH5FormalDeductionCount = s.NewH5FormalDeductionCount
|
||||
// 访问
|
||||
d.TotalVisitCount = s.TotalVisitCount
|
||||
d.DirectVisitCount = s.DirectVisitCount
|
||||
d.FissionVisitCount = s.FissionVisitCount
|
||||
d.AndroidVisitCount = s.AndroidVisitCount
|
||||
d.IosVisitCount = s.IosVisitCount
|
||||
d.LightVisitCount = s.LightVisitCount
|
||||
d.LightVisitDirectCount = s.LightVisitDirectCount
|
||||
d.LightVisitFissionCount = s.LightVisitFissionCount
|
||||
d.LightVisitDeductionCount = s.LightVisitDeductionCount
|
||||
d.LightVisitNaturalCount = s.LightVisitNaturalCount
|
||||
d.H5VisitCount = s.H5VisitCount
|
||||
d.H5AndroidVisitCount = s.H5AndroidVisitCount
|
||||
d.H5IosVisitCount = s.H5IosVisitCount
|
||||
d.H5PcVisitCount = s.H5PcVisitCount
|
||||
// 充值
|
||||
d.TotalAmount = s.TotalAmount
|
||||
d.DirectAmount = s.DirectAmount
|
||||
d.DirectAmountCount = s.DirectAmountCount
|
||||
d.FissionAmount = s.FissionAmount
|
||||
d.FissionAmountCount = s.FissionAmountCount
|
||||
d.NaturalAmount = s.NaturalAmount
|
||||
d.NaturalAmountCount = s.NaturalAmountCount
|
||||
d.DeductionAmount = s.DeductionAmount
|
||||
d.DeductionAmountCount = s.DeductionAmountCount
|
||||
d.AndroidAmount = s.AndroidAmount
|
||||
d.AndroidAmountCount = s.AndroidAmountCount
|
||||
d.IosAmount = s.IosAmount
|
||||
d.IosAmountCount = s.IosAmountCount
|
||||
d.H5Amount = s.H5Amount
|
||||
d.H5AmountCount = s.H5AmountCount
|
||||
d.LightAmount = s.LightAmount
|
||||
d.LightAmountCount = s.LightAmountCount
|
||||
d.LightDirectAmount = s.LightDirectAmount
|
||||
d.LightDirectAmountCount = s.LightDirectAmountCount
|
||||
d.LightFissionAmount = s.LightFissionAmount
|
||||
d.LightFissionAmountCount = s.LightFissionAmountCount
|
||||
d.LightDeductionAmount = s.LightDeductionAmount
|
||||
d.LightDeductionAmountCount = s.LightDeductionAmountCount
|
||||
d.LightNaturalAmount = s.LightNaturalAmount
|
||||
d.LightNaturalAmountCount = s.LightNaturalAmountCount
|
||||
// 其他充值
|
||||
d.NewRechargeAmount = s.NewRechargeAmount
|
||||
d.VipPayMoney = s.VipPayMoney
|
||||
d.VipPayCoin = s.VipPayCoin
|
||||
d.VipPayDeduction = s.VipPayDeduction
|
||||
d.GameRechageAmount = s.GameRechageAmount
|
||||
d.GameWithdrawAmount = s.GameWithdrawAmount
|
||||
// 落地页访问
|
||||
d.LandPageVisitCount = s.LandPageVisitCount
|
||||
d.LandpageAndroidClick = s.LandpageAndroidClick
|
||||
d.LandpageIosAppstoreClick = s.LandpageIosAppstoreClick
|
||||
d.LandpageIosAthorClick = s.LandpageIosAthorClick
|
||||
d.LandpageIosH5Click = s.LandpageIosH5Click
|
||||
}
|
||||
|
||||
func (s *ChannelStat) AccumulateTo(d *ChannelSettlement) {
|
||||
d.ValidDirectCount += s.ValidDirectCount
|
||||
d.ValidDeductionCount += s.ValidDeductionCount
|
||||
d.ValidPayMoney += s.ValidPayMoney
|
||||
d.ValidPayCoin += s.ValidPayCoin
|
||||
|
||||
d.NewTotalIpCount += s.NewTotalIpCount
|
||||
d.NewTotalCount += s.NewTotalCount
|
||||
d.NewDirectCount += s.NewDirectCount
|
||||
d.NewFissionCount += s.NewFissionCount
|
||||
d.NewDeductionCount += s.NewDeductionCount
|
||||
d.NewAndroidCount += s.NewAndroidCount
|
||||
d.NewAndroidDirectCount += s.NewAndroidDirectCount
|
||||
d.NewAndroidFissionCount += s.NewAndroidFissionCount
|
||||
d.NewAndroidDeductionCount += s.NewAndroidDeductionCount
|
||||
|
||||
d.NewIosCount += s.NewIosCount
|
||||
d.NewIosDirectCount += s.NewIosDirectCount
|
||||
d.NewIosFissionCount += s.NewIosFissionCount
|
||||
d.NewIosDeductionCount += s.NewIosDeductionCount
|
||||
|
||||
d.NewLightCount += s.NewLightCount
|
||||
d.NewLightGuestCount += s.NewLightGuestCount
|
||||
d.NewLightGuestDirectCount += s.NewLightGuestDirectCount
|
||||
d.NewLightGuestFissionCount += s.NewLightGuestFissionCount
|
||||
d.NewLightGuestDeductionCount += s.NewLightGuestDeductionCount
|
||||
|
||||
d.NewLightFormalCount += s.NewLightFormalCount
|
||||
d.NewLightFormalDirectCount += s.NewLightFormalDirectCount
|
||||
d.NewLightFormalFissionCount += s.NewLightFormalFissionCount
|
||||
d.NewLightFormalDeductionCount += s.NewLightFormalDeductionCount
|
||||
|
||||
d.NewLightDirectCount += s.NewLightDirectCount
|
||||
d.NewLightFissionCount += s.NewLightFissionCount
|
||||
d.NewLightDeductionCount += s.NewLightDeductionCount
|
||||
d.NewLightNaturalCount += s.NewLightNaturalCount
|
||||
d.NewH5Count += s.NewH5Count
|
||||
d.NewH5DirectCount += s.NewH5DirectCount
|
||||
d.NewH5FissionCount += s.NewH5FissionCount
|
||||
d.NewH5DeductionCount += s.NewH5DeductionCount
|
||||
|
||||
d.NewH5AndroidCount += s.NewH5AndroidCount
|
||||
d.NewH5IosCount += s.NewH5IosCount
|
||||
d.NewH5PcCount += s.NewH5PcCount
|
||||
d.NewH5FormalCount += s.NewH5FormalCount
|
||||
d.NewH5FormalDirectCount += s.NewH5FormalDirectCount
|
||||
d.NewH5FormalFissionCount += s.NewH5FormalFissionCount
|
||||
d.NewH5FormalDeductionCount += s.NewH5FormalDeductionCount
|
||||
|
||||
// 访问
|
||||
d.TotalVisitCount += s.TotalVisitCount
|
||||
d.DirectVisitCount += s.DirectVisitCount
|
||||
d.FissionVisitCount += s.FissionVisitCount
|
||||
d.AndroidVisitCount += s.AndroidVisitCount
|
||||
d.IosVisitCount += s.IosVisitCount
|
||||
d.LightVisitCount += s.LightVisitCount
|
||||
d.LightVisitDirectCount += s.LightVisitDirectCount
|
||||
d.LightVisitFissionCount += s.LightVisitFissionCount
|
||||
d.LightVisitDeductionCount += s.LightVisitDeductionCount
|
||||
d.LightVisitNaturalCount += s.LightVisitNaturalCount
|
||||
d.H5VisitCount += s.H5VisitCount
|
||||
d.H5AndroidVisitCount += s.H5AndroidVisitCount
|
||||
d.H5IosVisitCount += s.H5IosVisitCount
|
||||
d.H5PcVisitCount += s.H5PcVisitCount
|
||||
// 充值
|
||||
d.TotalAmount += s.TotalAmount
|
||||
d.DirectAmount += s.DirectAmount
|
||||
d.DirectAmountCount += s.DirectAmountCount
|
||||
d.FissionAmount += s.FissionAmount
|
||||
d.FissionAmountCount += s.FissionAmountCount
|
||||
d.NaturalAmount += s.NaturalAmount
|
||||
d.NaturalAmountCount += s.NaturalAmountCount
|
||||
d.DeductionAmount += s.DeductionAmount
|
||||
d.DeductionAmountCount += s.DeductionAmountCount
|
||||
d.AndroidAmount += s.AndroidAmount
|
||||
d.AndroidAmountCount += s.AndroidAmountCount
|
||||
d.IosAmount += s.IosAmount
|
||||
d.IosAmountCount += s.IosAmountCount
|
||||
d.LightAmount += s.LightAmount
|
||||
d.LightAmountCount += s.LightAmountCount
|
||||
d.LightDirectAmount += s.LightDirectAmount
|
||||
d.LightDirectAmountCount += s.LightDirectAmountCount
|
||||
d.LightFissionAmount += s.LightFissionAmount
|
||||
d.LightFissionAmountCount += s.LightFissionAmountCount
|
||||
d.LightDeductionAmount += s.LightDeductionAmount
|
||||
d.LightDeductionAmountCount += s.LightDeductionAmountCount
|
||||
d.LightNaturalAmount += s.LightNaturalAmount
|
||||
d.LightNaturalAmountCount += s.LightNaturalAmountCount
|
||||
// 其他充值
|
||||
d.NewRechargeAmount += s.NewRechargeAmount
|
||||
d.VipPayMoney += s.VipPayMoney
|
||||
d.VipPayCoin += s.VipPayCoin
|
||||
d.VipPayDeduction += s.VipPayDeduction
|
||||
d.GameRechageAmount += s.GameRechageAmount
|
||||
d.GameWithdrawAmount += s.GameWithdrawAmount
|
||||
// 落地页访问
|
||||
d.LandPageVisitCount += s.LandPageVisitCount
|
||||
d.LandpageAndroidClick += s.LandpageAndroidClick
|
||||
d.LandpageIosAppstoreClick += s.LandpageIosAppstoreClick
|
||||
d.LandpageIosAthorClick += s.LandpageIosAthorClick
|
||||
d.LandpageIosH5Click += s.LandpageIosH5Click
|
||||
}
|
||||
|
||||
func (s *ChannelStat) CalcIncomeRate() *ChannelStat {
|
||||
if s.Settlement == SettlementCPA && s.CPAPrice > 0 {
|
||||
spendMoney := s.ValidDirectCount * s.CPAPrice
|
||||
incomeMoney := getConfig(s.AppId).GetIncome(s) //s.DirectAmount
|
||||
if spendMoney > 0 {
|
||||
s.IncomeAmount = spendMoney
|
||||
s.IncomeRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", float64(incomeMoney)/float64(spendMoney)), 64)
|
||||
}
|
||||
} else if s.Settlement == SettlementCPS && s.CPSRate > 0 {
|
||||
spendMoney := s.ValidPayMoney * s.CPSRate / 100
|
||||
incomeMoney := getConfig(s.AppId).GetIncome(s) // s.DirectAmount
|
||||
if spendMoney > 0 {
|
||||
s.IncomeAmount = spendMoney
|
||||
s.IncomeRate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", float64(incomeMoney)/float64(spendMoney)), 64)
|
||||
}
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ChannelStat) CorrectValidData() *ChannelStat {
|
||||
//if s.ValidDirectCount == 0 && s.ValidPayMoney == 0 {
|
||||
s.ValidDirectCount, s.ValidPayMoney, s.ValidPayCoin, s.ValidDeductionCount = GetChannelStatValidData(s)
|
||||
//}
|
||||
if s.TotalVisitCount != s.DirectVisitCount+s.FissionVisitCount {
|
||||
s.TotalVisitCount = s.DirectVisitCount + s.FissionVisitCount
|
||||
}
|
||||
if s.NewTotalCount != s.NewDirectCount+s.NewFissionCount+s.NewDeductionCount {
|
||||
s.NewTotalCount = s.NewDirectCount + s.NewFissionCount + s.NewDeductionCount
|
||||
}
|
||||
if s.DirectAmount+s.FissionAmount+s.DeductionAmount != s.TotalAmount {
|
||||
s.TotalAmount = s.DirectAmount + s.FissionAmount + s.DeductionAmount
|
||||
}
|
||||
if s.VipPayMoney+s.VipPayDeduction+s.VipPayCoin != s.TotalAmount {
|
||||
s.VipPayCoin = s.TotalAmount - s.VipPayMoney - s.VipPayDeduction
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *ChannelSettlement) CorrectValidData() *ChannelSettlement {
|
||||
//if s.ValidDirectCount == 0 && s.ValidPayMoney == 0 {
|
||||
s.ValidDirectCount, s.ValidPayMoney, s.ValidPayCoin, s.ValidDeductionCount = GetChannelSettlementValidData(s)
|
||||
//}
|
||||
if s.TotalVisitCount != s.DirectVisitCount+s.FissionVisitCount {
|
||||
s.TotalVisitCount = s.DirectVisitCount + s.FissionVisitCount
|
||||
}
|
||||
if s.NewTotalCount != s.NewDirectCount+s.NewFissionCount+s.NewDeductionCount {
|
||||
s.NewTotalCount = s.NewDirectCount + s.NewFissionCount + s.NewDeductionCount
|
||||
}
|
||||
if s.DirectAmount+s.FissionAmount+s.DeductionAmount != s.TotalAmount {
|
||||
s.TotalAmount = s.DirectAmount + s.FissionAmount + s.DeductionAmount
|
||||
}
|
||||
if s.VipPayMoney+s.VipPayDeduction+s.VipPayCoin != s.TotalAmount {
|
||||
s.VipPayCoin = s.TotalAmount - s.VipPayMoney - s.VipPayDeduction
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func GetChannelStatValidData(stat *ChannelStat) (count int64, amount int64, coin int64, deduction int64) {
|
||||
switch stat.AppType {
|
||||
case AppTypePkg:
|
||||
count = stat.NewAndroidDirectCount + stat.NewIosDirectCount
|
||||
deduction = stat.NewAndroidDeductionCount + stat.NewIosDeductionCount
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
case AppTypeLight:
|
||||
if stat.PromoteMode == PromoteModeRegister {
|
||||
count = stat.NewLightFormalDirectCount
|
||||
deduction = stat.NewLightFormalDeductionCount
|
||||
} else {
|
||||
count = stat.NewLightDirectCount
|
||||
deduction = stat.NewLightDeductionCount
|
||||
}
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
case AppTypeH5:
|
||||
if stat.PromoteMode == PromoteModeRegister {
|
||||
count = stat.NewH5FormalDirectCount
|
||||
deduction = stat.NewH5FormalDeductionCount
|
||||
} else {
|
||||
count = stat.NewH5DirectCount
|
||||
deduction = stat.NewH5DeductionCount
|
||||
}
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
default:
|
||||
count = stat.NewDirectCount
|
||||
deduction = stat.NewDeductionCount
|
||||
amount = stat.VipPayMoney
|
||||
if stat.AppId == 6666 && amount == 0 { // 咻车宝按照充值金币计算
|
||||
amount += stat.VipPayCoin
|
||||
}
|
||||
coin = stat.ValidPayCoin
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func GetChannelSettlementValidData(stat *ChannelSettlement) (count int64, amount int64, coin int64, deduction int64) {
|
||||
switch stat.AppType {
|
||||
case AppTypePkg:
|
||||
count = stat.NewAndroidDirectCount + stat.NewIosDirectCount
|
||||
deduction = stat.NewAndroidDeductionCount + stat.NewIosDeductionCount
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
case AppTypeLight:
|
||||
if stat.PromoteMode == PromoteModeRegister {
|
||||
count = stat.NewLightFormalDirectCount
|
||||
deduction = stat.NewLightFormalDeductionCount
|
||||
} else {
|
||||
count = stat.NewLightDirectCount
|
||||
deduction = stat.NewLightDeductionCount
|
||||
}
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
case AppTypeH5:
|
||||
if stat.PromoteMode == PromoteModeRegister {
|
||||
count = stat.NewH5FormalDirectCount
|
||||
deduction = stat.NewH5FormalDeductionCount
|
||||
} else {
|
||||
count = stat.NewH5DirectCount
|
||||
deduction = stat.NewH5DeductionCount
|
||||
}
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
default:
|
||||
count = stat.NewDirectCount
|
||||
deduction = stat.NewDeductionCount
|
||||
amount = stat.VipPayMoney
|
||||
coin = stat.ValidPayCoin
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ChannelStatSummation(base, value *ChannelStat) {
|
||||
value.CorrectValidData()
|
||||
|
||||
base.ValidDirectCount += value.ValidDirectCount
|
||||
base.ValidDeductionCount += value.ValidDeductionCount
|
||||
base.ValidPayMoney += value.ValidPayMoney
|
||||
base.ValidPayCoin += value.ValidPayCoin
|
||||
|
||||
base.NewTotalIpCount += value.NewTotalIpCount
|
||||
base.NewTotalCount += value.NewTotalCount
|
||||
base.NewDirectCount += value.NewDirectCount
|
||||
base.NewFissionCount += value.NewFissionCount
|
||||
base.NewDeductionCount += value.NewDeductionCount
|
||||
base.NewAndroidCount += value.NewAndroidCount
|
||||
base.NewAndroidDirectCount += value.NewAndroidDirectCount
|
||||
base.NewAndroidFissionCount += value.NewAndroidFissionCount
|
||||
base.NewAndroidDeductionCount += value.NewAndroidDeductionCount
|
||||
|
||||
base.NewIosCount += value.NewIosCount
|
||||
base.NewIosDirectCount += value.NewIosDirectCount
|
||||
base.NewIosFissionCount += value.NewIosFissionCount
|
||||
base.NewIosDeductionCount += value.NewIosDeductionCount
|
||||
|
||||
base.NewLightCount += value.NewLightCount
|
||||
base.NewLightGuestCount += value.NewLightGuestCount
|
||||
base.NewLightGuestDirectCount += value.NewLightGuestDirectCount
|
||||
base.NewLightGuestFissionCount += value.NewLightGuestFissionCount
|
||||
base.NewLightGuestDeductionCount += value.NewLightGuestDeductionCount
|
||||
|
||||
base.NewLightFormalCount += value.NewLightFormalCount
|
||||
base.NewLightFormalDirectCount += value.NewLightFormalDirectCount
|
||||
base.NewLightFormalFissionCount += value.NewLightFormalFissionCount
|
||||
base.NewLightFormalDeductionCount += value.NewLightFormalDeductionCount
|
||||
|
||||
base.NewLightDirectCount += value.NewLightDirectCount
|
||||
base.NewLightFissionCount += value.NewLightFissionCount
|
||||
base.NewLightDeductionCount += value.NewLightDeductionCount
|
||||
base.NewLightNaturalCount += value.NewLightNaturalCount
|
||||
base.NewH5Count += value.NewH5Count
|
||||
base.NewH5DirectCount += value.NewH5DirectCount
|
||||
base.NewH5FissionCount += value.NewH5FissionCount
|
||||
base.NewH5DeductionCount += value.NewH5DeductionCount
|
||||
base.NewH5AndroidCount += value.NewH5AndroidCount
|
||||
base.NewH5IosCount += value.NewH5IosCount
|
||||
base.NewH5PcCount += value.NewH5PcCount
|
||||
base.NewH5FormalCount += value.NewH5FormalCount
|
||||
base.NewH5FormalDirectCount += value.NewH5FormalDirectCount
|
||||
base.NewH5FormalFissionCount += value.NewH5FormalFissionCount
|
||||
base.NewH5FormalDeductionCount += value.NewH5FormalDeductionCount
|
||||
// 访问
|
||||
base.TotalVisitCount += value.TotalVisitCount
|
||||
base.DirectVisitCount += value.DirectVisitCount
|
||||
base.FissionVisitCount += value.FissionVisitCount
|
||||
base.AndroidVisitCount += value.AndroidVisitCount
|
||||
base.IosVisitCount += value.IosVisitCount
|
||||
base.LightVisitCount += value.LightVisitCount
|
||||
base.LightVisitDirectCount += value.LightVisitDirectCount
|
||||
base.LightVisitFissionCount += value.LightVisitFissionCount
|
||||
base.LightVisitDeductionCount += value.LightVisitDeductionCount
|
||||
base.LightVisitNaturalCount += value.LightVisitNaturalCount
|
||||
base.H5VisitCount += value.H5VisitCount
|
||||
base.H5AndroidVisitCount += value.H5AndroidVisitCount
|
||||
base.H5IosVisitCount += value.H5IosVisitCount
|
||||
base.H5PcVisitCount += value.H5PcVisitCount
|
||||
// 充值
|
||||
base.TotalAmount += value.TotalAmount
|
||||
base.DirectAmount += value.DirectAmount
|
||||
base.DirectAmountCount += value.DirectAmountCount
|
||||
base.FissionAmount += value.FissionAmount
|
||||
base.FissionAmountCount += value.FissionAmountCount
|
||||
base.NaturalAmount += value.NaturalAmount
|
||||
base.NaturalAmountCount += value.NaturalAmountCount
|
||||
base.DeductionAmount += value.DeductionAmount
|
||||
base.DeductionAmountCount += value.DeductionAmountCount
|
||||
base.AndroidAmount += value.AndroidAmount
|
||||
base.AndroidAmountCount += value.AndroidAmountCount
|
||||
base.IosAmount += value.IosAmount
|
||||
base.IosAmountCount += value.IosAmountCount
|
||||
base.H5Amount += value.H5Amount
|
||||
base.H5AmountCount += value.H5AmountCount
|
||||
base.LightAmount += value.LightAmount
|
||||
base.LightAmountCount += value.LightAmountCount
|
||||
base.LightDirectAmount += value.LightDirectAmount
|
||||
base.LightDirectAmountCount += value.LightDirectAmountCount
|
||||
base.LightFissionAmount += value.LightFissionAmount
|
||||
base.LightFissionAmountCount += value.LightFissionAmountCount
|
||||
base.LightDeductionAmount += value.LightDeductionAmount
|
||||
base.LightDeductionAmountCount += value.LightDeductionAmountCount
|
||||
base.LightNaturalAmount += value.LightNaturalAmount
|
||||
base.LightNaturalAmountCount += value.LightNaturalAmountCount
|
||||
// 其他充值
|
||||
base.NewRechargeAmount += value.NewRechargeAmount
|
||||
base.VipPayMoney += value.VipPayMoney
|
||||
base.VipPayCoin += value.DirectAmount + value.FissionAmount - value.VipPayMoney - value.VipPayDeduction
|
||||
base.VipPayDeduction += value.VipPayDeduction
|
||||
base.GameRechageAmount += value.GameRechageAmount
|
||||
base.GameWithdrawAmount += value.GameWithdrawAmount
|
||||
// 落地页访问
|
||||
base.LandPageVisitCount += value.LandPageVisitCount
|
||||
base.LandpageAndroidClick += value.LandpageAndroidClick
|
||||
base.LandpageIosAppstoreClick += value.LandpageIosAppstoreClick
|
||||
base.LandpageIosAthorClick += value.LandpageIosAthorClick
|
||||
base.LandpageIosH5Click += value.LandpageIosH5Click
|
||||
}
|
||||
|
||||
func CalculateChannelIncome(stat *ChannelStat) (int64, string) {
|
||||
var income int64
|
||||
var desc string
|
||||
if stat.Settlement == SettlementCPA {
|
||||
income = stat.ValidDirectCount * stat.CPAPrice
|
||||
desc = fmt.Sprintf("CPA:%d * %.2f", stat.ValidDirectCount, float64(stat.CPAPrice)/float64(100))
|
||||
} else if stat.Settlement == SettlementCPS {
|
||||
income += (stat.ValidPayMoney * stat.CPSRate) / 100
|
||||
desc = fmt.Sprintf("CPS:%.2f * %.2f", float64(stat.ValidPayMoney)/float64(100), float64(stat.CPSRate)/float64(100))
|
||||
} else {
|
||||
income = 0
|
||||
desc = fmt.Sprintf("【%s】结算方式,需要自己计算结算金额", stat.Settlement)
|
||||
}
|
||||
return income, desc
|
||||
}
|
||||
Executable
+649
@@ -0,0 +1,649 @@
|
||||
package channelmod
|
||||
|
||||
type TagChannelInfo struct {
|
||||
AppIds string
|
||||
AutoGenApk string
|
||||
Channel string
|
||||
CheckTokenTime string
|
||||
ChildCount string
|
||||
ChildShowDivideRate string
|
||||
CreatedAt string
|
||||
ID string
|
||||
IP string
|
||||
Lock string
|
||||
Mobile string
|
||||
ParentAgent string
|
||||
ParentChannel string
|
||||
Password string
|
||||
Remark string
|
||||
ShowMagic string
|
||||
Status string
|
||||
Token string
|
||||
Type string
|
||||
UpdatedAt string
|
||||
UserName string
|
||||
Wallet struct {
|
||||
Addr1 string
|
||||
Addr2 string
|
||||
}
|
||||
}
|
||||
type TagChannelDeductionRule struct {
|
||||
AppId string
|
||||
AppName string
|
||||
AppType string
|
||||
AutoDeduction string
|
||||
BeginTime string
|
||||
CPAPrice string
|
||||
CPSBegin string
|
||||
CPSDeductionRate string
|
||||
CPSRate string
|
||||
Channel string
|
||||
CreatedAt string
|
||||
DivideRate string
|
||||
Fifth string
|
||||
First string
|
||||
Fourth string
|
||||
ID string
|
||||
LandingPage string
|
||||
LessIncomeRate string
|
||||
PromoteMode string
|
||||
ProxyDeduction string
|
||||
Second string
|
||||
Settlement string
|
||||
SettlementTime string
|
||||
Third string
|
||||
TodayDeduction string
|
||||
TodayTime string
|
||||
UpdatedAt string
|
||||
}
|
||||
type TagChannelStat struct {
|
||||
AndroidAmount string
|
||||
AndroidAmountCount string
|
||||
AndroidVisitCount string
|
||||
AppId string
|
||||
AppType string
|
||||
CPAPrice string
|
||||
CPSRate string
|
||||
Channel string
|
||||
CreatedAt string
|
||||
Day1RetainRate string
|
||||
Day3RetainRate string
|
||||
Day7RetainRate string
|
||||
DeductionAmount string
|
||||
DeductionAmountCount string
|
||||
DirectAmount string
|
||||
DirectAmountCount string
|
||||
DirectVisitCount string
|
||||
FissionAmount string
|
||||
FissionAmountCount string
|
||||
FissionVisitCount string
|
||||
GameRechageAmount string
|
||||
GameWithdrawAmount string
|
||||
H5Amount string
|
||||
H5AmountCount string
|
||||
H5AndroidVisitCount string
|
||||
H5IosVisitCount string
|
||||
H5PcVisitCount string
|
||||
H5VisitCount string
|
||||
ID string
|
||||
IncomeAmount string
|
||||
IncomeRate string
|
||||
IosAmount string
|
||||
IosAmountCount string
|
||||
IosVisitCount string
|
||||
IsPay string
|
||||
LandPageVisitCount string
|
||||
LandpageAndroidClick string
|
||||
LandpageIosAppstoreClick string
|
||||
LandpageIosAthorClick string
|
||||
LandpageIosH5Click string
|
||||
LightAmount string
|
||||
LightAmountCount string
|
||||
LightDeductionAmount string
|
||||
LightDeductionAmountCount string
|
||||
LightDirectAmount string
|
||||
LightDirectAmountCount string
|
||||
LightFissionAmount string
|
||||
LightFissionAmountCount string
|
||||
LightNaturalAmount string
|
||||
LightNaturalAmountCount string
|
||||
LightVisitCount string
|
||||
LightVisitDeductionCount string
|
||||
LightVisitDirectCount string
|
||||
LightVisitFissionCount string
|
||||
LightVisitNaturalCount string
|
||||
NaturalAmount string
|
||||
NaturalAmountCount string
|
||||
NewAndroidCount string
|
||||
NewAndroidDeductionCount string
|
||||
NewAndroidDirectCount string
|
||||
NewAndroidFissionCount string
|
||||
NewDeductionCount string
|
||||
NewDirectCount string
|
||||
NewFissionCount string
|
||||
NewH5AndroidCount string
|
||||
NewH5Count string
|
||||
NewH5DeductionCount string
|
||||
NewH5DirectCount string
|
||||
NewH5FissionCount string
|
||||
NewH5FormalCount string
|
||||
NewH5FormalDeductionCount string
|
||||
NewH5FormalDirectCount string
|
||||
NewH5FormalFissionCount string
|
||||
NewH5IosCount string
|
||||
NewH5PcCount string
|
||||
NewIosCount string
|
||||
NewIosDeductionCount string
|
||||
NewIosDirectCount string
|
||||
NewIosFissionCount string
|
||||
NewLightCount string
|
||||
NewLightDeductionCount string
|
||||
NewLightDirectCount string
|
||||
NewLightFissionCount string
|
||||
NewLightFormalCount string
|
||||
NewLightFormalDeductionCount string
|
||||
NewLightFormalDirectCount string
|
||||
NewLightFormalFissionCount string
|
||||
NewLightGuestCount string
|
||||
NewLightGuestDeductionCount string
|
||||
NewLightGuestDirectCount string
|
||||
NewLightGuestFissionCount string
|
||||
NewLightNaturalCount string
|
||||
NewRechargeAmount string
|
||||
NewTotalCount string
|
||||
NewTotalIpCount string
|
||||
ParentChannel string
|
||||
PromoteMode string
|
||||
Settlement string
|
||||
SumDate string
|
||||
TotalAmount string
|
||||
TotalVisitCount string
|
||||
Type string
|
||||
UpdatedAt string
|
||||
UserName string
|
||||
ValidDeductionCount string
|
||||
ValidDirectCount string
|
||||
ValidPayCoin string
|
||||
ValidPayMoney string
|
||||
VipPayCoin string
|
||||
VipPayDeduction string
|
||||
VipPayMoney string
|
||||
}
|
||||
type TagChannelSettlement struct {
|
||||
AndroidAmount string
|
||||
AndroidAmountCount string
|
||||
AndroidVisitCount string
|
||||
AppId string
|
||||
AppType string
|
||||
Channel string
|
||||
CreatedAt string
|
||||
DeductionAmount string
|
||||
DeductionAmountCount string
|
||||
DirectAmount string
|
||||
DirectAmountCount string
|
||||
DirectVisitCount string
|
||||
FissionAmount string
|
||||
FissionAmountCount string
|
||||
FissionVisitCount string
|
||||
GameRechageAmount string
|
||||
GameWithdrawAmount string
|
||||
H5Amount string
|
||||
H5AmountCount string
|
||||
H5AndroidVisitCount string
|
||||
H5IosVisitCount string
|
||||
H5PcVisitCount string
|
||||
H5VisitCount string
|
||||
ID string
|
||||
IosAmount string
|
||||
IosAmountCount string
|
||||
IosVisitCount string
|
||||
LandPageVisitCount string
|
||||
LandpageAndroidClick string
|
||||
LandpageIosAppstoreClick string
|
||||
LandpageIosAthorClick string
|
||||
LandpageIosH5Click string
|
||||
LightAmount string
|
||||
LightAmountCount string
|
||||
LightDeductionAmount string
|
||||
LightDeductionAmountCount string
|
||||
LightDirectAmount string
|
||||
LightDirectAmountCount string
|
||||
LightFissionAmount string
|
||||
LightFissionAmountCount string
|
||||
LightNaturalAmount string
|
||||
LightNaturalAmountCount string
|
||||
LightVisitCount string
|
||||
LightVisitDeductionCount string
|
||||
LightVisitDirectCount string
|
||||
LightVisitFissionCount string
|
||||
LightVisitNaturalCount string
|
||||
NaturalAmount string
|
||||
NaturalAmountCount string
|
||||
NewAndroidCount string
|
||||
NewAndroidDeductionCount string
|
||||
NewAndroidDirectCount string
|
||||
NewAndroidFissionCount string
|
||||
NewDeductionCount string
|
||||
NewDirectCount string
|
||||
NewFissionCount string
|
||||
NewH5AndroidCount string
|
||||
NewH5Count string
|
||||
NewH5DeductionCount string
|
||||
NewH5DirectCount string
|
||||
NewH5FissionCount string
|
||||
NewH5FormalCount string
|
||||
NewH5FormalDeductionCount string
|
||||
NewH5FormalDirectCount string
|
||||
NewH5FormalFissionCount string
|
||||
NewH5IosCount string
|
||||
NewH5PcCount string
|
||||
NewIosCount string
|
||||
NewIosDeductionCount string
|
||||
NewIosDirectCount string
|
||||
NewIosFissionCount string
|
||||
NewLightCount string
|
||||
NewLightDeductionCount string
|
||||
NewLightDirectCount string
|
||||
NewLightFissionCount string
|
||||
NewLightFormalCount string
|
||||
NewLightFormalDeductionCount string
|
||||
NewLightFormalDirectCount string
|
||||
NewLightFormalFissionCount string
|
||||
NewLightGuestCount string
|
||||
NewLightGuestDeductionCount string
|
||||
NewLightGuestDirectCount string
|
||||
NewLightGuestFissionCount string
|
||||
NewLightNaturalCount string
|
||||
NewRechargeAmount string
|
||||
NewTotalCount string
|
||||
NewTotalIpCount string
|
||||
ParentChannel string
|
||||
PromoteMode string
|
||||
SumDate string
|
||||
TotalAmount string
|
||||
TotalVisitCount string
|
||||
Type string
|
||||
UpdatedAt string
|
||||
UserName string
|
||||
ValidDeductionCount string
|
||||
ValidDirectCount string
|
||||
ValidPayCoin string
|
||||
ValidPayMoney string
|
||||
VipPayCoin string
|
||||
VipPayDeduction string
|
||||
VipPayMoney string
|
||||
}
|
||||
type TagChannelStatYestoday struct {
|
||||
AndroidRechargeAmount string
|
||||
AppId string
|
||||
Channel string
|
||||
CreatedAt string
|
||||
DirectAmount string
|
||||
FissionAmount string
|
||||
H5RechargeAmount string
|
||||
ID string
|
||||
IosRechargeAmount string
|
||||
LightRechargeAmount string
|
||||
NewAndroidCount string
|
||||
NewCount string
|
||||
NewDirectCount string
|
||||
NewFissionCount string
|
||||
NewH5Count string
|
||||
NewH5FormalCount string
|
||||
NewIncreaseCount string
|
||||
NewIncreaseRate string
|
||||
NewIosCount string
|
||||
NewLightFormalCount string
|
||||
NewLightGuestCount string
|
||||
ParentChannel string
|
||||
RechargeAmount string
|
||||
RechargeIncreaseAmount string
|
||||
RechargeIncreaseRate string
|
||||
Settlement string
|
||||
SumDate string
|
||||
UpdatedAt string
|
||||
VipPayCoin string
|
||||
VipPayDeduction string
|
||||
VipPayMoney string
|
||||
}
|
||||
type TagChannelOwnerChange struct {
|
||||
Account string
|
||||
Channel string
|
||||
CreatedAt string
|
||||
ID string
|
||||
Mark string
|
||||
NewUser string
|
||||
OldUser string
|
||||
Operator string
|
||||
UpdatedAt string
|
||||
}
|
||||
|
||||
var FN struct {
|
||||
ChannelInfo TagChannelInfo
|
||||
ChannelDeductionRule TagChannelDeductionRule
|
||||
ChannelStat TagChannelStat
|
||||
ChannelSettlement TagChannelSettlement
|
||||
ChannelStatYestoday TagChannelStatYestoday
|
||||
ChannelOwnerChange TagChannelOwnerChange
|
||||
}
|
||||
|
||||
var TN struct {
|
||||
ChannelInfo string
|
||||
ChannelDeductionRule string
|
||||
ChannelStat string
|
||||
ChannelSettlement string
|
||||
ChannelStatYestoday string
|
||||
ChannelOwnerChange string
|
||||
}
|
||||
|
||||
func init() {
|
||||
FN.ChannelInfo.AppIds = "appIds"
|
||||
FN.ChannelInfo.AutoGenApk = "autoGenApk"
|
||||
FN.ChannelInfo.Channel = "channel"
|
||||
FN.ChannelInfo.CheckTokenTime = "checkTokenTime"
|
||||
FN.ChannelInfo.ChildCount = "childCount"
|
||||
FN.ChannelInfo.ChildShowDivideRate = "childShowDivideRate"
|
||||
FN.ChannelInfo.CreatedAt = "createdAt"
|
||||
FN.ChannelInfo.ID = "_id"
|
||||
FN.ChannelInfo.IP = "ip"
|
||||
FN.ChannelInfo.Lock = "lock"
|
||||
FN.ChannelInfo.Mobile = "mobile"
|
||||
FN.ChannelInfo.ParentAgent = "parentAgent"
|
||||
FN.ChannelInfo.ParentChannel = "parentChannel"
|
||||
FN.ChannelInfo.Password = "password"
|
||||
FN.ChannelInfo.Remark = "remark"
|
||||
FN.ChannelInfo.ShowMagic = "showMagic"
|
||||
FN.ChannelInfo.Status = "status"
|
||||
FN.ChannelInfo.Token = "token"
|
||||
FN.ChannelInfo.Type = "type"
|
||||
FN.ChannelInfo.UpdatedAt = "updatedAt"
|
||||
FN.ChannelInfo.UserName = "userName"
|
||||
FN.ChannelInfo.Wallet.Addr1 = "wallet.addr1"
|
||||
FN.ChannelInfo.Wallet.Addr2 = "wallet.addr2"
|
||||
FN.ChannelDeductionRule.AppId = "appId"
|
||||
FN.ChannelDeductionRule.AppName = "appName"
|
||||
FN.ChannelDeductionRule.AppType = "appType"
|
||||
FN.ChannelDeductionRule.AutoDeduction = "autoDeduction"
|
||||
FN.ChannelDeductionRule.BeginTime = "deductionAt"
|
||||
FN.ChannelDeductionRule.CPAPrice = "cpaPrice"
|
||||
FN.ChannelDeductionRule.CPSBegin = "cpsBegin"
|
||||
FN.ChannelDeductionRule.CPSDeductionRate = "cpsDeductionRate"
|
||||
FN.ChannelDeductionRule.CPSRate = "cpsRate"
|
||||
FN.ChannelDeductionRule.Channel = "channel"
|
||||
FN.ChannelDeductionRule.CreatedAt = "createdAt"
|
||||
FN.ChannelDeductionRule.DivideRate = "divideRate"
|
||||
FN.ChannelDeductionRule.Fifth = "fifth"
|
||||
FN.ChannelDeductionRule.First = "first"
|
||||
FN.ChannelDeductionRule.Fourth = "fourth"
|
||||
FN.ChannelDeductionRule.ID = "_id"
|
||||
FN.ChannelDeductionRule.LandingPage = "landingPage"
|
||||
FN.ChannelDeductionRule.LessIncomeRate = "lessIncomeRate"
|
||||
FN.ChannelDeductionRule.PromoteMode = "promoteMode"
|
||||
FN.ChannelDeductionRule.ProxyDeduction = "proxyDeduction"
|
||||
FN.ChannelDeductionRule.Second = "second"
|
||||
FN.ChannelDeductionRule.Settlement = "settlement"
|
||||
FN.ChannelDeductionRule.SettlementTime = "settlementTime"
|
||||
FN.ChannelDeductionRule.Third = "third"
|
||||
FN.ChannelDeductionRule.TodayDeduction = "todayDeduction"
|
||||
FN.ChannelDeductionRule.TodayTime = "todayTime"
|
||||
FN.ChannelDeductionRule.UpdatedAt = "updatedAt"
|
||||
FN.ChannelStat.AndroidAmount = "androidAmount"
|
||||
FN.ChannelStat.AndroidAmountCount = "androidAmountCount"
|
||||
FN.ChannelStat.AndroidVisitCount = "androidVisitCount"
|
||||
FN.ChannelStat.AppId = "appId"
|
||||
FN.ChannelStat.AppType = "appType"
|
||||
FN.ChannelStat.CPAPrice = "cpaPrice"
|
||||
FN.ChannelStat.CPSRate = "cpsRate"
|
||||
FN.ChannelStat.Channel = "channel"
|
||||
FN.ChannelStat.CreatedAt = "createdAt"
|
||||
FN.ChannelStat.Day1RetainRate = "day1RetainRate"
|
||||
FN.ChannelStat.Day3RetainRate = "day3RetainRate"
|
||||
FN.ChannelStat.Day7RetainRate = "day7RetainRate"
|
||||
FN.ChannelStat.DeductionAmount = "deductionAmount"
|
||||
FN.ChannelStat.DeductionAmountCount = "deductionAmountCount"
|
||||
FN.ChannelStat.DirectAmount = "directAmount"
|
||||
FN.ChannelStat.DirectAmountCount = "directAmountCount"
|
||||
FN.ChannelStat.DirectVisitCount = "directVisitCount"
|
||||
FN.ChannelStat.FissionAmount = "fissionAmount"
|
||||
FN.ChannelStat.FissionAmountCount = "fissionAmountCount"
|
||||
FN.ChannelStat.FissionVisitCount = "fissionVisitCount"
|
||||
FN.ChannelStat.GameRechageAmount = "gameRechageAmount"
|
||||
FN.ChannelStat.GameWithdrawAmount = "gameWithdrawAmount"
|
||||
FN.ChannelStat.H5Amount = "h5Amount"
|
||||
FN.ChannelStat.H5AmountCount = "h5AmountCount"
|
||||
FN.ChannelStat.H5AndroidVisitCount = "h5AndroidVisitCount"
|
||||
FN.ChannelStat.H5IosVisitCount = "h5IosVisitCount"
|
||||
FN.ChannelStat.H5PcVisitCount = "h5PcVisitCount"
|
||||
FN.ChannelStat.H5VisitCount = "h5VisitCount"
|
||||
FN.ChannelStat.ID = "_id"
|
||||
FN.ChannelStat.IncomeAmount = "IncomeAmount"
|
||||
FN.ChannelStat.IncomeRate = "incomeRate"
|
||||
FN.ChannelStat.IosAmount = "iosAmount"
|
||||
FN.ChannelStat.IosAmountCount = "iosAmountCount"
|
||||
FN.ChannelStat.IosVisitCount = "iosVisitCount"
|
||||
FN.ChannelStat.IsPay = "isPay"
|
||||
FN.ChannelStat.LandPageVisitCount = "landPageVisitCount"
|
||||
FN.ChannelStat.LandpageAndroidClick = "landpageAndroidClick"
|
||||
FN.ChannelStat.LandpageIosAppstoreClick = "landpageIosAppstoreClick"
|
||||
FN.ChannelStat.LandpageIosAthorClick = "landpageIosAthorClick"
|
||||
FN.ChannelStat.LandpageIosH5Click = "landpageIosH5Click"
|
||||
FN.ChannelStat.LightAmount = "lightAmount"
|
||||
FN.ChannelStat.LightAmountCount = "lightAmountCount"
|
||||
FN.ChannelStat.LightDeductionAmount = "lightDeductionAmount"
|
||||
FN.ChannelStat.LightDeductionAmountCount = "lightDeductionAmountCount"
|
||||
FN.ChannelStat.LightDirectAmount = "lightDirectAmount"
|
||||
FN.ChannelStat.LightDirectAmountCount = "lightDirectAmountCount"
|
||||
FN.ChannelStat.LightFissionAmount = "lightFissionAmount"
|
||||
FN.ChannelStat.LightFissionAmountCount = "lightFissionAmountCount"
|
||||
FN.ChannelStat.LightNaturalAmount = "lightNaturalAmount"
|
||||
FN.ChannelStat.LightNaturalAmountCount = "lightNaturalAmountCount"
|
||||
FN.ChannelStat.LightVisitCount = "lightVisitCount"
|
||||
FN.ChannelStat.LightVisitDeductionCount = "lightVisitDeductionCount"
|
||||
FN.ChannelStat.LightVisitDirectCount = "lightVisitDirectCount"
|
||||
FN.ChannelStat.LightVisitFissionCount = "lightVisitFissionCount"
|
||||
FN.ChannelStat.LightVisitNaturalCount = "lightVisitNaturalCount"
|
||||
FN.ChannelStat.NaturalAmount = "naturalAmount"
|
||||
FN.ChannelStat.NaturalAmountCount = "naturalAmountCount"
|
||||
FN.ChannelStat.NewAndroidCount = "newAndroidCount"
|
||||
FN.ChannelStat.NewAndroidDeductionCount = "newAndroidDeductionCount"
|
||||
FN.ChannelStat.NewAndroidDirectCount = "newAndroidDirectCount"
|
||||
FN.ChannelStat.NewAndroidFissionCount = "newAndroidFissionCount"
|
||||
FN.ChannelStat.NewDeductionCount = "newDeductionCount"
|
||||
FN.ChannelStat.NewDirectCount = "newDirectCount"
|
||||
FN.ChannelStat.NewFissionCount = "newFissionCount"
|
||||
FN.ChannelStat.NewH5AndroidCount = "newH5AndroidCount"
|
||||
FN.ChannelStat.NewH5Count = "newH5Count"
|
||||
FN.ChannelStat.NewH5DeductionCount = "newH5DeductionCount"
|
||||
FN.ChannelStat.NewH5DirectCount = "newH5DirectCount"
|
||||
FN.ChannelStat.NewH5FissionCount = "newH5FissionCount"
|
||||
FN.ChannelStat.NewH5FormalCount = "newH5FormalCount"
|
||||
FN.ChannelStat.NewH5FormalDeductionCount = "newH5FormalDeductionCount"
|
||||
FN.ChannelStat.NewH5FormalDirectCount = "newH5FormalDirectCount"
|
||||
FN.ChannelStat.NewH5FormalFissionCount = "newH5FormalFissionCount"
|
||||
FN.ChannelStat.NewH5IosCount = "newH5IosCount"
|
||||
FN.ChannelStat.NewH5PcCount = "newH5PcCount"
|
||||
FN.ChannelStat.NewIosCount = "newIosCount"
|
||||
FN.ChannelStat.NewIosDeductionCount = "newIosDeductionCount"
|
||||
FN.ChannelStat.NewIosDirectCount = "newIosDirectCount"
|
||||
FN.ChannelStat.NewIosFissionCount = "newIosFissionCount"
|
||||
FN.ChannelStat.NewLightCount = "newLightCount"
|
||||
FN.ChannelStat.NewLightDeductionCount = "newLightDeductionCount"
|
||||
FN.ChannelStat.NewLightDirectCount = "newLightDirectCount"
|
||||
FN.ChannelStat.NewLightFissionCount = "newLightFissionCount"
|
||||
FN.ChannelStat.NewLightFormalCount = "newLightFormalCount"
|
||||
FN.ChannelStat.NewLightFormalDeductionCount = "newLightFormalDeductionCount"
|
||||
FN.ChannelStat.NewLightFormalDirectCount = "newLightFormalDirectCount"
|
||||
FN.ChannelStat.NewLightFormalFissionCount = "newLightFormalFissionCount"
|
||||
FN.ChannelStat.NewLightGuestCount = "newLightGuestCount"
|
||||
FN.ChannelStat.NewLightGuestDeductionCount = "newLightGuestDeductionCount"
|
||||
FN.ChannelStat.NewLightGuestDirectCount = "newLightGuestDirectCount"
|
||||
FN.ChannelStat.NewLightGuestFissionCount = "newLightGuestFissionCount"
|
||||
FN.ChannelStat.NewLightNaturalCount = "newLightNaturalCount"
|
||||
FN.ChannelStat.NewRechargeAmount = "newRechargeAmount"
|
||||
FN.ChannelStat.NewTotalCount = "newTotalCount"
|
||||
FN.ChannelStat.NewTotalIpCount = "newTotalIpCount"
|
||||
FN.ChannelStat.ParentChannel = "parentChannel"
|
||||
FN.ChannelStat.PromoteMode = "promoteMode"
|
||||
FN.ChannelStat.Settlement = "settlement"
|
||||
FN.ChannelStat.SumDate = "sumDate"
|
||||
FN.ChannelStat.TotalAmount = "totalAmount"
|
||||
FN.ChannelStat.TotalVisitCount = "totalVisitCount"
|
||||
FN.ChannelStat.Type = "type"
|
||||
FN.ChannelStat.UpdatedAt = "updatedAt"
|
||||
FN.ChannelStat.UserName = "userName"
|
||||
FN.ChannelStat.ValidDeductionCount = "validDeductionCount"
|
||||
FN.ChannelStat.ValidDirectCount = "validDirectCount"
|
||||
FN.ChannelStat.ValidPayCoin = "validPayCoin"
|
||||
FN.ChannelStat.ValidPayMoney = "validPayMoney"
|
||||
FN.ChannelStat.VipPayCoin = "vipPayCoin"
|
||||
FN.ChannelStat.VipPayDeduction = "vipPayDeduction"
|
||||
FN.ChannelStat.VipPayMoney = "vipPayMoney"
|
||||
FN.ChannelSettlement.AndroidAmount = "androidAmount"
|
||||
FN.ChannelSettlement.AndroidAmountCount = "androidAmountCount"
|
||||
FN.ChannelSettlement.AndroidVisitCount = "androidVisitCount"
|
||||
FN.ChannelSettlement.AppId = "appId"
|
||||
FN.ChannelSettlement.AppType = "appType"
|
||||
FN.ChannelSettlement.Channel = "channel"
|
||||
FN.ChannelSettlement.CreatedAt = "createdAt"
|
||||
FN.ChannelSettlement.DeductionAmount = "deductionAmount"
|
||||
FN.ChannelSettlement.DeductionAmountCount = "deductionAmountCount"
|
||||
FN.ChannelSettlement.DirectAmount = "directAmount"
|
||||
FN.ChannelSettlement.DirectAmountCount = "directAmountCount"
|
||||
FN.ChannelSettlement.DirectVisitCount = "directVisitCount"
|
||||
FN.ChannelSettlement.FissionAmount = "fissionAmount"
|
||||
FN.ChannelSettlement.FissionAmountCount = "fissionAmountCount"
|
||||
FN.ChannelSettlement.FissionVisitCount = "fissionVisitCount"
|
||||
FN.ChannelSettlement.GameRechageAmount = "gameRechageAmount"
|
||||
FN.ChannelSettlement.GameWithdrawAmount = "gameWithdrawAmount"
|
||||
FN.ChannelSettlement.H5Amount = "h5Amount"
|
||||
FN.ChannelSettlement.H5AmountCount = "h5AmountCount"
|
||||
FN.ChannelSettlement.H5AndroidVisitCount = "h5AndroidVisitCount"
|
||||
FN.ChannelSettlement.H5IosVisitCount = "h5IosVisitCount"
|
||||
FN.ChannelSettlement.H5PcVisitCount = "h5PcVisitCount"
|
||||
FN.ChannelSettlement.H5VisitCount = "h5VisitCount"
|
||||
FN.ChannelSettlement.ID = "_id"
|
||||
FN.ChannelSettlement.IosAmount = "iosAmount"
|
||||
FN.ChannelSettlement.IosAmountCount = "iosAmountCount"
|
||||
FN.ChannelSettlement.IosVisitCount = "iosVisitCount"
|
||||
FN.ChannelSettlement.LandPageVisitCount = "landPageVisitCount"
|
||||
FN.ChannelSettlement.LandpageAndroidClick = "landpageAndroidClick"
|
||||
FN.ChannelSettlement.LandpageIosAppstoreClick = "landpageIosAppstoreClick"
|
||||
FN.ChannelSettlement.LandpageIosAthorClick = "landpageIosAthorClick"
|
||||
FN.ChannelSettlement.LandpageIosH5Click = "landpageIosH5Click"
|
||||
FN.ChannelSettlement.LightAmount = "lightAmount"
|
||||
FN.ChannelSettlement.LightAmountCount = "lightAmountCount"
|
||||
FN.ChannelSettlement.LightDeductionAmount = "lightDeductionAmount"
|
||||
FN.ChannelSettlement.LightDeductionAmountCount = "lightDeductionAmountCount"
|
||||
FN.ChannelSettlement.LightDirectAmount = "lightDirectAmount"
|
||||
FN.ChannelSettlement.LightDirectAmountCount = "lightDirectAmountCount"
|
||||
FN.ChannelSettlement.LightFissionAmount = "lightFissionAmount"
|
||||
FN.ChannelSettlement.LightFissionAmountCount = "lightFissionAmountCount"
|
||||
FN.ChannelSettlement.LightNaturalAmount = "lightNaturalAmount"
|
||||
FN.ChannelSettlement.LightNaturalAmountCount = "lightNaturalAmountCount"
|
||||
FN.ChannelSettlement.LightVisitCount = "lightVisitCount"
|
||||
FN.ChannelSettlement.LightVisitDeductionCount = "lightVisitDeductionCount"
|
||||
FN.ChannelSettlement.LightVisitDirectCount = "lightVisitDirectCount"
|
||||
FN.ChannelSettlement.LightVisitFissionCount = "lightVisitFissionCount"
|
||||
FN.ChannelSettlement.LightVisitNaturalCount = "lightVisitNaturalCount"
|
||||
FN.ChannelSettlement.NaturalAmount = "naturalAmount"
|
||||
FN.ChannelSettlement.NaturalAmountCount = "naturalAmountCount"
|
||||
FN.ChannelSettlement.NewAndroidCount = "newAndroidCount"
|
||||
FN.ChannelSettlement.NewAndroidDeductionCount = "newAndroidDeductionCount"
|
||||
FN.ChannelSettlement.NewAndroidDirectCount = "newAndroidDirectCount"
|
||||
FN.ChannelSettlement.NewAndroidFissionCount = "newAndroidFissionCount"
|
||||
FN.ChannelSettlement.NewDeductionCount = "newDeductionCount"
|
||||
FN.ChannelSettlement.NewDirectCount = "newDirectCount"
|
||||
FN.ChannelSettlement.NewFissionCount = "newFissionCount"
|
||||
FN.ChannelSettlement.NewH5AndroidCount = "newH5AndroidCount"
|
||||
FN.ChannelSettlement.NewH5Count = "newH5Count"
|
||||
FN.ChannelSettlement.NewH5DeductionCount = "newH5DeductionCount"
|
||||
FN.ChannelSettlement.NewH5DirectCount = "newH5DirectCount"
|
||||
FN.ChannelSettlement.NewH5FissionCount = "newH5FissionCount"
|
||||
FN.ChannelSettlement.NewH5FormalCount = "newH5FormalCount"
|
||||
FN.ChannelSettlement.NewH5FormalDeductionCount = "newH5FormalDeductionCount"
|
||||
FN.ChannelSettlement.NewH5FormalDirectCount = "newH5FormalDirectCount"
|
||||
FN.ChannelSettlement.NewH5FormalFissionCount = "newH5FormalFissionCount"
|
||||
FN.ChannelSettlement.NewH5IosCount = "newH5IosCount"
|
||||
FN.ChannelSettlement.NewH5PcCount = "newH5PcCount"
|
||||
FN.ChannelSettlement.NewIosCount = "newIosCount"
|
||||
FN.ChannelSettlement.NewIosDeductionCount = "newIosDeductionCount"
|
||||
FN.ChannelSettlement.NewIosDirectCount = "newIosDirectCount"
|
||||
FN.ChannelSettlement.NewIosFissionCount = "newIosFissionCount"
|
||||
FN.ChannelSettlement.NewLightCount = "newLightCount"
|
||||
FN.ChannelSettlement.NewLightDeductionCount = "newLightDeductionCount"
|
||||
FN.ChannelSettlement.NewLightDirectCount = "newLightDirectCount"
|
||||
FN.ChannelSettlement.NewLightFissionCount = "newLightFissionCount"
|
||||
FN.ChannelSettlement.NewLightFormalCount = "newLightFormalCount"
|
||||
FN.ChannelSettlement.NewLightFormalDeductionCount = "newLightFormalDeductionCount"
|
||||
FN.ChannelSettlement.NewLightFormalDirectCount = "newLightFormalDirectCount"
|
||||
FN.ChannelSettlement.NewLightFormalFissionCount = "newLightFormalFissionCount"
|
||||
FN.ChannelSettlement.NewLightGuestCount = "newLightGuestCount"
|
||||
FN.ChannelSettlement.NewLightGuestDeductionCount = "newLightGuestDeductionCount"
|
||||
FN.ChannelSettlement.NewLightGuestDirectCount = "newLightGuestDirectCount"
|
||||
FN.ChannelSettlement.NewLightGuestFissionCount = "newLightGuestFissionCount"
|
||||
FN.ChannelSettlement.NewLightNaturalCount = "newLightNaturalCount"
|
||||
FN.ChannelSettlement.NewRechargeAmount = "newRechargeAmount"
|
||||
FN.ChannelSettlement.NewTotalCount = "newTotalCount"
|
||||
FN.ChannelSettlement.NewTotalIpCount = "newTotalIpCount"
|
||||
FN.ChannelSettlement.ParentChannel = "parentChannel"
|
||||
FN.ChannelSettlement.PromoteMode = "promoteMode"
|
||||
FN.ChannelSettlement.SumDate = "sumDate"
|
||||
FN.ChannelSettlement.TotalAmount = "totalAmount"
|
||||
FN.ChannelSettlement.TotalVisitCount = "totalVisitCount"
|
||||
FN.ChannelSettlement.Type = "type"
|
||||
FN.ChannelSettlement.UpdatedAt = "updatedAt"
|
||||
FN.ChannelSettlement.UserName = "userName"
|
||||
FN.ChannelSettlement.ValidDeductionCount = "validDeductionCount"
|
||||
FN.ChannelSettlement.ValidDirectCount = "validDirectCount"
|
||||
FN.ChannelSettlement.ValidPayCoin = "validPayCoin"
|
||||
FN.ChannelSettlement.ValidPayMoney = "validPayMoney"
|
||||
FN.ChannelSettlement.VipPayCoin = "vipPayCoin"
|
||||
FN.ChannelSettlement.VipPayDeduction = "vipPayDeduction"
|
||||
FN.ChannelSettlement.VipPayMoney = "vipPayMoney"
|
||||
FN.ChannelStatYestoday.AndroidRechargeAmount = "androidRechargeAmount"
|
||||
FN.ChannelStatYestoday.AppId = "appId"
|
||||
FN.ChannelStatYestoday.Channel = "channel"
|
||||
FN.ChannelStatYestoday.CreatedAt = "createdAt"
|
||||
FN.ChannelStatYestoday.DirectAmount = "directAmount"
|
||||
FN.ChannelStatYestoday.FissionAmount = "fissionAmount"
|
||||
FN.ChannelStatYestoday.H5RechargeAmount = "h5RechargeAmount"
|
||||
FN.ChannelStatYestoday.ID = "_id"
|
||||
FN.ChannelStatYestoday.IosRechargeAmount = "iosRechargeAmount"
|
||||
FN.ChannelStatYestoday.LightRechargeAmount = "lightRechargeAmount"
|
||||
FN.ChannelStatYestoday.NewAndroidCount = "newAndroidCount"
|
||||
FN.ChannelStatYestoday.NewCount = "newCount"
|
||||
FN.ChannelStatYestoday.NewDirectCount = "newDirectCount"
|
||||
FN.ChannelStatYestoday.NewFissionCount = "newFissionCount"
|
||||
FN.ChannelStatYestoday.NewH5Count = "newH5Count"
|
||||
FN.ChannelStatYestoday.NewH5FormalCount = "newH5FormalCount"
|
||||
FN.ChannelStatYestoday.NewIncreaseCount = "newIncreaseCount"
|
||||
FN.ChannelStatYestoday.NewIncreaseRate = "newIncreaseRate"
|
||||
FN.ChannelStatYestoday.NewIosCount = "newIosCount"
|
||||
FN.ChannelStatYestoday.NewLightFormalCount = "newLightFormalCount"
|
||||
FN.ChannelStatYestoday.NewLightGuestCount = "newLightGuestCount"
|
||||
FN.ChannelStatYestoday.ParentChannel = "parentChannel"
|
||||
FN.ChannelStatYestoday.RechargeAmount = "rechargeAmount"
|
||||
FN.ChannelStatYestoday.RechargeIncreaseAmount = "rechargeIncreaseAmount"
|
||||
FN.ChannelStatYestoday.RechargeIncreaseRate = "rechargeIncreaseRate"
|
||||
FN.ChannelStatYestoday.Settlement = "settlement"
|
||||
FN.ChannelStatYestoday.SumDate = "sumDate"
|
||||
FN.ChannelStatYestoday.UpdatedAt = "updatedAt"
|
||||
FN.ChannelStatYestoday.VipPayCoin = "vipPayCoin"
|
||||
FN.ChannelStatYestoday.VipPayDeduction = "vipPayDeduction"
|
||||
FN.ChannelStatYestoday.VipPayMoney = "vipPayMoney"
|
||||
FN.ChannelOwnerChange.Channel = "channel"
|
||||
FN.ChannelOwnerChange.CreatedAt = "createdAt"
|
||||
FN.ChannelOwnerChange.Account = "account"
|
||||
FN.ChannelOwnerChange.ID = "_id"
|
||||
FN.ChannelOwnerChange.Mark = "mark"
|
||||
FN.ChannelOwnerChange.NewUser = "newUser"
|
||||
FN.ChannelOwnerChange.OldUser = "oldUser"
|
||||
FN.ChannelOwnerChange.Operator = "operator"
|
||||
FN.ChannelOwnerChange.UpdatedAt = "updatedAt"
|
||||
TN.ChannelInfo = "channel_info"
|
||||
TN.ChannelDeductionRule = "channel_app_deduction"
|
||||
TN.ChannelStat = "channel_stat"
|
||||
TN.ChannelSettlement = "channel_settlement_bak"
|
||||
TN.ChannelStatYestoday = "channel_stat_yestoday"
|
||||
TN.ChannelOwnerChange = "channel_owner_change"
|
||||
}
|
||||
@@ -0,0 +1,596 @@
|
||||
package channelmod
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
)
|
||||
|
||||
const (
|
||||
OfficialChannelName = "官方"
|
||||
OfficialChannelDisplayName = "zilai"
|
||||
)
|
||||
|
||||
var (
|
||||
officialChannelNames = []string{OfficialChannelName, OfficialChannelDisplayName}
|
||||
)
|
||||
|
||||
// 官方渠道
|
||||
func IsOfficialChannelName(name string) bool {
|
||||
for _, value := range officialChannelNames {
|
||||
if value == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 官方渠道 或 无渠道码
|
||||
func IsOfficialChannelOrEmpty(name string) bool {
|
||||
name = strings.TrimSpace(name)
|
||||
if name == "" {
|
||||
return true
|
||||
}
|
||||
for _, value := range officialChannelNames {
|
||||
if value == name {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ChannelDisplayName(name string) string {
|
||||
if name == OfficialChannelName {
|
||||
return OfficialChannelDisplayName
|
||||
}
|
||||
return name
|
||||
}
|
||||
|
||||
// 结算方式
|
||||
type SettlementWay string
|
||||
|
||||
const (
|
||||
SettlementCPA SettlementWay = "cpa"
|
||||
SettlementCPS SettlementWay = "cps"
|
||||
SettlementCPT SettlementWay = "cpt"
|
||||
SettlementCPC SettlementWay = "cpc"
|
||||
SettlementHZ SettlementWay = "hz" //下载站
|
||||
)
|
||||
|
||||
type ChannelType int32
|
||||
|
||||
const (
|
||||
ChannelTypeNone ChannelType = 0 // 无
|
||||
ChannelTypeParent ChannelType = 1 // 一级
|
||||
ChannelTypeSecond ChannelType = 2 // 二级
|
||||
ChannelTypeThird ChannelType = 3 // 三级
|
||||
ChannelTypeForth ChannelType = 4 // 四级
|
||||
ChannelTypeEnd ChannelType = 10 // End
|
||||
)
|
||||
|
||||
type ChannelTypeList []ChannelType
|
||||
|
||||
type AppType int32
|
||||
|
||||
const (
|
||||
AppTypeNone AppType = 0 // 所有
|
||||
AppTypePkg AppType = 1 // 安装包
|
||||
AppTypeLight AppType = 2 // 轻量版
|
||||
AppTypeH5 AppType = 3 // H5网页
|
||||
)
|
||||
|
||||
type PromoteMode int32
|
||||
|
||||
const (
|
||||
PromoteModeNone PromoteMode = 0 // 所有
|
||||
PromoteModeInstall PromoteMode = 1 // 安装
|
||||
PromoteModeRegister PromoteMode = 2 // 注册
|
||||
)
|
||||
|
||||
func GetChildChannelTypes() ChannelTypeList {
|
||||
ret := make([]ChannelType, 0)
|
||||
for i := ChannelTypeParent + 1; i < ChannelTypeEnd; i++ {
|
||||
ret = append(ret, i)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func GetAllChannelTypes() ChannelTypeList {
|
||||
ret := make([]ChannelType, 0)
|
||||
for i := ChannelTypeParent; i < ChannelTypeEnd; i++ {
|
||||
ret = append(ret, i)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (l ChannelTypeList) Include(value ChannelType) bool {
|
||||
for _, ct := range l {
|
||||
if ct == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Wallet struct {
|
||||
Addr1 string `json:"addr1" bson:"addr1"` // 钱包地址1
|
||||
Addr2 string `json:"addr2" bson:"addr2"` // 钱包地址2
|
||||
}
|
||||
|
||||
// 渠道-代理商
|
||||
// @table:channel_info
|
||||
type ChannelInfo struct {
|
||||
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` // ID
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
AppIds []int32 `bson:"appIds" json:"appIds"` // 渠道对应的app
|
||||
UserName string `bson:"userName" json:"userName"` // 所有者
|
||||
ParentChannel string `bson:"parentChannel" json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
|
||||
ParentAgent string `bson:"parentAgent" json:"parentAgent"` // 父代理 (从二级的子代理开始用ParentAgent描述父子关系)
|
||||
ChildCount int64 `bson:"childCount" json:"childCount"` // 子渠道数量
|
||||
Password string `bson:"password" json:"password"` // 代理商密码
|
||||
IP string `bson:"ip" json:"ip"` // ip
|
||||
Token string `bson:"token" json:"token"` // token
|
||||
CheckTokenTime time.Time `bson:"checkTokenTime" json:"checkTokenTime"` // 检查Token的时间
|
||||
Status bool `bson:"status" json:"status"` // 状态 开/关
|
||||
Mobile string `bson:"mobile" json:"mobile"` // 手机号
|
||||
Type ChannelType `bson:"type" json:"type"` // 渠道类型:1 一级 2:二级
|
||||
Remark string `bson:"remark" json:"remark"` // 备注
|
||||
Lock bool `bson:"lock" json:"lock"` // 禁止登陆
|
||||
Wallet Wallet `bson:"wallet" json:"wallet"` // 钱包地址
|
||||
AutoGenApk bool `bson:"autoGenApk" json:"autoGenApk"` // 自动生成渠道包
|
||||
ShowMagic int32 `bson:"showMagic" json:"showMagic"` // 正常显示数据 n>0 展示空白数据
|
||||
ChildShowDivideRate bool `bson:"childShowDivideRate" json:"childShowDivideRate"` // 下级是否显示分成比例
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
type ChannelInfoList []*ChannelInfo
|
||||
|
||||
// @table:channel_app_deduction
|
||||
type ChannelDeductionRule struct {
|
||||
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` // ID
|
||||
AppId int32 `bson:"appId" json:"appId"` // 应用ID
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
AppName string `bson:"appName" json:"appName"` // 应用名称
|
||||
AppType AppType `bson:"appType" json:"appType"` // 应用类型
|
||||
PromoteMode PromoteMode `bson:"promoteMode" json:"promoteMode"` // 推广类型
|
||||
Settlement SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
First int32 `bson:"first" json:"first"` // 一阶
|
||||
Second int32 `bson:"second" json:"second"` // 二阶
|
||||
Third int32 `bson:"third" json:"third"` // 三阶
|
||||
Fourth int32 `bson:"fourth" json:"fourth"` // 四阶
|
||||
Fifth int32 `bson:"fifth" json:"fifth"` // 5阶
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
CPSBegin int64 `bson:"cpsBegin" json:"cpsBegin"` // CPS 开始扣量金额
|
||||
CPSDeductionRate int64 `bson:"cpsDeductionRate" json:"cpsDeductionRate"` // CPS 扣量比例
|
||||
BeginTime time.Time `bson:"deductionAt" json:"deductionAt"` // 扣量开始时间
|
||||
SettlementTime time.Time `bson:"settlementTime" json:"settlementTime"` // 扣量结算时间
|
||||
TodayTime time.Time `bson:"todayTime" json:"todayTime"` // 当日时间
|
||||
TodayDeduction int64 `bson:"todayDeduction" json:"todayDeduction"` // 当日扣量金额
|
||||
LandingPage string `bson:"landingPage" json:"landingPage"` // 落地页
|
||||
ProxyDeduction int64 `bson:"proxyDeduction" json:"proxyDeduction"` // 代理扣量比例
|
||||
AutoDeduction bool `bson:"autoDeduction" json:"autoDeduction"` // 自动扣量开关
|
||||
DivideRate int64 `bson:"divideRate" json:"divideRate"` // 代理分成比例
|
||||
LessIncomeRate float64 `bson:"lessIncomeRate" json:"lessIncomeRate"` // 最低收益比 CPA低于该值开启扣量(0.1 - 3.0)
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
type ChannelDeductionRuleList []*ChannelDeductionRule
|
||||
|
||||
// 渠道每日统计
|
||||
// @table:channel_stat
|
||||
type ChannelStat struct {
|
||||
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` // ID
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间 15分钟对齐
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
Type ChannelType `bson:"type" json:"type"` // 渠道类型:1 一级 2:二级
|
||||
Settlement SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
CPAPrice int64 `bson:"cpaPrice" json:"cpaPrice"` // 单价
|
||||
CPSRate int64 `bson:"cpsRate" json:"cpsRate"` // CPS 分成比列 0-100
|
||||
AppType AppType `bson:"appType" json:"appType"` // 应用类型
|
||||
PromoteMode PromoteMode `bson:"promoteMode" json:"promoteMode"` // 推广类型
|
||||
UserName string `bson:"userName" json:"userName"` // 所有者
|
||||
ParentChannel string `bson:"parentChannel" json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
|
||||
// 收益及结算
|
||||
ValidDirectCount int64 `bson:"validDirectCount,omitempty" json:"validDirectCount"` // 有效直推总数
|
||||
ValidDeductionCount int64 `bson:"validDeductionCount,omitempty" json:"validDeductionCount"` // 有效扣量总数
|
||||
ValidPayMoney int64 `bson:"validPayMoney,omitempty" json:"validPayMoney"` // 有效收益金额
|
||||
ValidPayCoin int64 `bson:"validPayCoin,omitempty" json:"validPayCoin"` // 有效收益金币金额
|
||||
IncomeAmount int64 `bson:"IncomeAmount,omitempty" json:"IncomeAmount"` // 收益估算
|
||||
IncomeRate float64 `bson:"incomeRate,omitempty" json:"incomeRate"` // 收益比
|
||||
IsPay bool `bson:"isPay,omitempty" json:"isPay"` // 是否已结算
|
||||
// 注册
|
||||
NewTotalIpCount int64 `bson:"newTotalIpCount,omitempty" json:"newTotalIpCount"` // 新增IP总量
|
||||
NewTotalCount int64 `bson:"newTotalCount,omitempty" json:"newTotalCount"` // **新增总量
|
||||
NewDirectCount int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `bson:"newFissionCount,omitempty" json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount int64 `bson:"newDeductionCount,omitempty" json:"newDeductionCount"` // 新增扣量
|
||||
NewAndroidCount int64 `bson:"newAndroidCount,omitempty" json:"newAndroidCount"` // android新增
|
||||
NewAndroidDirectCount int64 `bson:"newAndroidDirectCount,omitempty" json:"newAndroidDirectCount"` // 新增安卓直推
|
||||
NewAndroidFissionCount int64 `bson:"newAndroidFissionCount,omitempty" json:"newAndroidFissionCount"` // 新增安卓裂变
|
||||
NewAndroidDeductionCount int64 `bson:"newAndroidDeductionCount,omitempty" json:"newAndroidDeductionCount"` // 新增安卓扣量
|
||||
NewIosCount int64 `bson:"newIosCount,omitempty" json:"newIosCount"` // ios新增
|
||||
NewIosDirectCount int64 `bson:"newIosDirectCount,omitempty" json:"newIosDirectCount"` // 新增IOS直推
|
||||
NewIosFissionCount int64 `bson:"newIosFissionCount,omitempty" json:"newIosFissionCount"` // 新增IOS裂变
|
||||
NewIosDeductionCount int64 `bson:"newIosDeductionCount,omitempty" json:"newIosDeductionCount"` // 新增IOS扣量
|
||||
NewLightCount int64 `bson:"newLightCount,omitempty" json:"newLightCount"` // light新增
|
||||
NewLightGuestCount int64 `bson:"newLightGuestCount,omitempty" json:"newLightGuestCount"` // **轻量安装
|
||||
NewLightGuestDirectCount int64 `bson:"newLightGuestDirectCount,omitempty" json:"newLightGuestDirectCount"` // 新增LightGuest直推
|
||||
NewLightGuestFissionCount int64 `bson:"newLightGuestFissionCount,omitempty" json:"newLightGuestFissionCount"` // 新增LightGuest裂变
|
||||
NewLightGuestDeductionCount int64 `bson:"newLightGuestDeductionCount,omitempty" json:"newLightGuestDeductionCount"` // 新增LightGuest扣量
|
||||
NewLightFormalCount int64 `bson:"newLightFormalCount,omitempty" json:"newLightFormalCount"` // **轻量注册
|
||||
NewLightFormalDirectCount int64 `bson:"newLightFormalDirectCount,omitempty" json:"newLightFormalDirectCount"` // 新增LightFormal直推
|
||||
NewLightFormalFissionCount int64 `bson:"newLightFormalFissionCount,omitempty" json:"newLightFormalFissionCount"` // 新增LightFormal裂变
|
||||
NewLightFormalDeductionCount int64 `bson:"newLightFormalDeductionCount,omitempty" json:"newLightFormalDeductionCount"` // 新增LightFormal扣量
|
||||
NewLightDirectCount int64 `bson:"newLightDirectCount,omitempty" json:"newLightDirectCount"` // light新增直推
|
||||
NewLightFissionCount int64 `bson:"newLightFissionCount,omitempty" json:"newLightFissionCount"` // light新增裂变
|
||||
NewLightDeductionCount int64 `bson:"newLightDeductionCount,omitempty" json:"newLightDeductionCount"` // light新增扣量
|
||||
NewLightNaturalCount int64 `bson:"newLightNaturalCount,omitempty" json:"newLightNaturalCount"` // light自然新增
|
||||
NewH5Count int64 `bson:"newH5Count,omitempty" json:"newH5Count"` // h5新增
|
||||
NewH5DirectCount int64 `bson:"newH5DirectCount,omitempty" json:"newH5DirectCount"` // 新增H5直推
|
||||
NewH5FissionCount int64 `bson:"newH5FissionCount,omitempty" json:"newH5FissionCount"` // 新增H5裂变
|
||||
NewH5DeductionCount int64 `bson:"newH5DeductionCount,omitempty" json:"newH5DeductionCount"` // 新增H5扣量
|
||||
NewH5AndroidCount int64 `bson:"newH5AndroidCount,omitempty" json:"newH5AndroidCount"` // h5安卓新增
|
||||
NewH5IosCount int64 `bson:"newH5IosCount,omitempty" json:"newH5IosCount"` // h5苹果新增
|
||||
NewH5PcCount int64 `bson:"newH5PcCount,omitempty" json:"newH5PcCount"` // h5电脑新增
|
||||
NewH5FormalCount int64 `bson:"newH5FormalCount,omitempty" json:"newH5FormalCount"` // h5注册新增
|
||||
NewH5FormalDirectCount int64 `bson:"newH5FormalDirectCount,omitempty" json:"newH5FormalDirectCount"` // 新增H5正式直推
|
||||
NewH5FormalFissionCount int64 `bson:"newH5FormalFissionCount,omitempty" json:"newH5FormalFissionCount"` // 新增H5正式裂变
|
||||
NewH5FormalDeductionCount int64 `bson:"newH5FormalDeductionCount,omitempty" json:"newH5FormalDeductionCount"` // 新增H5正式扣量
|
||||
// 访问
|
||||
TotalVisitCount int64 `bson:"totalVisitCount,omitempty" json:"totalVisitCount"` // **总计访问数
|
||||
DirectVisitCount int64 `bson:"directVisitCount,omitempty" json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `bson:"fissionVisitCount,omitempty" json:"fissionVisitCount"` // 裂变访问数
|
||||
AndroidVisitCount int64 `bson:"androidVisitCount,omitempty" json:"androidVisitCount"` // android访问
|
||||
IosVisitCount int64 `bson:"iosVisitCount,omitempty" json:"iosVisitCount"` // ios访问
|
||||
LightVisitCount int64 `bson:"lightVisitCount,omitempty" json:"lightVisitCount"` // **轻量访问
|
||||
LightVisitDirectCount int64 `bson:"lightVisitDirectCount,omitempty" json:"lightVisitDirectCount"` // light访问量直推
|
||||
LightVisitFissionCount int64 `bson:"lightVisitFissionCount,omitempty" json:"lightVisitFissionCount"` // light访问量裂变
|
||||
LightVisitDeductionCount int64 `bson:"lightVisitDeductionCount,omitempty" json:"lightVisitDeductionCount"` // light访问量扣量
|
||||
LightVisitNaturalCount int64 `bson:"lightVisitNaturalCount,omitempty" json:"lightVisitNaturalCount"` // light访问量自然
|
||||
H5VisitCount int64 `bson:"h5VisitCount,omitempty" json:"h5VisitCount"` // h5访问
|
||||
H5AndroidVisitCount int64 `bson:"h5AndroidVisitCount,omitempty" json:"h5AndroidVisitCount"` // h5安卓访问
|
||||
H5IosVisitCount int64 `bson:"h5IosVisitCount,omitempty" json:"h5IosVisitCount"` // h5苹果访问
|
||||
H5PcVisitCount int64 `bson:"h5PcVisitCount,omitempty" json:"h5PcVisitCount"` // h5电脑访问
|
||||
// 充值统计
|
||||
TotalAmount int64 `bson:"totalAmount,omitempty" json:"totalAmount"` // **充值金额总量
|
||||
DirectAmount int64 `bson:"directAmount,omitempty" json:"directAmount"` // 直推充值金额
|
||||
DirectAmountCount int64 `bson:"directAmountCount,omitempty" json:"directAmountCount"` // 直推充值订单数
|
||||
FissionAmount int64 `bson:"fissionAmount,omitempty" json:"fissionAmount"` // 裂变充值金额
|
||||
FissionAmountCount int64 `bson:"fissionAmountCount,omitempty" json:"fissionAmountCount"` // 裂变充值订单数
|
||||
NaturalAmount int64 `bson:"naturalAmount,omitempty" json:"naturalAmount"` // 自然充值
|
||||
NaturalAmountCount int64 `bson:"naturalAmountCount,omitempty" json:"naturalAmountCount"` // 自然充值订单数
|
||||
DeductionAmount int64 `bson:"deductionAmount,omitempty" json:"deductionAmount"` // 充值扣量
|
||||
DeductionAmountCount int64 `bson:"deductionAmountCount,omitempty" json:"deductionAmountCount"` // 充值扣量次数
|
||||
AndroidAmount int64 `bson:"androidAmount,omitempty" json:"androidAmount"` // +安卓充值金额
|
||||
AndroidAmountCount int64 `bson:"androidAmountCount,omitempty" json:"androidAmountCount"` // +安卓充值次数
|
||||
IosAmount int64 `bson:"iosAmount,omitempty" json:"iosAmount"` // +Ios充值金额
|
||||
IosAmountCount int64 `bson:"iosAmountCount,omitempty" json:"iosAmountCount"` // +Ios充值次数
|
||||
H5Amount int64 `bson:"h5Amount,omitempty" json:"h5Amount"` // +H5充值金额
|
||||
H5AmountCount int64 `bson:"h5AmountCount,omitempty" json:"h5AmountCount"` // +H5充值次数
|
||||
LightAmount int64 `bson:"lightAmount,omitempty" json:"lightAmount"` // light充值金额
|
||||
LightAmountCount int64 `bson:"lightAmountCount,omitempty" json:"lightAmountCount"` // light充值次数
|
||||
LightDirectAmount int64 `bson:"lightDirectAmount,omitempty" json:"lightDirectAmount"` // light充值金额直推
|
||||
LightDirectAmountCount int64 `bson:"lightDirectAmountCount,omitempty" json:"lightDirectAmountCount"` // light充值次数直推
|
||||
LightFissionAmount int64 `bson:"lightFissionAmount,omitempty" json:"lightFissionAmount"` // light充值金额裂变
|
||||
LightFissionAmountCount int64 `bson:"lightFissionAmountCount,omitempty" json:"lightFissionAmountCount"` // light充值次数裂变
|
||||
LightDeductionAmount int64 `bson:"lightDeductionAmount,omitempty" json:"lightDeductionAmount"` // light充值金额扣量
|
||||
LightDeductionAmountCount int64 `bson:"lightDeductionAmountCount,omitempty" json:"lightDeductionAmountCount"` // light充值次数扣量
|
||||
LightNaturalAmount int64 `bson:"lightNaturalAmount,omitempty" json:"lightNaturalAmount"` // light充值金额自然
|
||||
LightNaturalAmountCount int64 `bson:"lightNaturalAmountCount,omitempty" json:"lightNaturalAmountCount"` // light充值次数自然
|
||||
// 其他充值
|
||||
NewRechargeAmount int64 `bson:"newRechargeAmount,omitempty" json:"newRechargeAmount"` // 新增充值金额
|
||||
VipPayMoney int64 `bson:"vipPayMoney,omitempty" json:"vipPayMoney"` // 购买会员金额(CPS扣量后)
|
||||
VipPayCoin int64 `bson:"vipPayCoin,omitempty" json:"vipPayCoin"` // 金币购买会员数量
|
||||
VipPayDeduction int64 `bson:"vipPayDeduction,omitempty" json:"vipPayDeduction"` // 购买会员金额(CPS扣量)
|
||||
GameRechageAmount int64 `bson:"gameRechageAmount,omitempty" json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `bson:"gameWithdrawAmount,omitempty" json:"gameWithdrawAmount"` // 游戏提现
|
||||
// 落地页访问
|
||||
LandPageVisitCount int64 `bson:"landPageVisitCount,omitempty" json:"landPageVisitCount"` // 落地页访问次数
|
||||
LandpageAndroidClick int64 `bson:"landpageAndroidClick,omitempty" json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick int64 `bson:"landpageIosAppstoreClick,omitempty" json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick int64 `bson:"landpageIosAthorClick,omitempty" json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click int64 `bson:"landpageIosH5Click,omitempty" json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
// 留存率
|
||||
Day1RetainRate float64 `bson:"day1RetainRate,omitempty" json:"day1RetainRate"` // 次日留存率
|
||||
Day3RetainRate float64 `bson:"day3RetainRate,omitempty" json:"day3RetainRate"` // 3日留存率
|
||||
Day7RetainRate float64 `bson:"day7RetainRate,omitempty" json:"day7RetainRate"` // 7日留存率
|
||||
// 时间
|
||||
UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt"` // 更新时间
|
||||
CreatedAt time.Time `bson:"createdAt" json:"createdAt"` // 创建时间
|
||||
}
|
||||
|
||||
type ChannelStatList []*ChannelStat
|
||||
|
||||
type ChannelStatDoc struct {
|
||||
// 收益及结算
|
||||
ValidDirectCount *int64 `bson:"validDirectCount,omitempty" json:"validDirectCount"` // 有效直推总数
|
||||
ValidDeductionCount *int64 `bson:"validDeductionCount,omitempty" json:"validDeductionCount"` // 有效扣量总数
|
||||
ValidPayMoney *int64 `bson:"validPayMoney,omitempty" json:"validPayMoney"` // 有效收益会员金额
|
||||
ValidPayCoin *int64 `bson:"validPayCoin,omitempty" json:"validPayCoin"` // 有效收益金币金额
|
||||
IncomeAmount *int64 `bson:"IncomeAmount,omitempty" json:"IncomeAmount"` // 收益估算
|
||||
IncomeRate *float64 `bson:"incomeRate,omitempty" json:"incomeRate"` // 收益比
|
||||
IsPay *bool `bson:"isPay,omitempty" json:"isPay"` // 是否已结算
|
||||
// 注册
|
||||
NewTotalIpCount *int64 `bson:"newTotalIpCount,omitempty" json:"newTotalIpCount"` // 新增IP总量
|
||||
NewTotalCount *int64 `bson:"newTotalCount,omitempty" json:"newTotalCount"` // **新增总量
|
||||
NewDirectCount *int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount *int64 `bson:"newFissionCount,omitempty" json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount *int64 `bson:"newDeductionCount,omitempty" json:"newDeductionCount"` // 新增扣量
|
||||
|
||||
NewAndroidCount *int64 `bson:"newAndroidCount,omitempty" json:"newAndroidCount"` // android新增
|
||||
NewAndroidDirectCount *int64 `bson:"newAndroidDirectCount,omitempty" json:"newAndroidDirectCount"` // 新增安卓直推
|
||||
NewAndroidFissionCount *int64 `bson:"newAndroidFissionCount,omitempty" json:"newAndroidFissionCount"` // 新增安卓裂变
|
||||
NewAndroidDeductionCount *int64 `bson:"newAndroidDeductionCount,omitempty" json:"newAndroidDeductionCount"` // 新增安卓扣量
|
||||
|
||||
NewIosCount *int64 `bson:"newIosCount,omitempty" json:"newIosCount"` // ios新增
|
||||
NewIosDirectCount *int64 `bson:"newIosDirectCount,omitempty" json:"newIosDirectCount"` // 新增IOS直推
|
||||
NewIosFissionCount *int64 `bson:"newIosFissionCount,omitempty" json:"newIosFissionCount"` // 新增IOS裂变
|
||||
NewIosDeductionCount *int64 `bson:"newIosDeductionCount,omitempty" json:"newIosDeductionCount"` // 新增IOS扣量
|
||||
|
||||
NewLightCount *int64 `bson:"newLightCount,omitempty" json:"newLightCount"` // light新增
|
||||
|
||||
NewLightGuestCount *int64 `bson:"newLightGuestCount,omitempty" json:"newLightGuestCount"` // **轻量安装
|
||||
NewLightGuestDirectCount *int64 `bson:"newLightGuestDirectCount,omitempty" json:"newLightGuestDirectCount"` // 新增LightGuest直推
|
||||
NewLightGuestFissionCount *int64 `bson:"newLightGuestFissionCount,omitempty" json:"newLightGuestFissionCount"` // 新增LightGuest裂变
|
||||
NewLightGuestDeductionCount *int64 `bson:"newLightGuestDeductionCount,omitempty" json:"newLightGuestDeductionCount"` // 新增LightGuest扣量
|
||||
|
||||
NewLightFormalCount *int64 `bson:"newLightFormalCount,omitempty" json:"newLightFormalCount"` // **轻量注册
|
||||
NewLightFormalDirectCount *int64 `bson:"newLightFormalDirectCount,omitempty" json:"newLightFormalDirectCount"` // 新增LightFormal直推
|
||||
NewLightFormalFissionCount *int64 `bson:"newLightFormalFissionCount,omitempty" json:"newLightFormalFissionCount"` // 新增LightFormal裂变
|
||||
NewLightFormalDeductionCount *int64 `bson:"newLightFormalDeductionCount,omitempty" json:"newLightFormalDeductionCount"` // 新增LightFormal扣量
|
||||
|
||||
NewLightDirectCount *int64 `bson:"newLightDirectCount,omitempty" json:"newLightDirectCount"` // light新增直推
|
||||
NewLightFissionCount *int64 `bson:"newLightFissionCount,omitempty" json:"newLightFissionCount"` // light新增裂变
|
||||
NewLightDeductionCount *int64 `bson:"newLightDeductionCount,omitempty" json:"newLightDeductionCount"` // light新增扣量
|
||||
NewLightNaturalCount *int64 `bson:"newLightNaturalCount,omitempty" json:"newLightNaturalCount"` // light自然新增
|
||||
NewH5Count *int64 `bson:"newH5Count,omitempty" json:"newH5Count"` // h5新增
|
||||
NewH5DirectCount *int64 `bson:"newH5DirectCount,omitempty" json:"newH5DirectCount"` // 新增H5直推
|
||||
NewH5FissionCount *int64 `bson:"newH5FissionCount,omitempty" json:"newH5FissionCount"` // 新增H5裂变
|
||||
NewH5DeductionCount *int64 `bson:"newH5DeductionCount,omitempty" json:"newH5DeductionCount"` // 新增H5扣量
|
||||
NewH5AndroidCount *int64 `bson:"newH5AndroidCount,omitempty" json:"newH5AndroidCount"` // h5安卓新增
|
||||
NewH5IosCount *int64 `bson:"newH5IosCount,omitempty" json:"newH5IosCount"` // h5苹果新增
|
||||
NewH5PcCount *int64 `bson:"newH5PcCount,omitempty" json:"newH5PcCount"` // h5电脑新增
|
||||
NewH5FormalCount *int64 `bson:"newH5FormalCount,omitempty" json:"newH5FormalCount"` // h5注册新增
|
||||
NewH5FormalDirectCount *int64 `bson:"newH5FormalDirectCount,omitempty" json:"newH5FormalDirectCount"` // 新增H5正式直推
|
||||
NewH5FormalFissionCount *int64 `bson:"newH5FormalFissionCount,omitempty" json:"newH5FormalFissionCount"` // 新增H5正式裂变
|
||||
NewH5FormalDeductionCount *int64 `bson:"newH5FormalDeductionCount,omitempty" json:"newH5FormalDeductionCount"` // 新增H5正式扣量
|
||||
// 访问
|
||||
TotalVisitCount *int64 `bson:"totalVisitCount,omitempty" json:"totalVisitCount"` // **总计访问数
|
||||
DirectVisitCount *int64 `bson:"directVisitCount,omitempty" json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount *int64 `bson:"fissionVisitCount,omitempty" json:"fissionVisitCount"` // 裂变访问数
|
||||
AndroidVisitCount *int64 `bson:"androidVisitCount,omitempty" json:"androidVisitCount"` // android访问
|
||||
IosVisitCount *int64 `bson:"iosVisitCount,omitempty" json:"iosVisitCount"` // ios访问
|
||||
LightVisitCount *int64 `bson:"lightVisitCount,omitempty" json:"lightVisitCount"` // **轻量访问
|
||||
LightVisitDirectCount *int64 `bson:"lightVisitDirectCount,omitempty" json:"lightVisitDirectCount"` // light访问量直推
|
||||
LightVisitFissionCount *int64 `bson:"lightVisitFissionCount,omitempty" json:"lightVisitFissionCount"` // light访问量裂变
|
||||
LightVisitDeductionCount *int64 `bson:"lightVisitDeductionCount,omitempty" json:"lightVisitDeductionCount"` // light访问量扣量
|
||||
LightVisitNaturalCount *int64 `bson:"lightVisitNaturalCount,omitempty" json:"lightVisitNaturalCount"` // light访问量自然
|
||||
H5VisitCount *int64 `bson:"h5VisitCount,omitempty" json:"h5VisitCount"` // h5访问
|
||||
H5AndroidVisitCount *int64 `bson:"h5AndroidVisitCount,omitempty" json:"h5AndroidVisitCount"` // h5安卓访问
|
||||
H5IosVisitCount *int64 `bson:"h5IosVisitCount,omitempty" json:"h5IosVisitCount"` // h5苹果访问
|
||||
H5PcVisitCount *int64 `bson:"h5PcVisitCount,omitempty" json:"h5PcVisitCount"` // h5电脑访问
|
||||
// 充值统计
|
||||
TotalAmount *int64 `bson:"totalAmount,omitempty" json:"totalAmount"` // **充值金额总量
|
||||
DirectAmount *int64 `bson:"directAmount,omitempty" json:"directAmount"` // 直推充值金额
|
||||
DirectAmountCount *int64 `bson:"directAmountCount,omitempty" json:"directAmountCount"` // 直推充值订单数
|
||||
FissionAmount *int64 `bson:"fissionAmount,omitempty" json:"fissionAmount"` // 裂变充值金额
|
||||
FissionAmountCount *int64 `bson:"fissionAmountCount,omitempty" json:"fissionAmountCount"` // 裂变充值订单数
|
||||
NaturalAmount *int64 `bson:"naturalAmount,omitempty" json:"naturalAmount"` // 自然充值
|
||||
NaturalAmountCount *int64 `bson:"naturalAmountCount,omitempty" json:"naturalAmountCount"` // 自然充值订单数
|
||||
DeductionAmount *int64 `bson:"deductionAmount,omitempty" json:"deductionAmount"` // 充值扣量
|
||||
DeductionAmountCount *int64 `bson:"deductionAmountCount,omitempty" json:"deductionAmountCount"` // 充值扣量次数
|
||||
AndroidAmount *int64 `bson:"androidAmount,omitempty" json:"androidAmount"` // +安卓充值金额
|
||||
AndroidAmountCount *int64 `bson:"androidAmountCount,omitempty" json:"androidAmountCount"` // +安卓充值次数
|
||||
IosAmount *int64 `bson:"iosAmount,omitempty" json:"iosAmount"` // +Ios充值金额
|
||||
IosAmountCount *int64 `bson:"iosAmountCount,omitempty" json:"iosAmountCount"` // +Ios充值次数
|
||||
H5Amount *int64 `bson:"h5Amount,omitempty" json:"h5Amount"` // +H5充值金额
|
||||
H5AmountCount *int64 `bson:"h5AmountCount,omitempty" json:"h5AmountCount"` // +H5充值次数
|
||||
LightAmount *int64 `bson:"lightAmount,omitempty" json:"lightAmount"` // light充值金额
|
||||
LightAmountCount *int64 `bson:"lightAmountCount,omitempty" json:"lightAmountCount"` // light充值次数
|
||||
LightDirectAmount *int64 `bson:"lightDirectAmount,omitempty" json:"lightDirectAmount"` // light充值金额直推
|
||||
LightDirectAmountCount *int64 `bson:"lightDirectAmountCount,omitempty" json:"lightDirectAmountCount"` // light充值次数直推
|
||||
LightFissionAmount *int64 `bson:"lightFissionAmount,omitempty" json:"lightFissionAmount"` // light充值金额裂变
|
||||
LightFissionAmountCount *int64 `bson:"lightFissionAmountCount,omitempty" json:"lightFissionAmountCount"` // light充值次数裂变
|
||||
LightDeductionAmount *int64 `bson:"lightDeductionAmount,omitempty" json:"lightDeductionAmount"` // light充值金额扣量
|
||||
LightDeductionAmountCount *int64 `bson:"lightDeductionAmountCount,omitempty" json:"lightDeductionAmountCount"` // light充值次数扣量
|
||||
LightNaturalAmount *int64 `bson:"lightNaturalAmount,omitempty" json:"lightNaturalAmount"` // light充值金额自然
|
||||
LightNaturalAmountCount *int64 `bson:"lightNaturalAmountCount,omitempty" json:"lightNaturalAmountCount"` // light充值次数自然
|
||||
// 其他充值
|
||||
NewRechargeAmount *int64 `bson:"newRechargeAmount,omitempty" json:"newRechargeAmount"` // 新增充值金额
|
||||
VipPayMoney *int64 `bson:"vipPayMoney,omitempty" json:"vipPayMoney"` // 购买会员金额(CPS扣量后)
|
||||
VipPayCoin *int64 `bson:"vipPayCoin,omitempty" json:"vipPayCoin"` // 金币购买会员数量
|
||||
VipPayDeduction *int64 `bson:"vipPayDeduction,omitempty" json:"vipPayDeduction"` // 购买会员金额(CPS扣量)
|
||||
GameRechageAmount *int64 `bson:"gameRechageAmount,omitempty" json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount *int64 `bson:"gameWithdrawAmount,omitempty" json:"gameWithdrawAmount"` // 游戏提现
|
||||
// 落地页访问
|
||||
LandPageVisitCount *int64 `bson:"landPageVisitCount,omitempty" json:"landPageVisitCount"` // 落地页访问次数
|
||||
LandpageAndroidClick *int64 `bson:"landpageAndroidClick,omitempty" json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick *int64 `bson:"landpageIosAppstoreClick,omitempty" json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick *int64 `bson:"landpageIosAthorClick,omitempty" json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click *int64 `bson:"landpageIosH5Click,omitempty" json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
// 留存率
|
||||
Day1RetainRate *float64 `bson:"day1RetainRate,omitempty" json:"day1RetainRate"` // 次日留存率
|
||||
Day3RetainRate *float64 `bson:"day3RetainRate,omitempty" json:"day3RetainRate"` // 3日留存率
|
||||
Day7RetainRate *float64 `bson:"day7RetainRate,omitempty" json:"day7RetainRate"` // 7日留存率
|
||||
// 时间
|
||||
UpdatedAt *time.Time `bson:"updatedAt,omitempty" json:"updatedAt"` // 更新时间
|
||||
}
|
||||
|
||||
// 渠道结算---每15分钟根据扣量规则结算
|
||||
// @table:channel_settlement_bak
|
||||
type ChannelSettlement struct {
|
||||
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` // ID
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间 15分钟对齐
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
AppType AppType `bson:"appType" json:"appType"` // 应用类型
|
||||
PromoteMode PromoteMode `bson:"promoteMode" json:"promoteMode"` // 推广类型
|
||||
Type ChannelType `bson:"type" json:"type"` // 渠道类型:1 一级 2:二级
|
||||
UserName string `bson:"userName" json:"userName"` // 所有者
|
||||
ParentChannel string `bson:"parentChannel" json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
|
||||
ValidDirectCount int64 `bson:"validDirectCount,omitempty" json:"validDirectCount"` // 有效直推总数
|
||||
ValidDeductionCount int64 `bson:"validDeductionCount,omitempty" json:"validDeductionCount"` // 有效扣量总数
|
||||
ValidPayMoney int64 `bson:"validPayMoney,omitempty" json:"validPayMoney"` // 有效收益会员金额
|
||||
ValidPayCoin int64 `bson:"validPayCoin,omitempty" json:"validPayCoin"` // 有效收益金币金额
|
||||
// 注册用户
|
||||
NewTotalIpCount int64 `bson:"newTotalIpCount,omitempty" json:"newTotalIpCount"` // 新增IP总量
|
||||
NewTotalCount int64 `bson:"newTotalCount,omitempty" json:"newTotalCount"` // 新增总量
|
||||
NewDirectCount int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `bson:"newFissionCount,omitempty" json:"newFissionCount"` // 新增裂变
|
||||
NewDeductionCount int64 `bson:"newDeductionCount,omitempty" json:"newDeductionCount"` // 新增扣量
|
||||
|
||||
NewAndroidCount int64 `bson:"newAndroidCount,omitempty" json:"newAndroidCount"` // android新增
|
||||
NewAndroidDirectCount int64 `bson:"newAndroidDirectCount,omitempty" json:"newAndroidDirectCount"` // 新增安卓直推
|
||||
NewAndroidFissionCount int64 `bson:"newAndroidFissionCount,omitempty" json:"newAndroidFissionCount"` // 新增安卓裂变
|
||||
NewAndroidDeductionCount int64 `bson:"newAndroidDeductionCount,omitempty" json:"newAndroidDeductionCount"` // 新增安卓扣量
|
||||
|
||||
NewIosCount int64 `bson:"newIosCount,omitempty" json:"newIosCount"` // ios新增
|
||||
NewIosDirectCount int64 `bson:"newIosDirectCount,omitempty" json:"newIosDirectCount"` // 新增IOS直推
|
||||
NewIosFissionCount int64 `bson:"newIosFissionCount,omitempty" json:"newIosFissionCount"` // 新增IOS裂变
|
||||
NewIosDeductionCount int64 `bson:"newIosDeductionCount,omitempty" json:"newIosDeductionCount"` // 新增IOS扣量
|
||||
|
||||
NewLightCount int64 `bson:"newLightCount,omitempty" json:"newLightCount"` // light新增
|
||||
NewLightDirectCount int64 `bson:"newLightDirectCount,omitempty" json:"newLightDirectCount"` // light新增直推
|
||||
NewLightFissionCount int64 `bson:"newLightFissionCount,omitempty" json:"newLightFissionCount"` // light新增裂变
|
||||
NewLightDeductionCount int64 `bson:"newLightDeductionCount,omitempty" json:"newLightDeductionCount"` // light新增扣量
|
||||
NewLightNaturalCount int64 `bson:"newLightNaturalCount,omitempty" json:"newLightNaturalCount"` // light自然新增
|
||||
|
||||
NewLightGuestCount int64 `bson:"newLightGuestCount,omitempty" json:"newLightGuestCount"` // **轻量安装
|
||||
NewLightGuestDirectCount int64 `bson:"newLightGuestDirectCount,omitempty" json:"newLightGuestDirectCount"` // 新增LightGuest直推
|
||||
NewLightGuestFissionCount int64 `bson:"newLightGuestFissionCount,omitempty" json:"newLightGuestFissionCount"` // 新增LightGuest裂变
|
||||
NewLightGuestDeductionCount int64 `bson:"newLightGuestDeductionCount,omitempty" json:"newLightGuestDeductionCount"` // 新增LightGuest扣量
|
||||
|
||||
NewLightFormalCount int64 `bson:"newLightFormalCount,omitempty" json:"newLightFormalCount"` // **轻量注册
|
||||
NewLightFormalDirectCount int64 `bson:"newLightFormalDirectCount,omitempty" json:"newLightFormalDirectCount"` // 新增LightFormal直推
|
||||
NewLightFormalFissionCount int64 `bson:"newLightFormalFissionCount,omitempty" json:"newLightFormalFissionCount"` // 新增LightFormal裂变
|
||||
NewLightFormalDeductionCount int64 `bson:"newLightFormalDeductionCount,omitempty" json:"newLightFormalDeductionCount"` // 新增LightFormal扣量
|
||||
|
||||
NewH5Count int64 `bson:"newH5Count,omitempty" json:"newH5Count"` // h5新增安装
|
||||
NewH5DirectCount int64 `bson:"newH5DirectCount,omitempty" json:"newH5DirectCount"` // 新增H5直推
|
||||
NewH5FissionCount int64 `bson:"newH5FissionCount,omitempty" json:"newH5FissionCount"` // 新增H5裂变
|
||||
NewH5DeductionCount int64 `bson:"newH5DeductionCount,omitempty" json:"newH5DeductionCount"` // 新增H5扣量
|
||||
NewH5AndroidCount int64 `bson:"newH5AndroidCount,omitempty" json:"newH5AndroidCount"` // h5安卓新增
|
||||
NewH5IosCount int64 `bson:"newH5IosCount,omitempty" json:"newH5IosCount"` // h5苹果新增
|
||||
NewH5PcCount int64 `bson:"newH5PcCount,omitempty" json:"newH5PcCount"` // h5电脑新增
|
||||
NewH5FormalCount int64 `bson:"newH5FormalCount,omitempty" json:"newH5FormalCount"` // h5注册新增
|
||||
NewH5FormalDirectCount int64 `bson:"newH5FormalDirectCount,omitempty" json:"newH5FormalDirectCount"` // 新增H5正式直推
|
||||
NewH5FormalFissionCount int64 `bson:"newH5FormalFissionCount,omitempty" json:"newH5FormalFissionCount"` // 新增H5正式裂变
|
||||
NewH5FormalDeductionCount int64 `bson:"newH5FormalDeductionCount,omitempty" json:"newH5FormalDeductionCount"` // 新增H5正式扣量
|
||||
// 访问统计
|
||||
TotalVisitCount int64 `bson:"totalVisitCount,omitempty" json:"totalVisitCount"` // **总计访问数
|
||||
DirectVisitCount int64 `bson:"directVisitCount,omitempty" json:"directVisitCount"` // 直推访问数
|
||||
FissionVisitCount int64 `bson:"fissionVisitCount,omitempty" json:"fissionVisitCount"` // 裂变访问数
|
||||
AndroidVisitCount int64 `bson:"androidVisitCount,omitempty" json:"androidVisitCount"` // android访问
|
||||
IosVisitCount int64 `bson:"iosVisitCount,omitempty" json:"iosVisitCount"` // ios访问
|
||||
LightVisitCount int64 `bson:"lightVisitCount,omitempty" json:"lightVisitCount"` // **轻量访问
|
||||
LightVisitDirectCount int64 `bson:"lightVisitDirectCount" json:"lightVisitDirectCount"` // light访问量直推
|
||||
LightVisitFissionCount int64 `bson:"lightVisitFissionCount" json:"lightVisitFissionCount"` // light访问量裂变
|
||||
LightVisitDeductionCount int64 `bson:"lightVisitDeductionCount" json:"lightVisitDeductionCount"` // light访问量扣量
|
||||
LightVisitNaturalCount int64 `bson:"lightVisitNaturalCount" json:"lightVisitNaturalCount"` // light访问量自然
|
||||
H5VisitCount int64 `bson:"h5VisitCount,omitempty" json:"h5VisitCount"` // h5访问
|
||||
H5AndroidVisitCount int64 `bson:"h5AndroidVisitCount,omitempty" json:"h5AndroidVisitCount"` // h5安卓访问
|
||||
H5IosVisitCount int64 `bson:"h5IosVisitCount,omitempty" json:"h5IosVisitCount"` // h5苹果访问
|
||||
H5PcVisitCount int64 `bson:"h5PcVisitCount,omitempty" json:"h5PcVisitCount"` // h5电脑访问
|
||||
// 充值统计
|
||||
TotalAmount int64 `bson:"totalAmount,omitempty" json:"totalAmount"` // **充值金额总量
|
||||
DirectAmount int64 `bson:"directAmount,omitempty" json:"directAmount"` // 直推充值金额
|
||||
DirectAmountCount int64 `bson:"directAmountCount,omitempty" json:"directAmountCount"` // 直推充值订单数
|
||||
FissionAmount int64 `bson:"fissionAmount,omitempty" json:"fissionAmount"` // 裂变充值金额
|
||||
FissionAmountCount int64 `bson:"fissionAmountCount,omitempty" json:"fissionAmountCount"` // 裂变充值订单数
|
||||
NaturalAmount int64 `bson:"naturalAmount,omitempty" json:"naturalAmount"` // 自然充值
|
||||
NaturalAmountCount int64 `bson:"naturalAmountCount,omitempty" json:"naturalAmountCount"` // 自然充值订单数
|
||||
DeductionAmount int64 `bson:"deductionAmount,omitempty" json:"deductionAmount"` // 充值扣量
|
||||
DeductionAmountCount int64 `bson:"deductionAmountCount,omitempty" json:"deductionAmountCount"` // 充值扣量次数
|
||||
AndroidAmount int64 `bson:"androidAmount,omitempty" json:"androidAmount"` // +安卓充值金额
|
||||
AndroidAmountCount int64 `bson:"androidAmountCount,omitempty" json:"androidAmountCount"` // +安卓充值次数
|
||||
IosAmount int64 `bson:"iosAmount,omitempty" json:"iosAmount"` // +Ios充值金额
|
||||
IosAmountCount int64 `bson:"iosAmountCount,omitempty" json:"iosAmountCount"` // +Ios充值次数
|
||||
H5Amount int64 `bson:"h5Amount,omitempty" json:"h5Amount"` // +H5充值金额
|
||||
H5AmountCount int64 `bson:"h5AmountCount,omitempty" json:"h5AmountCount"` // +H5充值次数
|
||||
LightAmount int64 `bson:"lightAmount,omitempty" json:"lightAmount"` // light充值金额
|
||||
LightAmountCount int64 `bson:"lightAmountCount,omitempty" json:"lightAmountCount"` // light充值次数
|
||||
LightDirectAmount int64 `bson:"lightDirectAmount,omitempty" json:"lightDirectAmount"` // light充值金额直推
|
||||
LightDirectAmountCount int64 `bson:"lightDirectAmountCount,omitempty" json:"lightDirectAmountCount"` // light充值次数直推
|
||||
LightFissionAmount int64 `bson:"lightFissionAmount,omitempty" json:"lightFissionAmount"` // light充值金额裂变
|
||||
LightFissionAmountCount int64 `bson:"lightFissionAmountCount,omitempty" json:"lightFissionAmountCount"` // light充值次数裂变
|
||||
LightDeductionAmount int64 `bson:"lightDeductionAmount,omitempty" json:"lightDeductionAmount"` // light充值金额扣量
|
||||
LightDeductionAmountCount int64 `bson:"lightDeductionAmountCount,omitempty" json:"lightDeductionAmountCount"` // light充值次数扣量
|
||||
LightNaturalAmount int64 `bson:"lightNaturalAmount,omitempty" json:"lightNaturalAmount"` // light充值金额自然
|
||||
LightNaturalAmountCount int64 `bson:"lightNaturalAmountCount,omitempty" json:"lightNaturalAmountCount"` // light充值次数自然
|
||||
// 其他充值统计
|
||||
NewRechargeAmount int64 `bson:"newRechargeAmount,omitempty" json:"newRechargeAmount"` // 新增充值金额
|
||||
VipPayMoney int64 `bson:"vipPayMoney,omitempty" json:"vipPayMoney"` // 购买会员金额(CPS扣量后)
|
||||
VipPayCoin int64 `bson:"vipPayCoin,omitempty" json:"vipPayCoin"` // 金币购买会员数量
|
||||
VipPayDeduction int64 `bson:"vipPayDeduction,omitempty" json:"vipPayDeduction"` // 购买会员金额(CPS扣量)
|
||||
GameRechageAmount int64 `bson:"gameRechageAmount,omitempty" json:"gameRechageAmount"` // 游戏充值
|
||||
GameWithdrawAmount int64 `bson:"gameWithdrawAmount,omitempty" json:"gameWithdrawAmount"` // 游戏提现
|
||||
// 落地页访问
|
||||
LandPageVisitCount int64 `bson:"landPageVisitCount,omitempty" json:"landPageVisitCount"` // 落地页访问次数
|
||||
LandpageAndroidClick int64 `bson:"landpageAndroidClick,omitempty" json:"landpageAndroidClick"` // 落地页android访问次数
|
||||
LandpageIosAppstoreClick int64 `bson:"landpageIosAppstoreClick,omitempty" json:"landpageIosAppstoreClick"` // 落地页iOS商店包访问次数
|
||||
LandpageIosAthorClick int64 `bson:"landpageIosAthorClick,omitempty" json:"landpageIosAthorClick"` // 落地页iOS其他包访问次数
|
||||
LandpageIosH5Click int64 `bson:"landpageIosH5Click,omitempty" json:"landpageIosH5Click"` // 落地页H5访问次数
|
||||
// 时间
|
||||
UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt"` // 更新时间
|
||||
CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt"` // 创建时间
|
||||
}
|
||||
type ChannelSettlementList []*ChannelSettlement
|
||||
|
||||
// 渠道每日统计
|
||||
// @table:channel_stat_yestoday
|
||||
type ChannelStatYesterday struct {
|
||||
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"` // ID
|
||||
Channel string `bson:"channel" json:"channel"` // 渠道
|
||||
SumDate time.Time `bson:"sumDate" json:"sumDate"` // 记录时间 15分钟对齐
|
||||
AppId int32 `bson:"appId" json:"appId"` // appId
|
||||
Settlement SettlementWay `bson:"settlement" json:"settlement"` // 结算方式 cps/cpa/cpt/cpc
|
||||
ParentChannel string `bson:"parentChannel" json:"parentChannel"` // 父渠道 如果为空字符串,则为渠道,否则为代理
|
||||
// 注册
|
||||
NewCount int64 `bson:"newCount,omitempty" json:"newCount"` // 新增
|
||||
NewDirectCount int64 `bson:"newDirectCount,omitempty" json:"newDirectCount"` // 新增直推
|
||||
NewFissionCount int64 `bson:"newFissionCount,omitempty" json:"newFissionCount"` // 新增裂变
|
||||
NewAndroidCount int64 `bson:"newAndroidCount,omitempty" json:"newAndroidCount"` // android新增
|
||||
NewIosCount int64 `bson:"newIosCount,omitempty" json:"newIosCount"` // ios新增
|
||||
NewH5Count int64 `bson:"newH5Count,omitempty" json:"newH5Count"` // h5新增(guest)
|
||||
NewH5FormalCount int64 `bson:"newH5FormalCount,omitempty" json:"newH5FormalCount"` // h5注册新增
|
||||
NewLightGuestCount int64 `bson:"newLightGuestCount,omitempty" json:"newLightGuestCount"` // 轻量安装
|
||||
NewLightFormalCount int64 `bson:"newLightFormalCount,omitempty" json:"newLightFormalCount"` // 轻量注册
|
||||
NewIncreaseCount int64 `bson:"newIncreaseCount,omitempty" json:"newIncreaseCount"` // 新增增长
|
||||
NewIncreaseRate string `bson:"newIncreaseRate,omitempty" json:"newIncreaseRate"` // 新增增长比例 对比昨天同时段
|
||||
// 充值
|
||||
RechargeAmount int64 `bson:"rechargeAmount,omitempty" json:"rechargeAmount"` // **充值金额
|
||||
DirectAmount int64 `bson:"directAmount,omitempty" json:"directAmount"` // 直推充值金额
|
||||
FissionAmount int64 `bson:"fissionAmount,omitempty" json:"fissionAmount"` // 裂变充值金额
|
||||
AndroidRechargeAmount int64 `bson:"androidRechargeAmount,omitempty" json:"androidRechargeAmount"` // android充值金额
|
||||
IosRechargeAmount int64 `bson:"iosRechargeAmount,omitempty" json:"iosRechargeAmount"` // ios充值金额
|
||||
H5RechargeAmount int64 `bson:"h5RechargeAmount,omitempty" json:"h5RechargeAmount"` // h5充值金额
|
||||
LightRechargeAmount int64 `bson:"lightRechargeAmount,omitempty" json:"lightRechargeAmount"` // **light充值金额
|
||||
RechargeIncreaseAmount int64 `bson:"rechargeIncreaseAmount,omitempty" json:"rechargeIncreaseAmount"` // 充值增长
|
||||
RechargeIncreaseRate string `bson:"rechargeIncreaseRate,omitempty" json:"rechargeIncreaseRate"` // 充值增长比例 对比昨天同时段
|
||||
// 其他充值
|
||||
VipPayCoin int64 `bson:"vipPayCoin,omitempty" json:"vipPayCoin"` // 金币购买会员数量
|
||||
VipPayMoney int64 `bson:"vipPayMoney,omitempty" json:"vipPayMoney"` // 购买会员金额(CPS扣量后)
|
||||
VipPayDeduction int64 `bson:"vipPayDeduction,omitempty" json:"vipPayDeduction"` // 购买会员金额(CPS扣量)
|
||||
//
|
||||
UpdatedAt time.Time `bson:"updatedAt,omitempty" json:"updatedAt"` // 更新时间
|
||||
CreatedAt time.Time `bson:"createdAt,omitempty" json:"createdAt"` // 创建时间
|
||||
}
|
||||
type ChannelStatYestodayList []*ChannelStatYesterday
|
||||
|
||||
// 渠道所有者变更记录
|
||||
// @table:channel_owner_change
|
||||
type ChannelOwnerChange struct {
|
||||
ID primitive.ObjectID `json:"id" bson:"_id"` // ID
|
||||
Channel string `json:"channel" bson:"channel"` // 渠道
|
||||
OldUser string `json:"oldUser" bson:"oldUser"` // 变更前的所有者
|
||||
NewUser string `json:"newUser" bson:"newUser"` // 变更后的所有者
|
||||
Mark string `json:"mark" bson:"mark"` // 备注
|
||||
CreatedAt time.Time `json:"createdAt" bson:"createdAt"` // 创建时间
|
||||
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"` // 更新时间
|
||||
Operator string `json:"operator" bson:"operator"` // 操作者
|
||||
Account string `json:"account" bson:"account"` // 操作账号
|
||||
}
|
||||
type ChannelOwnerChangeList []*ChannelOwnerChange
|
||||
Reference in New Issue
Block a user