支持实验数据拉取

This commit is contained in:
2025-10-16 10:09:20 +08:00
parent d7ab7b5156
commit df62e4fae6
5 changed files with 771 additions and 89 deletions

205
cmd.proto
View File

@@ -189,8 +189,21 @@ message ExpList {
}
// ExpGet 获取实验报表
// select base_fields, {EXT_FIELDS}
// where day between {WHERE_BEGIN_DAY} and {WHERE_END_DAY}
// and expid in {WHERE_EXP_ID}
// and target = {WHERE_TARGET}
// and advertiser_id in {WHERE_ADVERTISER_ID}
// group by {GROUP_BY}
message ExpGet {
repeated string ext_fields = 1; // 扩展字段(除基础字段必然输出外,其余字段需在这里填写,也可以使用*输出全部扩展字段)
uint64 where_begin_day = 10; // 起始日期
uint64 where_end_day = 11; // 结束日期
repeated uint32 where_exp_id = 12; // 实验ID(1-10)
string where_target = 13; // 策略ID
repeated uint64 where_advertiser_id = 14; // 广告主ID
repeated string group_by = 20; // 当前支持广告主ID(advertiser_id)
uint32 TotalFlag = 30; // 是否汇总
}
// SaasRes 命令返回
@@ -275,49 +288,49 @@ message Binds {
// Bind 绑定信息
message Bind {
int64 bind_id = 1; //绑定的ID
BindType bind_type = 2; //绑定类型
string target_id = 3; //策略ID
int64 account_id = 4; //广告主ID
BindSourceType bind_source = 5; //绑定操作来源
int64 bind_id = 1; // 绑定的ID
BindType bind_type = 2; // 绑定类型
string target_id = 3; // 策略ID
int64 account_id = 4; // 广告主ID
BindSourceType bind_source = 5; // 绑定操作来源
}
// BindType 绑定类型
enum BindType {
UnknownBindType = 0;
AdgroupId = 1; //广告
AccountId = 3; //广告主
AdgroupId = 1; // 广告
AccountId = 3; // 广告主
}
// BindSourceType 绑定操作来源
enum BindSourceType {
DefaultBindSourceType = 0; //广告主或未填写
ThirdPartyApi = 1; //第三方API
ADQ = 2; //ADQ平台
MP = 3; //MP平台
MktApi = 4; //MarketingAPI
DefaultBindSourceType = 0; // 广告主或未填写
ThirdPartyApi = 1; // 第三方API
ADQ = 2; // ADQ平台
MP = 3; // MP平台
MktApi = 4; // MarketingAPI
}
// BindSetRes 设置绑定返回
message BindSetRes {
int32 success_num = 1; //成功数
int32 error_num = 2; //错误数
repeated BindError errors = 3; //绑定错误的记录
int32 success_num = 1; // 成功数
int32 error_num = 2; // 错误数
repeated BindError errors = 3; // 绑定错误的记录
}
// BindDeleteRes 删除绑定返回
message BindDeleteRes {
int32 success_num = 1; //成功数
int32 error_num = 2; //错误数
repeated BindError errors = 3; //绑定错误的记录
int32 success_num = 1; // 成功数
int32 error_num = 2; // 错误数
repeated BindError errors = 3; // 绑定错误的记录
}
// BindError 绑定错误信息
message BindError {
int64 bind_id = 1; //错误绑定的绑定ID
int32 bind_type = 2; //绑定类型
string reason = 3; //错误绑定原因
int64 bind_id = 1; // 错误绑定的绑定ID
int32 bind_type = 2; // 绑定类型
string reason = 3; // 错误绑定原因
}
@@ -335,20 +348,156 @@ message ScriptUpdateRes {
// ExpListRes 实验列表返回
message ExpListRes {
repeated ExpBucket buckets = 1; //实验桶
repeated ExpBucket buckets = 1; // 实验桶
}
message ExpBucket {
uint32 bucket_id = 1; //分桶号
uint32 pt_exp_id = 2; //平台实验ID
uint32 percent = 3; //流量百分比
uint32 bucket_id = 1; // 分桶号
uint32 pt_exp_id = 2; // 平台实验ID
uint32 percent = 3; // 流量百分比
}
// ExpGetRes 实验报表返回
message ExpGetRes {
repeated ExpData expdata = 1; // 实验数据
}
message ExpData {
uint64 time = 1; // 日期
uint32 ExpId = 2; // 实验ID
ExpBaseFields base_fields = 3; // 基础字段
map <string, double> ext_fields = 4; // 扩展字段
map<string, uint64> group = 5; // 分组
}
message ExpBaseFields {
double cost = 1; // 花费
int64 exposure = 2; // 曝光量
int64 click = 3; // 点击量
double cpm = 4; // 单次曝光成本
double cpc = 5; // 单次点击成本
double cpa = 6; // 单次转化成本
double ctr = 7; // 点击率
double cvr = 8; // 浅层转化率
double cvr_second = 9; // 深层转化率
int64 conversion = 10; // 浅层转化量
int64 conversion_second = 11; // 深层转化量
}
/*
type RtaResExpGetRecord struct {
Time int32 `json:"time"` // 时间
ExpId int64 `json:"exp_id"` // 实验ID
GroupInfo map[string]uint64 `json:"group_info"` // GroupBy信息
Cost float64 `json:"cost"` // 消耗(元)
Exposure int64 `json:"exposure"` // 曝光量(次)
Click int64 `json:"click"` // 点击量(次)
Cpm float64 `json:"cpm"` // 单次曝光成本处理时要转换成CPM方便理解这字段定义真的一言难尽
Cpc float64 `json:"cpc"` // 单次点击成本
Ctr float64 `json:"ctr"` // 点击率
Conversion int64 `json:"conversion"` // 浅层转化数
ConversionSecond int64 `json:"conversion_second"` // 深层转化数
Cvr float64 `json:"cvr"` // 浅层转化率
CvrSecond float64 `json:"cvr_second"` // 深层转化率
Og6 float64 `json:"og_6"` // 优化目标-关注
Og7 float64 `json:"og_7"` // 优化目标-点击
Og10 float64 `json:"og_10"` // 优化目标-跳转按钮点击
Og105 float64 `json:"og_105"` // 优化目标- 注册(App)
Og106 int64 `json:"og_106"` // 优化目标-次日留存
Og108 int64 `json:"og_108"` // 优化目标-完成购买数量
Og112 int64 `json:"og_112"` // 优化目标-快应用加桌面
Og114 int64 `json:"og_114"` // 优化目标-小游戏创角
Og115 int64 `json:"og_115"` // 优化目标-游戏授权
Og119 float64 `json:"og_119"` // 优化目标-授信
Og120 int64 `json:"og_120"` // 优化目标-提现
Og121 float64 `json:"og_121"` // 优化目标-广告变现
Og202 int64 `json:"og_202"` // 优化目标-商品收藏
Og204 float64 `json:"og_204"` // 优化目标-下单
Og205 float64 `json:"og_205"` // 优化目标-付费
Og301 float64 `json:"og_301"` // 优化目标-关键页面访问
Og302 int64 `json:"og_302"` // 优化目标-H5注册
Og307 int64 `json:"og_307"` // 优化目标-领券
Og315 int64 `json:"og_315"` // 优化目标-浏览量
Og316 int64 `json:"og_316"` // 优化目标-阅读文章
Og318 int64 `json:"og_318"` // 优化目标-预授信
Og403 int64 `json:"og_403"` // 优化目标-电话拨打
Og405 float64 `json:"og_405"` // 优化目标-表单预约
Og406 int64 `json:"og_406"` // 优化目标-完件
Og409 float64 `json:"og_409"` // 优化目标-有效线索
Og412 int64 `json:"og_412"` // 优化目标-加企微客户
Og413 int64 `json:"og_413"` // 优化目标-选课
Og418 int64 `json:"og_418"` // 优化目标-外链点击
Og419 int64 `json:"og_419"` // 优化目标-购券
Og421 int64 `json:"og_421"` // 优化目标-加群
Og501 int64 `json:"og_501"` // 优化目标-打开公众号
Og503 int64 `json:"og_503"` // 优化目标-关注后点击菜单栏
Og10000 int64 `json:"og_10000"` // 优化目标-综合线索收集
Og10004 int64 `json:"og_10004"` // 优化目标-首次购买会员
Og10006 int64 `json:"og_10006"` // 优化目标-微信流量预约
Og10007 int64 `json:"og_10007"` // 优化目标-首次下单
Og10008 int64 `json:"og_10008"` // 优化目标-点赞
Og10009 int64 `json:"og_10009"` // 优化目标-咨询留资
Og10601 int64 `json:"og_10601"` // 优化目标-次留
Og10801 float64 `json:"og_10801"` // 优化目标-首次付费
Bo6 int64 `json:"bo_6"` // 推广目标-公众号关注数
Bo7 int64 `json:"bo_7"` // 推广目标-公众号内下单人数
Bo23 int64 `json:"bo_23"` // 推广目标-关键页面访问数
Bo25 int64 `json:"bo_25"` // 推广目标-公众号注册数
Bo26 int64 `json:"bo_26"` // 推广目标-公众号发消息数
Bo41 int64 `json:"bo_41"` // 推广目标-公众号付费人数
ConversionCost101 float64 `json:"101_conversion_cost"` // 下单单价
Amount204 float64 `json:"204_amount"` // 下单金额
Roi204 float64 `json:"204_roi"` // 下单ROI
Roi204fd float64 `json:"204_roi_fd"` // 首日下单ROI(T+1更新)
Roi204tw float64 `json:"204_roi_tw"` // 3日下单ROI
Roi204ow float64 `json:"204_roi_ow"` // 7日下单ROI
Roi204td float64 `json:"204_roi_td"` // 15日下单ROI
Roi204om float64 `json:"204_roi_om"` // 30日下单ROI
OrderCost float64 `json:"order_cost"` // 下单成本
OrderCount int64 `json:"order_count"` // 下单数
Roi float64 `json:"roi"` // ROI
MdMgPurchaseUv int64 `json:"md_mg_purchase_uv"` // 小游戏首次付费人数
MdMgPurchaseVal1 int64 `json:"md_mg_purchase_val1"` // 小游戏首日付费金额(广告主回传)(分)
MdMgPurchaseVal int64 `json:"md_mg_purchase_val"` // 小游戏付费金额(分)
WeAppRegUv int64 `json:"weapp_reg_uv"` // 小游戏注册人数
ActiveCount int64 `json:"active_count"` // 激活数
InstallCount int64 `json:"install_count"` // 安装数
Count107 int64 `json:"107_count"` // 加入购物车数
AtCount402 int64 `json:"402_at_count"` // 开口数
SendGoodsCount int64 `json:"send_goods_count"` // 发货数(次)
Sign int64 `json:"sign"` // 签收数(次)
AtRate409405 float64 `json:"409_405_at_rate"` // 表单有效率
AtCost409 float64 `json:"409_at_cost"` // 有效销售线索成本
AtCount409 int64 `json:"409_at_count"` // 有效销售线索数
AtCost415 float64 `json:"415_at_cost"` // 试驾成本
AtCount415 int64 `json:"415_at_count"` // 试驾数
AtCost405 float64 `json:"405_at_cost"` // 表单预约成本(元)
AtCount405 int64 `json:"405_at_count"` // 表单预约数
AtCost108 float64 `json:"108_at_cost"` // 完成购买成本(元)
AtCount108 int64 `json:"108_at_count"` // 完成购买数
AogAction119 int64 `json:"119_aog_action"` // 授信数
AogAction406 int64 `json:"406_aog_action"` // 完件数
CvrClick119 float64 `json:"119_cvr_click"` // 点击授信率
CvrClick406 float64 `json:"406_cvr_click"` // 点击完件率
FinanceCreditPcvrAfterCaliBias float64 `json:"finance_credit_pcvr_after_cali_bias"` // pcvrbias金融pdcvr修正后授信(校正后)
FinanceCreditPcvrBeforeCaliBias float64 `json:"finance_credit_pcvr_before_cali_bias"` // pcvrbias金融pdcvr修正后授信(校正前)
FinanceApplyOrginalPcvrBias float64 `json:"finance_apply_original_pcvr_bias"` // 原始pcvrbias金融pdcvr完件)
IndustryFinanceApplyPcvrBias float64 `json:"industry_finance_apply_pcvr_bias"` // pcvrbias(金融pdcvr完件)
ActiveCost float64 `json:"active_cost"` // 激活成本
ActiveRegisterRate float64 `json:"active_register_rate"` // 激活注册率
MdActiPurVal float64 `json:"md_acti_pur_val"` // 付费金额(激活口径)
MdActiPurValFdRoi float64 `json:"md_acti_pur_val_fd_roi"` // 首日付费金额(激活口径)
MdPurVal3 float64 `json:"md_pur_val_3"` // 3日付费金额(激活口径)
MdPurVal3Roi float64 `json:"md_pur_val_3_roi"` // 3日ROI(激活口径)
MdPurVal7 float64 `json:"md_pur_val_7"` // 7日付费金额(激活口径)
MdPurVal7Roi float64 `json:"md_pur_val_7_roi"` // 7日ROI(激活口径)
MdPurVal14 float64 `json:"md_pur_val_14"` // 14日付费金额(激活口径)
MdPurVal14Roi float64 `json:"md_pur_val_14_roi"` // 14日ROI(激活口径)
MdPurVal30 float64 `json:"md_pur_val_30"` // 30日付费金额(激活口径)
MdPurVal30Roi float64 `json:"md_pur_val_30_roi"` // 30日ROI(激活口径)
}
*/
// ErrorCode 返回码
enum ErrorCode {
SUCC = 0; // 成功
@@ -382,6 +531,8 @@ enum ErrorCode {
CMD_ERROR = 202; // 命令行执行错误
API_ERROR = 301; // 调用内部API错误
TARGET_ERROR = 401; // Target参数错误
}
enum CmdErrorCode {