40 lines
1010 B
Go
40 lines
1010 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"cid/sync"
|
|
|
|
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
|
|
|
"github.com/gogf/gf/v2/os/gctx"
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func main() {
|
|
ctx := gctx.New()
|
|
syncService := sync.NewSyncService()
|
|
|
|
req := &sync.CampaignReportRequest{
|
|
AdvertiserID: 10001,
|
|
StartTime: time.Now().AddDate(0, 0, -30).UnixNano() / 1e6,
|
|
EndTime: time.Now().UnixNano() / 1e6,
|
|
SelectColumns: []string{"impression", "click", "cost", "t0GMV"},
|
|
GroupType: 1,
|
|
QueryVersion: 1,
|
|
}
|
|
|
|
logrus.Info("=== 开始执行定时同步任务 ===")
|
|
result, err := syncService.SyncCampaignReportWithPagination(ctx, req, true, 3)
|
|
if err != nil {
|
|
logrus.Errorf("定时同步任务失败:%v", err)
|
|
return
|
|
}
|
|
|
|
fmt.Printf("✓ 定时同步完成:\n")
|
|
fmt.Printf(" 汇总数据:成功=%v, ID=%d\n", result.SumSuccess, result.SumID)
|
|
fmt.Printf(" 明细数据:总数=%d, 成功=%d, 失败=%d\n",
|
|
result.DetailCount, result.DetailSuccessCount, result.DetailFailCount)
|
|
}
|