初始化项目
This commit is contained in:
@@ -81,35 +81,6 @@ func (s *adPosition) List(ctx context.Context, req *dto.ListAdPositionReq) (res
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatistics 获取广告位统计数据
|
||||
func (s *adPosition) GetStatistics(ctx context.Context, req *dto.GetAdPositionStatisticsReq) (res *dto.GetAdPositionStatisticsRes, err error) {
|
||||
statReq := &dto.GetAdStatisticsReq{
|
||||
StatType: "adPosition",
|
||||
StatDimension: req.StatType,
|
||||
TargetId: req.Id,
|
||||
StartDate: req.StartDate,
|
||||
EndDate: req.EndDate,
|
||||
DeviceType: "",
|
||||
Platform: "",
|
||||
Region: "",
|
||||
Gender: "",
|
||||
AgeGroup: "",
|
||||
SortBy: "",
|
||||
SortDirection: "",
|
||||
}
|
||||
|
||||
list, total, err := dao.AdStatistics.GetStatistics(ctx, statReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = &dto.GetAdPositionStatisticsRes{
|
||||
Statistics: list,
|
||||
Total: int(total),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// GetByCode 根据编码获取广告位
|
||||
func (s *adPosition) GetByCode(ctx context.Context, code string) (adPosition *entity.AdPosition, err error) {
|
||||
return dao.AdPosition.GetByCode(ctx, code)
|
||||
|
||||
@@ -92,35 +92,6 @@ func (s *advertisement) List(ctx context.Context, req *dto.ListAdvertisementReq)
|
||||
return
|
||||
}
|
||||
|
||||
// GetStatistics 获取广告统计数据
|
||||
func (s *advertisement) GetStatistics(ctx context.Context, req *dto.GetAdStatisticsForAdvertisementReq) (res *dto.GetAdStatisticsForAdvertisementRes, err error) {
|
||||
statReq := &dto.GetAdStatisticsReq{
|
||||
StatType: "advertisement",
|
||||
StatDimension: req.StatType,
|
||||
TargetId: req.Id,
|
||||
StartDate: req.StartDate,
|
||||
EndDate: req.EndDate,
|
||||
DeviceType: "",
|
||||
Platform: "",
|
||||
Region: "",
|
||||
Gender: "",
|
||||
AgeGroup: "",
|
||||
SortBy: "",
|
||||
SortDirection: "",
|
||||
}
|
||||
|
||||
list, _, err := dao.AdStatistics.GetStatistics(ctx, statReq)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
res = &dto.GetAdStatisticsForAdvertisementRes{
|
||||
Statistics: list,
|
||||
}
|
||||
// Total字段不存在,已移除
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateAdStatistics 更新广告统计
|
||||
func (s *advertisement) UpdateAdStatistics(ctx context.Context, id string, impressions, clicks, conversions int64, cost int64) (err error) {
|
||||
// 获取广告信息
|
||||
|
||||
@@ -311,23 +311,6 @@ func (s *cidService) recordCIDRequest(ctx context.Context, req *dto.GenerateCIDR
|
||||
dao.CIDRequest.Create(ctx, request)
|
||||
}
|
||||
|
||||
// GetCIDStatistics 获取CID统计信息
|
||||
func (s *cidService) GetCIDStatistics(ctx context.Context, req *dto.GetCIDStatisticsReq) (res *dto.GetCIDStatisticsRes, err error) {
|
||||
// 这里应该实现真实的统计逻辑
|
||||
// 暂时返回模拟数据
|
||||
return &dto.GetCIDStatisticsRes{
|
||||
TotalRequests: int64(rand.Intn(9000) + 1000),
|
||||
SuccessfulReq: int64(rand.Intn(8100) + 900),
|
||||
AverageProcessTime: rand.Float64()*200 + 50,
|
||||
TopSources: []string{"self", "google", "facebook"},
|
||||
ConversionStats: map[string]float64{
|
||||
"self": rand.Float64() * 0.1,
|
||||
"google": rand.Float64() * 0.2,
|
||||
"facebook": rand.Float64() * 0.15,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
// GetCIDHistory 获取CID请求历史
|
||||
func (s *cidService) GetCIDHistory(ctx context.Context, userId int64, page, size int) (res *dto.GetCIDHistoryRes, err error) {
|
||||
history, total, err := dao.CIDRequest.GetHistory(ctx, userId, page, size)
|
||||
|
||||
Reference in New Issue
Block a user