From 1c29e4d492359bac923698e800ef8bbb50d6695c Mon Sep 17 00:00:00 2001 From: dylan Date: Fri, 30 Aug 2024 11:19:06 +0800 Subject: [PATCH] =?UTF-8?q?feat:UD=E6=8A=A5=E8=A1=A8-=E6=97=A5=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- defaultability/Defaultability.go | 17 +++ .../domain/ReportFilterTopQueryDTO.go | 58 +++++++++ .../TaobaoUnideskRtaReportDailyQueryDto.go | 113 ++++++++++++++++++ .../domain/UnideskRtaReportDailyGet.go | 85 +++++++++++++ .../TaobaoUnideskRtaReportDailyGetRequest.go | 28 +++++ .../TaobaoUnideskRtaReportDailyGetResponse.go | 14 +++ 6 files changed, 315 insertions(+) create mode 100644 defaultability/domain/ReportFilterTopQueryDTO.go create mode 100644 defaultability/domain/TaobaoUnideskRtaReportDailyQueryDto.go create mode 100644 defaultability/domain/UnideskRtaReportDailyGet.go create mode 100644 defaultability/request/TaobaoUnideskRtaReportDailyGetRequest.go create mode 100644 defaultability/response/TaobaoUnideskRtaReportDailyGetResponse.go diff --git a/defaultability/Defaultability.go b/defaultability/Defaultability.go index 29e8055..9d7c494 100644 --- a/defaultability/Defaultability.go +++ b/defaultability/Defaultability.go @@ -150,3 +150,20 @@ func (ability *Defaultability) TaobaoUnideskRtaUserAdvertiserGet(req *request.Ta err = util.HandleJsonResponse(jsonStr, &respStruct) return &respStruct, err } + +/* +UD报表-日报表数据查询接口 +*/ +func (ability *Defaultability) TaobaoUnideskRtaReportDailyGet(req *request.TaobaoUnideskRtaReportDailyGetRequest, accessToken string) (*response.TaobaoUnideskRtaReportDailyGetResponse, error) { + if ability.Client == nil { + return nil, errors.New("Defaultability topClient is nil") + } + var jsonStr, err = ability.Client.ExecuteWithSession("taobao.unidesk.rta.report.daily.get", req.ToMap(), req.ToFileMap(), accessToken) + var respStruct = response.TaobaoUnideskRtaReportDailyGetResponse{} + if err != nil { + log.Println("taobaoUnideskRtaReportDailyGet error", err) + return &respStruct, err + } + err = util.HandleJsonResponse(jsonStr, &respStruct) + return &respStruct, err +} diff --git a/defaultability/domain/ReportFilterTopQueryDTO.go b/defaultability/domain/ReportFilterTopQueryDTO.go new file mode 100644 index 0000000..eb05150 --- /dev/null +++ b/defaultability/domain/ReportFilterTopQueryDTO.go @@ -0,0 +1,58 @@ +package domain + +type ReportFilterTopQueryDTO struct { + /* + 按照计划过滤 + */ + AdgroupIds *[]int64 `json:"adgroup_ids,omitempty" required:"false"` + /* + 转化效果周期,7:7天,15:15天 + */ + Effect *int `json:"effect,omitempty" required:"false"` + /* + 按照计划组过滤 + */ + CampaignIds *[]int64 `json:"campaign_ids,omitempty" required:"false"` + /* + 按照创意过滤 + */ + CreativeIds *[]int64 `json:"creative_ids,omitempty" required:"false"` + /* + 归因逻辑,1:点击效果,0:展示效果 + */ + EffectType *int `json:"effect_type,omitempty" required:"false"` + /* + 按照素材过滤,素材id从adgroup查询接口获取,素材组合报表只支持根据标题素材id筛选 + */ + MaterialId *int `json:"material_id,omitempty" required:"false"` +} + +func (s *ReportFilterTopQueryDTO) SetAdgroupIds(v []int64) *ReportFilterTopQueryDTO { + s.AdgroupIds = &v + return s +} + +func (s *ReportFilterTopQueryDTO) SetEffect(v int) *ReportFilterTopQueryDTO { + s.Effect = &v + return s +} + +func (s *ReportFilterTopQueryDTO) SetCampaignIds(v []int64) *ReportFilterTopQueryDTO { + s.CampaignIds = &v + return s +} + +func (s *ReportFilterTopQueryDTO) SetCreativeIds(v []int64) *ReportFilterTopQueryDTO { + s.CreativeIds = &v + return s +} + +func (s *ReportFilterTopQueryDTO) SetEffectType(v int) *ReportFilterTopQueryDTO { + s.EffectType = &v + return s +} + +func (s *ReportFilterTopQueryDTO) SetMaterialId(v int) *ReportFilterTopQueryDTO { + s.MaterialId = &v + return s +} diff --git a/defaultability/domain/TaobaoUnideskRtaReportDailyQueryDto.go b/defaultability/domain/TaobaoUnideskRtaReportDailyQueryDto.go new file mode 100644 index 0000000..758c39c --- /dev/null +++ b/defaultability/domain/TaobaoUnideskRtaReportDailyQueryDto.go @@ -0,0 +1,113 @@ +package domain + +type ReportTopQueryDTO struct { + /* + 排序字段 + */ + OrderByField *string `json:"order_by_field,omitempty" required:"false" ` + + /* + 结束日期,只支持查询近7天的数据,格式yyyy-MM-dd + */ + EndDate *string `json:"end_date" required:"true"` + + /* + 第几页 + */ + PageNo *int `json:"page_no,omitempty" required:"false"` + + /* + 排序方式,ASC:正序、DESC:倒序 + */ + OrderByType *string `json:"order_by_type,omitempty" required:"false"` + + /* + 每页多少条 + */ + PageSize *int `json:"page_size,omitempty" required:"false"` + + /* + 分组条件,素材分组仅头条2.0支持,STAT_GROUP_BY_ADVERTISER_ID:按照广告主分组,STAT_GROUP_BY_CAMPAIGN_ID:按照计划组分组,STAT_GROUP_BY_ADGROUP_ID:按照计划分组,STAT_GROUP_BY_CREATIVE_ID:按照创意分组,STAT_GROUP_BY_TIME_DAY:按照天分组,STAT_GROUP_BY_MATERIAL_ID:按照素材分组,STAT_GROUP_BY_MATERIAL_X_ADGROUP_ID:按照素材X计划分组,STAT_GROUP_BY_COMBINATION_MATERIAL_ID:按照素材组合分组,STAT_GROUP_BY_COMBINATION_MATERIALX_CAMPAIGN_ID:按照素材组合X项目分组 + */ + GroupBy *[]string `json:"group_by" required:"true"` + + /* + 需要返回的指标,不指定则返回默认指标 + */ + Fields *[]string `json:"fields,omitempty" required:"false"` + + /* + 过滤条件 + */ + Filtering *ReportFilterTopQueryDTO `json:"filtering,omitempty" required:"false"` + + /* + 开始日期,只支持查询近7天的数据,格式yyyy-MM-dd + */ + StartDate *string `json:"start_date" required:"true"` + + /* + 广告主id + */ + AdvertiserId *int64 `json:"advertiser_id" required:"true"` + + /* + 平台版本,9999:升级版API(仅巨量2.0API需传入) + */ + Version *int `json:"version,omitempty" required:"false"` +} + +func (s *ReportTopQueryDTO) SetOrderByField(v string) *ReportTopQueryDTO { + s.OrderByField = &v + return s +} + +func (s *ReportTopQueryDTO) SetEndDate(v string) *ReportTopQueryDTO { + s.EndDate = &v + return s +} + +func (s *ReportTopQueryDTO) SetPageNo(v int) *ReportTopQueryDTO { + s.PageNo = &v + return s +} + +func (s *ReportTopQueryDTO) SetOrderByType(v string) *ReportTopQueryDTO { + s.OrderByType = &v + return s +} + +func (s *ReportTopQueryDTO) SetPageSize(v int) *ReportTopQueryDTO { + s.PageSize = &v + return s +} + +func (s *ReportTopQueryDTO) SetGroupBy(v []string) *ReportTopQueryDTO { + s.GroupBy = &v + return s +} + +func (s *ReportTopQueryDTO) SetFields(v []string) *ReportTopQueryDTO { + s.Fields = &v + return s +} + +func (s *ReportTopQueryDTO) SetFiltering(v ReportFilterTopQueryDTO) *ReportTopQueryDTO { + s.Filtering = &v + return s +} + +func (s *ReportTopQueryDTO) SetStartDate(v string) *ReportTopQueryDTO { + s.StartDate = &v + return s +} + +func (s *ReportTopQueryDTO) SetAdvertiserId(v int64) *ReportTopQueryDTO { + s.AdvertiserId = &v + return s +} + +func (s *ReportTopQueryDTO) SetVersion(v int) *ReportTopQueryDTO { + s.Version = &v + return s +} diff --git a/defaultability/domain/UnideskRtaReportDailyGet.go b/defaultability/domain/UnideskRtaReportDailyGet.go new file mode 100644 index 0000000..1a80851 --- /dev/null +++ b/defaultability/domain/UnideskRtaReportDailyGet.go @@ -0,0 +1,85 @@ +package domain + +type ReportTopDto struct { + FavoriteStores int `json:"favorite_stores"` + PlayNums99 int `json:"play_nums99"` + WifiPlayPercent string `json:"wifi_play_percent"` + PreAlipayVolume int `json:"pre_alipay_volume"` + CollectionCost string `json:"collection_cost"` + SearchCost string `json:"search_cost"` + Convert int `json:"convert"` + EffectPlayRate string `json:"effect_play_rate"` + DirectPreAlipayAmount string `json:"direct_pre_alipay_amount"` + AdgroupId int `json:"adgroup_id"` + DirectTransactionAmount string `json:"direct_transaction_amount"` + LiveRechargeNums int `json:"live_recharge_nums"` + ShareNums int `json:"share_nums"` + DirectReturnOnInvestment string `json:"direct_return_on_investment"` + Day string `json:"day"` + AlipayCost string `json:"alipay_cost"` + PageArriveUv int `json:"page_arrive_uv"` + PageArrive int `json:"page_arrive"` + AdPv int `json:"ad_pv"` + DirectPreAlipayVolume int `json:"direct_pre_alipay_volume"` + CampaignId int `json:"campaign_id"` + DirectAlipayCost string `json:"direct_alipay_cost"` + ReturnOnInvestment string `json:"return_on_investment"` + LiveWatchNums int `json:"live_watch_nums"` + Click int `json:"click"` + DirectTakeOrderAmount string `json:"direct_take_order_amount"` + VisitTime string `json:"visit_time"` + PlayOverNums int `json:"play_over_nums"` + Ecpm string `json:"ecpm"` + FinishPlayRate string `json:"finish_play_rate"` + VisitCost string `json:"visit_cost"` + EffectPlayCost string `json:"effect_play_cost"` + PlayNums50 int `json:"play_nums50"` + TakeOrderVolume int `json:"take_order_volume"` + Ecpc string `json:"ecpc"` + VisitVolume int `json:"visit_volume"` + FavoriteBabyVolume int `json:"favorite_baby_volume"` + EffectPlayNums int `json:"effect_play_nums"` + LiveInteractionNums int `json:"live_interaction_nums"` + DirectTransactionVolume int `json:"direct_transaction_volume"` + CreativeId int `json:"creative_id"` + DirectAddCartVolume int `json:"direct_add_cart_volume"` + ConvertRate string `json:"convert_rate"` + TransactionAmount int `json:"transaction_amount"` + PreAlipayAmount int `json:"pre_alipay_amount"` + LiveLikeNums int `json:"live_like_nums"` + LiveRechargeAmount int `json:"live_recharge_amount"` + LikeNums int `json:"like_nums"` + LiveAverageWatchTime string `json:"live_average_watch_time"` + VisitPageVolume string `json:"visit_page_volume"` + BuyCost string `json:"buy_cost"` + LiveFollowNums int `json:"live_follow_nums"` + SearchVolume int `json:"search_volume"` + Cost int `json:"cost"` + DirectFavoriteBabyVolume int `json:"direct_favorite_baby_volume"` + PlayNums25 int `json:"play_nums25"` + TransactionVolume int `json:"transaction_volume"` + AveragePlayTime string `json:"average_play_time"` + LiveCommentNums int `json:"live_comment_nums"` + AdvertiserId int `json:"advertiser_id"` + DirectTakeOrderVolume int `json:"direct_take_order_volume"` + TakeOrderAmount int `json:"take_order_amount"` + AddCartVolume int `json:"add_cart_volume"` + PlayNums int `json:"play_nums"` + DepthStoreVolume int `json:"depth_store_volume"` + AdCtr string `json:"ad_ctr"` + ConvertCost string `json:"convert_cost"` + PlayNums75 int `json:"play_nums75"` + Play3SCount int `json:"play3s_count"` + Play5SCount int `json:"play5s_count"` + Play7SCount int `json:"play7s_count"` + PlatformPageViewCount int `json:"platform_page_view_count"` + LanButtonClickCount int `json:"lan_button_click_count"` + LanJumpButtonClickers int `json:"lan_jump_button_clickers"` + LanJumpButtonClickRate string `json:"lan_jump_button_click_rate"` + MaterialId int `json:"material_id"` + TitleMaterialId int `json:"title_material_id"` + ImageMaterialId int `json:"image_material_id"` + VideoMaterialId int `json:"video_material_id"` + CampaignName string `json:"campaign_name"` + AdgroupName string `json:"adgroup_name"` +} diff --git a/defaultability/request/TaobaoUnideskRtaReportDailyGetRequest.go b/defaultability/request/TaobaoUnideskRtaReportDailyGetRequest.go new file mode 100644 index 0000000..8a59077 --- /dev/null +++ b/defaultability/request/TaobaoUnideskRtaReportDailyGetRequest.go @@ -0,0 +1,28 @@ +package request + +import ( + "git.sunqdl.cn/fgqj/topsdk/defaultability/domain" + "git.sunqdl.cn/fgqj/topsdk/util" +) + +type TaobaoUnideskRtaReportDailyGetRequest struct { + ReportTopQueryDTO *domain.ReportTopQueryDTO `json:"report_top_query_dto" required:"true" ` +} + +func (s *TaobaoUnideskRtaReportDailyGetRequest) SetAdvertiserTopQueryDTO(v domain.ReportTopQueryDTO) *TaobaoUnideskRtaReportDailyGetRequest { + s.ReportTopQueryDTO = &v + return s +} + +func (req *TaobaoUnideskRtaReportDailyGetRequest) ToMap() map[string]interface{} { + paramMap := make(map[string]interface{}) + if req.ReportTopQueryDTO != nil { + paramMap["advertiser_top_query_dto"] = util.ConvertStructList(*req.ReportTopQueryDTO) + } + return paramMap +} + +func (req *TaobaoUnideskRtaReportDailyGetRequest) ToFileMap() map[string]interface{} { + fileMap := make(map[string]interface{}) + return fileMap +} diff --git a/defaultability/response/TaobaoUnideskRtaReportDailyGetResponse.go b/defaultability/response/TaobaoUnideskRtaReportDailyGetResponse.go new file mode 100644 index 0000000..1fa3491 --- /dev/null +++ b/defaultability/response/TaobaoUnideskRtaReportDailyGetResponse.go @@ -0,0 +1,14 @@ +package response + +import "git.sunqdl.cn/fgqj/topsdk/defaultability/domain" + +type TaobaoUnideskRtaReportDailyGetResponse struct { + /* + 报表数据 + */ + Result []domain.ReportTopDto `json:"result"` + /* + 总条数 + */ + Total int `json:"total"` +}