修改包名
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cid/syncdata"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"cid/sync"
|
|
||||||
|
|
||||||
"gitea.com/red-future/common/beans"
|
"gitea.com/red-future/common/beans"
|
||||||
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
_ "github.com/gogf/gf/contrib/drivers/pgsql/v2"
|
||||||
|
|
||||||
@@ -16,27 +15,27 @@ import (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
ctx := gctx.New()
|
ctx := gctx.New()
|
||||||
syncService := sync.NewSyncService()
|
syncService := syncdata.NewSyncService()
|
||||||
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin"})
|
ctx = context.WithValue(ctx, "user", &beans.User{UserName: "admin"})
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
lastHourEnd := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
|
lastHourEnd := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())
|
||||||
lastHourStart := lastHourEnd.Add(-1 * time.Hour)
|
lastHourStart := lastHourEnd.Add(-1 * time.Hour)
|
||||||
|
|
||||||
req := &sync.AccountReportRequest{
|
req := &syncdata.AccountReportRequest{
|
||||||
AdvertiserID: 10001,
|
AdvertiserID: 10001,
|
||||||
StartTime: lastHourStart.UnixMilli(),
|
StartTime: lastHourStart.UnixMilli(),
|
||||||
EndTime: lastHourEnd.UnixMilli(),
|
EndTime: lastHourEnd.UnixMilli(),
|
||||||
SelectColumns: []string{"impression", "click", "cost", "t0GMV"},
|
SelectColumns: []string{"impression", "click", "cost", "t0GMV"},
|
||||||
GroupType: 1,
|
GroupType: 1,
|
||||||
QueryVersion: 1,
|
QueryVersion: 1,
|
||||||
PageInfo: &sync.PageInfo{
|
PageInfo: &syncdata.PageInfo{
|
||||||
CurrentPage: 1,
|
CurrentPage: 1,
|
||||||
PageSize: 10,
|
PageSize: 10,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
config := sync.ConcurrentSyncConfig{
|
config := syncdata.ConcurrentSyncConfig{
|
||||||
MaxConcurrency: 5,
|
MaxConcurrency: 5,
|
||||||
UseMock: true,
|
UseMock: true,
|
||||||
MaxRetries: 3,
|
MaxRetries: 3,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
dao "cid/dao/copydata"
|
dao "cid/dao/copydata"
|
||||||
taskDto "cid/model/dto/copydata"
|
taskDto "cid/model/dto/copydata"
|
||||||
"cid/sync"
|
"cid/syncdata"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -17,13 +17,13 @@ import (
|
|||||||
|
|
||||||
// CompensationScheduler 补偿调度器,负责扫描和补偿失败的分页同步任务
|
// CompensationScheduler 补偿调度器,负责扫描和补偿失败的分页同步任务
|
||||||
type CompensationScheduler struct {
|
type CompensationScheduler struct {
|
||||||
syncService *sync.SyncService
|
syncService *syncdata.SyncService
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCompensationScheduler 创建补偿调度器实例
|
// NewCompensationScheduler 创建补偿调度器实例
|
||||||
func NewCompensationScheduler() *CompensationScheduler {
|
func NewCompensationScheduler() *CompensationScheduler {
|
||||||
return &CompensationScheduler{
|
return &CompensationScheduler{
|
||||||
syncService: sync.NewSyncService(),
|
syncService: syncdata.NewSyncService(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,14 +130,14 @@ func (s *CompensationScheduler) compensatePageTask(ctx context.Context, pageTask
|
|||||||
|
|
||||||
pageSize := s.extractPageSize(pageTask)
|
pageSize := s.extractPageSize(pageTask)
|
||||||
|
|
||||||
req := &sync.AccountReportRequest{
|
req := &syncdata.AccountReportRequest{
|
||||||
AdvertiserID: pageTask.AdvertiserID,
|
AdvertiserID: pageTask.AdvertiserID,
|
||||||
StartTime: startTime.UnixMilli(),
|
StartTime: startTime.UnixMilli(),
|
||||||
EndTime: endTime.UnixMilli(),
|
EndTime: endTime.UnixMilli(),
|
||||||
SelectColumns: []string{"impression", "click", "cost", "t0GMV"},
|
SelectColumns: []string{"impression", "click", "cost", "t0GMV"},
|
||||||
GroupType: 1,
|
GroupType: 1,
|
||||||
QueryVersion: 1,
|
QueryVersion: 1,
|
||||||
PageInfo: &sync.PageInfo{
|
PageInfo: &syncdata.PageInfo{
|
||||||
CurrentPage: pageNumber,
|
CurrentPage: pageNumber,
|
||||||
PageSize: pageSize,
|
PageSize: pageSize,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
dto "cid/model/dto/copydata"
|
dto "cid/model/dto/copydata"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
type AccountReportRequest struct {
|
type AccountReportRequest struct {
|
||||||
AdvertiserID int64 `json:"advertiser_id"`
|
AdvertiserID int64 `json:"advertiser_id"`
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"cid/model/dto/copydata"
|
"cid/model/dto/copydata"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
dao "cid/dao/copydata"
|
dao "cid/dao/copydata"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package sync
|
package syncdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
Reference in New Issue
Block a user