syntax = "proto3"; package saasapi; option go_package = "git.algo.com.cn/public/saasapi"; // SaasReq 命令请求 message SaasReq { oneof cmd { Info info = 5; // 获取账号设置 Read read = 10; // 批量读取 Write write = 11; // 批量写入 ColumnWrite column_write = 12; // 全量列式写入 Task task_create = 20; // 任务创建 TaskList task_list = 21; // 列出任务 TaskRun task_run = 22; // 执行任务 TaskDelete task_delete = 23; // 删除任务 TaskInfo task_info = 24; // 任务详情 TargetList target_list = 50; // 列出策略及绑定 BindSet bind_set = 61; // 设置绑定 BindDelete bind_delete = 62; // 解除绑定 ScriptRun script_run = 90; // 运行脚本 ScriptUpdate script_update = 91; // 脚本升级 ExpList exp_list = 100; // 列出实验 ExpGet exp_get = 101; // 获取实验报表 } } // Info 获取账号信息 message Info { } // Read 批量读取命令 message Read { string dataspace_id = 1; // 数据空间ID string appid = 2; // 小程序/小游戏/公众号/视频号的appid repeated ReadItem read_items = 3; // 批量获取命令 } // ReadItem 读取命令 message ReadItem { string userid = 1; // 用户ID } // Write 批量写入命令 message Write { string dataspace_id = 1; // 数据空间ID string appid = 2; // 小程序/小游戏/公众号/视频号的appid bool is_clear_all_first = 3; // 是否先清空该用户所有数据 repeated WriteItem write_items = 4; // 批量写入命令 } // WriteItem 写入命令 message WriteItem { string userid = 1; // 用户ID Bytes write_bytes = 2; // byte区域 Uint32s write_uint32s = 3; // uint32区域 FlagsWithExpire write_flags_with_expire = 4; // 标志位区域 } // Bytes 写入byte区域 message Bytes { bytes bytes = 1; // 写入的byte uint64 index_1 = 2; // 写入byte的索引值(0..63) } // Uint32s 写入uint32区域 message Uint32s { repeated uint32 uint32s = 1; // 写入的uint32 uint64 index_1 = 2; // 写入uint32的索引值(0..7) 最多 8 个 //uint64 index_2 = 3; // 写入uint32的索引值(当前不支持) } // FlagsWithExpire 写入标志位区域 message FlagsWithExpire { repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位 uint64 index_1 = 2; // 写入标志位的索引值(0..3) 最多 4 个 } // FlagWithExpire 标志位 message FlagWithExpire { bool flag = 1; // 标志位 bool default_flag = 2; // 默认值。超时后则回到默认值。 uint32 expire = 3; // 过期时间,为 0 则永不过期 } // ColumnWrite 全量列式写入命令 message ColumnWrite { string dataspace_id = 1; // 数据空间ID bool is_clear_all_first = 2; // 是否先执行清空 Bytes write_bytes = 3; // byte区域 Uint32s write_uint32s = 4; // uint32区域 FlagsWithExpire write_flags_with_expire = 5; // 标志位区域 } message Task { string dataspace_id = 1; // 数据空间ID string appid = 2; // 小程序/小游戏/公众号/视频号的appid string task_sha256 = 3; // 任务sha256 string task_description = 4; // 任务描述 repeated FileInfo task_file_infos = 5; // 文件列表 uint64 task_block_size = 6; // 文件块字节大小(推荐50M) string source_path = 7; // 任务数据源路径 uint64 task_size = 8; // 任务所有文件的总大小 // 以下字段只在返回时填写,用于提供服务端的任务状态。在请求时填写会被忽略 string create_time = 10; // 创建时间 string run_time = 11; // 运行时间 string finish_time = 12; // 完成时间 uint32 running_block = 13; // 正在运行的块编号 uint32 total_block = 14; // 总块数 TaskStatus status = 15; // 任务状态 } // TaskList 任务列表 message TaskList { TaskStatus status_filter = 1; // 只显示指定状态的任务 } // TaskRun 任务运行 message TaskRun { string task_sha256 = 1; // 任务sha256 } // TaskDelete 取消任务 message TaskDelete { string task_sha256 = 1; // 任务sha256 } // TaskInfo 任务详情 message TaskInfo { string task_sha256 = 1; // 任务sha256 } // FileInfo 任务文件信息 message FileInfo { string file_name = 1; // 文件名 uint64 file_size = 2; // 文件大小 repeated FileBlock file_blocks = 3; // 文件块列表 } // FileBlock 文件块信息 message FileBlock { string block_sha256 = 1; // 块的sha256 uint64 block_length = 2; // 块的字节长度 bool uploaded = 3; // 是否已上传(在TaskCreate/TaskInfo请求返回) } // TargetList 列出策略 message TargetList { repeated string targets = 1; // 指定要列出的绑定的策略列表,如不指定则返回全部 bool list_bind = 2; // 是否同时列出绑定信息 } // BindSet 设置绑定 message BindSet { repeated Bind binds = 2; // 设置绑定内容 } // BindDelete 删除绑定 message BindDelete { repeated Bind binds = 2; // 解除绑定内容 } // ScriptRun 运行脚本 message ScriptRun { string lua_script = 1; // 要调试的lua脚本 string server_did = 2; // 将从服务端读取该DID下的数据 string appid = 3; // 小程序/小游戏/公众号/视频号的appid string server_openid = 4; // 将从服务端读取该openid下的数据,需与appid配对使用 OS os = 5; // 操作系统 } // ScriptUpdate 升级脚本 message ScriptUpdate { } // ExpList 列出实验 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 命令返回 message SaasRes { ErrorCode code = 1; // 返回码 string status = 2; // 返回信息的文本提示 oneof res { InfoRes info_res = 5; // 账号信息返回 ReadRes read_res = 10; // 读取命令返回 WriteRes write_res = 11; // 写入命令返回 Task task_create_res = 20; // 创建任务返回状态 TaskListRes task_list_res = 21; // 任务列表返回状态 Task task_run_res = 22; // 运行任务返回状态 Task task_delete_res = 23; // 删除任务返回状态 Task task_info_res = 24; // 任务详情返回状态 TargetListRes target_list_res = 50; // 列出策略及绑定返回状态 BindSetRes bind_set_res = 61; // 设置绑定返回状态 BindDeleteRes bind_delete_res = 62; // 删除绑定返回状态 ScriptRunRes script_run_res = 90; // 运行脚本返回 ScriptUpdateRes script_update_res = 91; // 升级脚本返回 ExpListRes exp_list_res = 100; // 实验列表返回 ExpGetRes exp_get_res = 101; // 实验报表返回 } } message DataSpace { repeated string did = 1; // 设备ID区 repeated string wuid = 2; // OpenID区 } // InfoRes 账号信息返回 message InfoRes { DataSpace dataspace = 1; // 可用数据区列表 repeated string target_id = 2; // 策略ID列表 } // ReadRes 读记录返回 message ReadRes { uint32 succ_cmd_count = 1; // 成功的命令数量 uint32 fail_cmd_count = 2; // 失败的命令数量 repeated ValueItem cmd_res = 3; // 返回的命令 } // WriteRes 写记录返回 message WriteRes { //uint32 succ_cmd_count = 1; // 成功的命令数量 //uint32 fail_cmd_count = 2; // 失败的命令数量 repeated string failed_userid = 3; // 返回的失败的用户ID } // ValueItem 读取命令返回内容 message ValueItem { uint32 cmd_index = 1; // 命令索引 CmdErrorCode cmd_code = 2; // 状态 bytes bytes = 3; // byte区域 repeated uint32 uint32s = 4; // uint32区域 repeated FlagWithExpire flags_with_expire = 5; // 标志位区域 uint32 last_modify_time = 6; // 最后修改时间 uint32 version = 7; // 存储版本 } // TaskListRes 任务列表返回 message TaskListRes { repeated Task tasks = 1; // 任务列表 } // TargetListRes 策略列表返回 message TargetListRes { map target_list = 1; // 绑定列表 } message Binds { repeated Bind binds = 1; } // 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; // 绑定操作来源 } // BindType 绑定类型 enum BindType { UnknownBindType = 0; AdgroupId = 1; // 广告 AccountId = 3; // 广告主 } // BindSourceType 绑定操作来源 enum BindSourceType { 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; // 绑定错误的记录 } // BindDeleteRes 删除绑定返回 message BindDeleteRes { 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; // 错误绑定原因 } // ScriptRunRes 运行脚本返回 message ScriptRunRes { string print_output = 1; // print输出 string error_output = 2; // 错误信息 string targets_output = 3; // 策略输出 string dataspace_out = 4; // 数据区输出 } // ScriptUpdateRes 升级脚本返回 message ScriptUpdateRes { } // ExpListRes 实验列表返回 message ExpListRes { repeated ExpBucket buckets = 1; // 实验桶 } message ExpBucket { 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 ext_fields = 4; // 扩展字段 map 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; // 成功 INVALID_ACCOUNT = 101; // Account不合法 INVALID_TIMESTAMP = 102; // 头信息缺少时间戳或不正确 INVALID_SIGNATURE = 103; // 头信息缺少签名 AUTH_FAIL = 104; // 签名较验失败 DISABLED_ACCOUNT = 105; // 账号已禁用 INVALID_CONTENT_TYPE = 110; // 非法的Content-Type READ_BODY = 111; // 读取 http body 失败 DECODE_BODY = 112; // 解码 body 失败 QPS_LIMIT = 113; // 并发请求量超限 CMDS_LIMIT = 114; // 命令数量超限 CMDS_NULL = 115; // 命令为空 DATASPACE_NOT_EXISTS = 116; // 数据空间不存在 TASK_EXISTS = 120; // 任务已存在 TASK_IS_NOT_EXISTS = 121; // 任务不存在 TASK_NUM_LIMIT = 122; // 任务数达到上限 TASK_BLOCK_SIZE = 123; // 块大小超限 TASK_TOTAL_SIZE = 124; // 总文件大小超限 TASK_MARSHAL = 125; // 序列化 TASK_IS_WATING = 130; // 任务未上传完毕 TASK_IS_RUNNING = 131; // 任务已经在运行 TASK_FAILED = 132; // 任务已失败 TASK_FINISHED = 133; // 任务已完成 DATA_ERROR = 201; // 数据错误 CMD_ERROR = 202; // 命令行执行错误 API_ERROR = 301; // 调用内部API错误 TARGET_ERROR = 401; // Target参数错误 } enum CmdErrorCode { OK = 0; // 成功 } // TaskStatus 任务状态 enum TaskStatus { ALL = 0; // 全部 WAITING = 1; // 等待中 READY = 2; // 上传完毕 RUNNING = 3; // 运行中 SUCCESS = 4; // 成功 FAIL = 5; // 失败 DELETED = 10; // 已删除,仅在执行删除成功时返回 } enum OS { OS_UNKNOWN = 0; IOS = 1; ANDROID = 2; } // MAX 最大限定 enum MAX { MAX_UNKNOWN = 0; U8 = 64; U32 = 8; FLAG = 4; }