添加sql脚本,修复模块
This commit is contained in:
1478
api-complete.json
Normal file
1478
api-complete.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2,11 +2,11 @@ package public
|
||||
|
||||
// PostgreSQL表名常量
|
||||
const (
|
||||
ApiInterfaceTable = "cid_api_interface" // 接口管理表
|
||||
ApiInterfaceTable = "api_interface" // 接口管理表
|
||||
CidAccountReportDetailTable = "cid_account_report_detail" // 广告账户数据明细表
|
||||
CidAccountReportSumTable = "cid_account_report_sum" // 广告账户数据汇总表
|
||||
FieldMappingConfigTable = "field_mapping_config" // 字段映射表
|
||||
DatasourcePlatformTable = "datasource_platform" // 数据源平台表
|
||||
FieldMappingConfigTable = "api_field_mapping_config" // 字段映射表
|
||||
DatasourcePlatformTable = "api_datasource_platform" // 数据源平台表
|
||||
TaskReportTable = "task_report" // 调控任务数据表
|
||||
PopulationReportTable = "population_report" // 人群报表表
|
||||
MaterialReportTable = "material_report" // 素材报表表
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
)
|
||||
|
||||
type AccountReport struct{}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
)
|
||||
|
||||
type creativeReport struct{}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
)
|
||||
|
||||
type materialReport struct{}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
)
|
||||
|
||||
type storewideReport struct{}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
service "cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
service "dataengine/service/copydata"
|
||||
)
|
||||
|
||||
type taskReport struct{}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
"cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"dataengine/service/copydata"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/dict"
|
||||
service "cid/service/dict"
|
||||
"context"
|
||||
dto "dataengine/model/dto/dict"
|
||||
service "dataengine/service/dict"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/dict"
|
||||
service "cid/service/dict"
|
||||
"context"
|
||||
dto "dataengine/model/dto/dict"
|
||||
service "dataengine/service/dict"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/dict"
|
||||
service "cid/service/dict"
|
||||
"context"
|
||||
dto "dataengine/model/dto/dict"
|
||||
service "dataengine/service/dict"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts1 "cid/consts/api-feature"
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
consts1 "dataengine/consts/api-feature"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/public"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
consts "dataengine/consts/public"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
|
||||
"gitea.com/red-future/common/db/gfdb"
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
|
||||
34
go.mod
34
go.mod
@@ -1,4 +1,4 @@
|
||||
module cid
|
||||
module dataengine
|
||||
|
||||
go 1.26.0
|
||||
|
||||
@@ -22,16 +22,22 @@ require (
|
||||
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/clbanning/mxj/v2 v2.7.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/dgraph-io/badger/v4 v4.2.0 // indirect
|
||||
github.com/dgraph-io/ristretto v0.1.1 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
|
||||
github.com/emirpasic/gods/v2 v2.0.0-alpha // indirect
|
||||
github.com/fatih/color v1.18.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.9.0 // indirect
|
||||
github.com/go-ego/gse v1.0.2 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/gogf/gf/contrib/registry/consul/v2 v2.9.5 // indirect
|
||||
github.com/gogf/gf/contrib/trace/otlphttp/v2 v2.9.5 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
@@ -41,6 +47,7 @@ require (
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/flatbuffers v1.12.1 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
|
||||
github.com/grokify/html-strip-tags-go v0.1.0 // indirect
|
||||
@@ -54,23 +61,31 @@ require (
|
||||
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
|
||||
github.com/hashicorp/golang-lru v1.0.2 // indirect
|
||||
github.com/hashicorp/serf v0.10.1 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/lib/pq v1.10.9 // indirect
|
||||
github.com/magiconair/properties v1.8.10 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/olekukonko/ll v0.0.9 // indirect
|
||||
github.com/olekukonko/tablewriter v1.1.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/r3labs/diff/v2 v2.15.1 // indirect
|
||||
github.com/redis/go-redis/v9 v9.12.1 // indirect
|
||||
github.com/rivo/uniseg v0.4.7 // indirect
|
||||
github.com/spf13/pflag v1.0.9 // indirect
|
||||
github.com/tiger1103/gfast-token v1.0.10 // indirect
|
||||
github.com/vcaesar/cedar v0.30.0 // indirect
|
||||
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
go.mongodb.org/mongo-driver/v2 v2.4.0 // indirect
|
||||
go.opencensus.io v0.23.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
@@ -81,13 +96,30 @@ require (
|
||||
go.opentelemetry.io/otel/sdk v1.38.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.38.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.7.1 // indirect
|
||||
go.yaml.in/yaml/v2 v2.4.3 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.4 // indirect
|
||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
|
||||
golang.org/x/oauth2 v0.30.0 // indirect
|
||||
golang.org/x/sys v0.38.0 // indirect
|
||||
golang.org/x/term v0.37.0 // indirect
|
||||
golang.org/x/text v0.31.0 // indirect
|
||||
golang.org/x/time v0.9.0 // indirect
|
||||
google.golang.org/appengine v1.6.7 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
|
||||
google.golang.org/grpc v1.75.0 // indirect
|
||||
google.golang.org/protobuf v1.36.8 // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
k8s.io/api v0.35.3 // indirect
|
||||
k8s.io/apimachinery v0.35.3 // indirect
|
||||
k8s.io/client-go v0.35.3 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect
|
||||
k8s.io/utils v0.0.0-20251002143259-bc988d571ff4 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
|
||||
sigs.k8s.io/yaml v1.6.0 // indirect
|
||||
)
|
||||
|
||||
4
main.go
4
main.go
@@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cid/controller/copydata"
|
||||
"cid/controller/dict"
|
||||
"dataengine/controller/copydata"
|
||||
"dataengine/controller/dict"
|
||||
|
||||
"gitea.com/red-future/common/http"
|
||||
"gitea.com/red-future/common/jaeger"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package api_feature
|
||||
|
||||
import (
|
||||
"cid/consts/api-feature"
|
||||
entity "cid/model/entity/dict"
|
||||
"dataengine/consts/api-feature"
|
||||
entity "dataengine/model/entity/dict"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package api_feature
|
||||
|
||||
import (
|
||||
entity "cid/model/entity/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"time"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package api_feature
|
||||
|
||||
import (
|
||||
"cid/consts/api-feature"
|
||||
entity "cid/model/entity/dict"
|
||||
"dataengine/consts/api-feature"
|
||||
entity "dataengine/model/entity/dict"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/api-feature"
|
||||
consts "dataengine/consts/api-feature"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"cid/syncdata"
|
||||
"context"
|
||||
"dataengine/syncdata"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
taskDto "cid/model/dto/copydata"
|
||||
"cid/syncdata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
taskDto "dataengine/model/dto/copydata"
|
||||
"dataengine/syncdata"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
entities "cid/entities"
|
||||
entities "dataengine/entities"
|
||||
)
|
||||
|
||||
// APIService API服务接口
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
)
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
entity "cid/model/entity/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
entity "dataengine/model/entity/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package copydata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"errors"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
api_feature "cid/consts/api-feature"
|
||||
dao "cid/dao/dict"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
api_feature "dataengine/consts/api-feature"
|
||||
dao "dataengine/dao/dict"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/dict"
|
||||
"cid/dao/dict"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
consts "dataengine/consts/dict"
|
||||
"dataengine/dao/dict"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
consts "cid/consts/api-feature"
|
||||
"cid/dao/dict"
|
||||
dto "cid/model/dto/dict"
|
||||
entity "cid/model/entity/dict"
|
||||
"context"
|
||||
consts "dataengine/consts/api-feature"
|
||||
"dataengine/dao/dict"
|
||||
dto "dataengine/model/dto/dict"
|
||||
entity "dataengine/model/entity/dict"
|
||||
"errors"
|
||||
)
|
||||
|
||||
|
||||
38
sql/00_main_schema.sql
Normal file
38
sql/00_main_schema.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
-- PostgreSQL Database Schema for Data Engine
|
||||
-- Generated from Go entity classes
|
||||
-- This file serves as the main schema file that imports all other schema files
|
||||
-- Execute in the following order:
|
||||
-- 1. 00_main_schema.sql (this file)
|
||||
-- 2. 01_dict_tables.sql
|
||||
-- 3. 02_account_report_tables.sql
|
||||
-- 4. 03_campaign_report_tables.sql
|
||||
-- 5. 04_creative_report_tables.sql
|
||||
-- 6. 05_unit_report_tables.sql
|
||||
-- 7. 06_storewide_report_tables.sql
|
||||
-- 8. 07_material_population_tables.sql
|
||||
-- 9. 08_sync_task_tables.sql
|
||||
|
||||
-- =============================================
|
||||
-- Database Settings
|
||||
-- =============================================
|
||||
-- Set timezone (optional, adjust as needed)
|
||||
SET timezone = 'Asia/Shanghai';
|
||||
|
||||
-- =============================================
|
||||
-- Import all schema files
|
||||
-- =============================================
|
||||
|
||||
\i 01_dict_tables.sql
|
||||
\i 02_account_report_tables.sql
|
||||
\i 03_campaign_report_tables.sql
|
||||
\i 04_creative_report_tables.sql
|
||||
\i 05_unit_report_tables.sql
|
||||
\i 06_storewide_report_tables.sql
|
||||
\i 07_material_population_tables.sql
|
||||
\i 08_sync_task_tables.sql
|
||||
|
||||
-- =============================================
|
||||
-- Grant permissions (optional, adjust as needed)
|
||||
-- =============================================
|
||||
-- GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO your_user;
|
||||
-- GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO your_user;
|
||||
183
sql/01_dict_tables.sql
Normal file
183
sql/01_dict_tables.sql
Normal file
@@ -0,0 +1,183 @@
|
||||
-- PostgreSQL 建表脚本 - dict 包
|
||||
|
||||
-- =============================================
|
||||
-- 数据源平台配置表 (api_datasource_platform)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS api_datasource_platform_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS api_datasource_platform (
|
||||
id BIGINT NOT NULL DEFAULT nextval('api_datasource_platform_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
platform_code VARCHAR(100) NOT NULL,
|
||||
platform_name VARCHAR(200) NOT NULL,
|
||||
description TEXT,
|
||||
status VARCHAR(50) DEFAULT 'ACTIVE',
|
||||
api_base_url VARCHAR(500),
|
||||
auth_type VARCHAR(50) DEFAULT 'API_KEY',
|
||||
token VARCHAR(500),
|
||||
api_key VARCHAR(500),
|
||||
client_id VARCHAR(200),
|
||||
client_secret VARCHAR(500),
|
||||
rate_limit_per_minute INT DEFAULT 60,
|
||||
rate_limit_per_hour INT DEFAULT 3600,
|
||||
concurrency_limit INT DEFAULT 10,
|
||||
request_timeout_ms INT DEFAULT 30000,
|
||||
max_retries INT DEFAULT 3,
|
||||
retry_delay_ms INT DEFAULT 1000,
|
||||
version INT DEFAULT 0,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE api_datasource_platform IS '数据源平台配置表';
|
||||
COMMENT ON COLUMN api_datasource_platform.id IS '主键ID';
|
||||
COMMENT ON COLUMN api_datasource_platform.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN api_datasource_platform.creator IS '创建人';
|
||||
COMMENT ON COLUMN api_datasource_platform.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN api_datasource_platform.updater IS '更新人';
|
||||
COMMENT ON COLUMN api_datasource_platform.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN api_datasource_platform.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN api_datasource_platform.platform_code IS '平台编码,唯一标识';
|
||||
COMMENT ON COLUMN api_datasource_platform.platform_name IS '平台名称';
|
||||
COMMENT ON COLUMN api_datasource_platform.description IS '平台描述';
|
||||
COMMENT ON COLUMN api_datasource_platform.status IS '状态: ACTIVE启用, INACTIVE停用';
|
||||
COMMENT ON COLUMN api_datasource_platform.api_base_url IS 'API基础地址';
|
||||
COMMENT ON COLUMN api_datasource_platform.auth_type IS '认证类型: TOKEN/API_KEY/OAUTH2/BASIC';
|
||||
COMMENT ON COLUMN api_datasource_platform.token IS '认证token/密钥';
|
||||
COMMENT ON COLUMN api_datasource_platform.api_key IS 'API Key';
|
||||
COMMENT ON COLUMN api_datasource_platform.client_id IS 'OAuth2 Client ID';
|
||||
COMMENT ON COLUMN api_datasource_platform.client_secret IS 'OAuth2 Client Secret';
|
||||
COMMENT ON COLUMN api_datasource_platform.rate_limit_per_minute IS '每分钟请求限制';
|
||||
COMMENT ON COLUMN api_datasource_platform.rate_limit_per_hour IS '每小时请求限制';
|
||||
COMMENT ON COLUMN api_datasource_platform.concurrency_limit IS '并发连接限制';
|
||||
COMMENT ON COLUMN api_datasource_platform.request_timeout_ms IS '请求超时时间(毫秒)';
|
||||
COMMENT ON COLUMN api_datasource_platform.max_retries IS '最大重试次数';
|
||||
COMMENT ON COLUMN api_datasource_platform.retry_delay_ms IS '重试延迟(毫秒)';
|
||||
COMMENT ON COLUMN api_datasource_platform.version IS '版本号(乐观锁)';
|
||||
|
||||
CREATE UNIQUE INDEX idx_api_datasource_platform_code ON api_datasource_platform(tenant_id, platform_code);
|
||||
|
||||
-- =============================================
|
||||
-- 字段映射配置表 (api_field_mapping_config)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS api_field_mapping_config_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS api_field_mapping_config (
|
||||
id BIGINT NOT NULL DEFAULT nextval('api_field_mapping_config_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
config_name VARCHAR(200) NOT NULL,
|
||||
vendor_name VARCHAR(100),
|
||||
api_name VARCHAR(200),
|
||||
api_version VARCHAR(50),
|
||||
source_field VARCHAR(200),
|
||||
source_field_type VARCHAR(100),
|
||||
source_field_desc VARCHAR(500),
|
||||
target_field VARCHAR(200),
|
||||
target_field_type VARCHAR(100),
|
||||
target_field_desc VARCHAR(500),
|
||||
transform_type VARCHAR(100),
|
||||
transform_params JSONB,
|
||||
validation_rules JSONB,
|
||||
default_value VARCHAR(500),
|
||||
is_required BOOLEAN DEFAULT FALSE,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
priority INT DEFAULT 0,
|
||||
business_domain VARCHAR(100),
|
||||
field_group VARCHAR(100),
|
||||
config_version INT DEFAULT 1,
|
||||
effective_date TIMESTAMP WITH TIME ZONE,
|
||||
expiry_date TIMESTAMP WITH TIME ZONE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE api_field_mapping_config IS '字段映射配置表';
|
||||
COMMENT ON COLUMN api_field_mapping_config.id IS '主键ID';
|
||||
COMMENT ON COLUMN api_field_mapping_config.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN api_field_mapping_config.creator IS '创建人';
|
||||
COMMENT ON COLUMN api_field_mapping_config.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN api_field_mapping_config.updater IS '更新人';
|
||||
COMMENT ON COLUMN api_field_mapping_config.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN api_field_mapping_config.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN api_field_mapping_config.config_name IS '配置名称';
|
||||
COMMENT ON COLUMN api_field_mapping_config.vendor_name IS '厂商名称';
|
||||
COMMENT ON COLUMN api_field_mapping_config.api_name IS '接口名称';
|
||||
COMMENT ON COLUMN api_field_mapping_config.api_version IS '接口版本';
|
||||
COMMENT ON COLUMN api_field_mapping_config.source_field IS '源字段名';
|
||||
COMMENT ON COLUMN api_field_mapping_config.source_field_type IS '源字段数据类型';
|
||||
COMMENT ON COLUMN api_field_mapping_config.source_field_desc IS '源字段描述';
|
||||
COMMENT ON COLUMN api_field_mapping_config.target_field IS '目标字段名';
|
||||
COMMENT ON COLUMN api_field_mapping_config.target_field_type IS '目标数据类型';
|
||||
COMMENT ON COLUMN api_field_mapping_config.target_field_desc IS '字段描述';
|
||||
COMMENT ON COLUMN api_field_mapping_config.transform_type IS '转换类型';
|
||||
COMMENT ON COLUMN api_field_mapping_config.transform_params IS '转换参数';
|
||||
COMMENT ON COLUMN api_field_mapping_config.validation_rules IS '验证规则';
|
||||
COMMENT ON COLUMN api_field_mapping_config.default_value IS '默认值';
|
||||
COMMENT ON COLUMN api_field_mapping_config.is_required IS '是否必填';
|
||||
COMMENT ON COLUMN api_field_mapping_config.is_active IS '是否启用';
|
||||
COMMENT ON COLUMN api_field_mapping_config.priority IS '优先级';
|
||||
COMMENT ON COLUMN api_field_mapping_config.business_domain IS '业务域';
|
||||
COMMENT ON COLUMN api_field_mapping_config.field_group IS '字段分组';
|
||||
COMMENT ON COLUMN api_field_mapping_config.config_version IS '配置版本号';
|
||||
COMMENT ON COLUMN api_field_mapping_config.effective_date IS '生效时间';
|
||||
COMMENT ON COLUMN api_field_mapping_config.expiry_date IS '失效时间';
|
||||
|
||||
CREATE INDEX idx_api_field_mapping_config_vendor ON api_field_mapping_config(tenant_id, vendor_name, api_name);
|
||||
CREATE INDEX idx_api_field_mapping_config_active ON api_field_mapping_config(tenant_id, is_active);
|
||||
|
||||
-- =============================================
|
||||
-- API接口管理表 (api_interface)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS api_interface_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS api_interface (
|
||||
id BIGINT NOT NULL DEFAULT nextval('api_interface_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
platform_id BIGINT NOT NULL,
|
||||
name VARCHAR(200) NOT NULL,
|
||||
code VARCHAR(100) NOT NULL,
|
||||
url VARCHAR(500) NOT NULL,
|
||||
method VARCHAR(20) NOT NULL DEFAULT 'GET',
|
||||
status VARCHAR(50) DEFAULT 'active',
|
||||
auth_type VARCHAR(50) DEFAULT 'api_key',
|
||||
request_config JSONB,
|
||||
response_config JSONB,
|
||||
limit_config JSONB,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE api_interface IS 'API接口管理表';
|
||||
COMMENT ON COLUMN api_interface.id IS '主键ID';
|
||||
COMMENT ON COLUMN api_interface.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN api_interface.creator IS '创建人';
|
||||
COMMENT ON COLUMN api_interface.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN api_interface.updater IS '更新人';
|
||||
COMMENT ON COLUMN api_interface.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN api_interface.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN api_interface.platform_id IS '所属平台ID';
|
||||
COMMENT ON COLUMN api_interface.name IS '接口名称';
|
||||
COMMENT ON COLUMN api_interface.code IS '接口编码';
|
||||
COMMENT ON COLUMN api_interface.url IS '接口地址';
|
||||
COMMENT ON COLUMN api_interface.method IS '请求方法:GET/POST/PUT/DELETE等';
|
||||
COMMENT ON COLUMN api_interface.status IS '接口状态:active启用/inactive停用';
|
||||
COMMENT ON COLUMN api_interface.auth_type IS '认证类型:oauth2/apikey/basic等';
|
||||
COMMENT ON COLUMN api_interface.request_config IS '请求配置';
|
||||
COMMENT ON COLUMN api_interface.response_config IS '响应配置';
|
||||
COMMENT ON COLUMN api_interface.limit_config IS '接口独立限流配置(可选,覆盖平台配置)';
|
||||
|
||||
CREATE UNIQUE INDEX idx_api_interface_code ON api_interface(tenant_id, code);
|
||||
CREATE INDEX idx_api_interface_platform_id ON api_interface(tenant_id, platform_id);
|
||||
CREATE INDEX idx_api_interface_status ON api_interface(tenant_id, status);
|
||||
115
sql/02_account_report_tables.sql
Normal file
115
sql/02_account_report_tables.sql
Normal file
@@ -0,0 +1,115 @@
|
||||
-- PostgreSQL 建表脚本 - 账户报告表
|
||||
|
||||
-- =============================================
|
||||
-- 账户报告明细表 (cid_account_report_detail)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS cid_account_report_detail_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cid_account_report_detail (
|
||||
id BIGINT NOT NULL DEFAULT nextval('cid_account_report_detail_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
report_date_str VARCHAR(50),
|
||||
account_id VARCHAR(100),
|
||||
account_name VARCHAR(200),
|
||||
cost_total DECIMAL(20,4),
|
||||
impression BIGINT,
|
||||
click BIGINT,
|
||||
ctr DECIMAL(10,6),
|
||||
cpc DECIMAL(20,4),
|
||||
cpm DECIMAL(20,4),
|
||||
conversion BIGINT,
|
||||
conversion_rate DECIMAL(10,6),
|
||||
cpa DECIMAL(20,4),
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE cid_account_report_detail IS '账户报告明细表';
|
||||
COMMENT ON COLUMN cid_account_report_detail.id IS '主键ID';
|
||||
COMMENT ON COLUMN cid_account_report_detail.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN cid_account_report_detail.creator IS '创建人';
|
||||
COMMENT ON COLUMN cid_account_report_detail.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN cid_account_report_detail.updater IS '更新人';
|
||||
COMMENT ON COLUMN cid_account_report_detail.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN cid_account_report_detail.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN cid_account_report_detail.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN cid_account_report_detail.report_date_str IS '报告日期';
|
||||
COMMENT ON COLUMN cid_account_report_detail.account_id IS '账户ID';
|
||||
COMMENT ON COLUMN cid_account_report_detail.account_name IS '账户名称';
|
||||
COMMENT ON COLUMN cid_account_report_detail.cost_total IS '总花费';
|
||||
COMMENT ON COLUMN cid_account_report_detail.impression IS '曝光数';
|
||||
COMMENT ON COLUMN cid_account_report_detail.click IS '点击数';
|
||||
COMMENT ON COLUMN cid_account_report_detail.ctr IS '点击率';
|
||||
COMMENT ON COLUMN cid_account_report_detail.cpc IS '点击单价';
|
||||
COMMENT ON COLUMN cid_account_report_detail.cpm IS '千次曝光成本';
|
||||
COMMENT ON COLUMN cid_account_report_detail.conversion IS '转化数';
|
||||
COMMENT ON COLUMN cid_account_report_detail.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN cid_account_report_detail.cpa IS '转化成本';
|
||||
COMMENT ON COLUMN cid_account_report_detail.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_cid_account_report_detail_cid ON cid_account_report_detail(tenant_id, cid);
|
||||
CREATE INDEX idx_cid_account_report_detail_date ON cid_account_report_detail(tenant_id, report_date_str);
|
||||
CREATE INDEX idx_cid_account_report_detail_datasource ON cid_account_report_detail(tenant_id, datasource);
|
||||
|
||||
-- =============================================
|
||||
-- 账户报告汇总表 (cid_account_report_sum)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS cid_account_report_sum_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cid_account_report_sum (
|
||||
id BIGINT NOT NULL DEFAULT nextval('cid_account_report_sum_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
report_date_str VARCHAR(50),
|
||||
account_id VARCHAR(100),
|
||||
account_name VARCHAR(200),
|
||||
cost_total DECIMAL(20,4),
|
||||
impression BIGINT,
|
||||
click BIGINT,
|
||||
ctr DECIMAL(10,6),
|
||||
cpc DECIMAL(20,4),
|
||||
cpm DECIMAL(20,4),
|
||||
conversion BIGINT,
|
||||
conversion_rate DECIMAL(10,6),
|
||||
cpa DECIMAL(20,4),
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE cid_account_report_sum IS '账户报告汇总表';
|
||||
COMMENT ON COLUMN cid_account_report_sum.id IS '主键ID';
|
||||
COMMENT ON COLUMN cid_account_report_sum.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN cid_account_report_sum.creator IS '创建人';
|
||||
COMMENT ON COLUMN cid_account_report_sum.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN cid_account_report_sum.updater IS '更新人';
|
||||
COMMENT ON COLUMN cid_account_report_sum.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN cid_account_report_sum.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN cid_account_report_sum.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN cid_account_report_sum.report_date_str IS '报告日期';
|
||||
COMMENT ON COLUMN cid_account_report_sum.account_id IS '账户ID';
|
||||
COMMENT ON COLUMN cid_account_report_sum.account_name IS '账户名称';
|
||||
COMMENT ON COLUMN cid_account_report_sum.cost_total IS '总花费';
|
||||
COMMENT ON COLUMN cid_account_report_sum.impression IS '曝光数';
|
||||
COMMENT ON COLUMN cid_account_report_sum.click IS '点击数';
|
||||
COMMENT ON COLUMN cid_account_report_sum.ctr IS '点击率';
|
||||
COMMENT ON COLUMN cid_account_report_sum.cpc IS '点击单价';
|
||||
COMMENT ON COLUMN cid_account_report_sum.cpm IS '千次曝光成本';
|
||||
COMMENT ON COLUMN cid_account_report_sum.conversion IS '转化数';
|
||||
COMMENT ON COLUMN cid_account_report_sum.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN cid_account_report_sum.cpa IS '转化成本';
|
||||
COMMENT ON COLUMN cid_account_report_sum.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_cid_account_report_sum_cid ON cid_account_report_sum(tenant_id, cid);
|
||||
CREATE INDEX idx_cid_account_report_sum_date ON cid_account_report_sum(tenant_id, report_date_str);
|
||||
CREATE INDEX idx_cid_account_report_sum_datasource ON cid_account_report_sum(tenant_id, datasource);
|
||||
419
sql/03_campaign_report_tables.sql
Normal file
419
sql/03_campaign_report_tables.sql
Normal file
@@ -0,0 +1,419 @@
|
||||
-- PostgreSQL 建表脚本 - 广告系列报告表
|
||||
|
||||
-- =============================================
|
||||
-- 广告系列报告明细表 (campaign_report_detail)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS campaign_report_detail_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS campaign_report_detail (
|
||||
id BIGINT NOT NULL DEFAULT nextval('campaign_report_detail_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
t0_order_payment_amt DECIMAL(20,4),
|
||||
creative_material_type VARCHAR(100),
|
||||
live_name VARCHAR(200),
|
||||
author_id VARCHAR(100),
|
||||
pic_url VARCHAR(500),
|
||||
pic_name VARCHAR(200),
|
||||
pic_id VARCHAR(100),
|
||||
cover_url VARCHAR(500),
|
||||
cover_id BIGINT,
|
||||
item_order_conversion_ratio DECIMAL(10,6),
|
||||
item_card_click_ratio DECIMAL(10,6),
|
||||
item_card_clk_cnt BIGINT,
|
||||
live_play_cnt_cost DECIMAL(20,4),
|
||||
ad_merchant_follow_cost DECIMAL(20,4),
|
||||
ad_merchant_follow BIGINT,
|
||||
net_t0_order_cnt BIGINT,
|
||||
net_t0_roi DECIMAL(10,6),
|
||||
net_t0_gmv DECIMAL(20,4),
|
||||
photo_name VARCHAR(200),
|
||||
photo_id_str VARCHAR(100),
|
||||
photo_id VARCHAR(100),
|
||||
mod_price_segment VARCHAR(100),
|
||||
age_segment VARCHAR(100),
|
||||
province VARCHAR(100),
|
||||
gender VARCHAR(20),
|
||||
ad_photo_played_five_ratio DECIMAL(10,6),
|
||||
ad_photo_played_three_ratio DECIMAL(10,6),
|
||||
order_submit_roi DECIMAL(10,6),
|
||||
order_submit_amt BIGINT,
|
||||
event_order_submit_cost DECIMAL(20,4),
|
||||
event_order_submit BIGINT,
|
||||
event_order_paid_roi DECIMAL(10,6),
|
||||
event_app_invoked BIGINT,
|
||||
event_add_shopping_cart BIGINT,
|
||||
conversion_num_cost DECIMAL(20,4),
|
||||
ad_effective_play_num BIGINT,
|
||||
ad_item_click BIGINT,
|
||||
merchant_product_id VARCHAR(100),
|
||||
cost_total DECIMAL(20,4),
|
||||
ad_show BIGINT,
|
||||
ad_show1k_cost DECIMAL(20,4),
|
||||
impression BIGINT,
|
||||
photo_click BIGINT,
|
||||
photo_click_ratio DECIMAL(10,6),
|
||||
click BIGINT,
|
||||
actionbar_click BIGINT,
|
||||
actionbar_click_cost DECIMAL(20,4),
|
||||
esp_click_ratio DECIMAL(10,6),
|
||||
action_ratio DECIMAL(10,6),
|
||||
ad_item_click_count BIGINT,
|
||||
esp_live_played_seconds BIGINT,
|
||||
played_three_seconds BIGINT,
|
||||
play3s_ratio DECIMAL(10,6),
|
||||
played_five_seconds BIGINT,
|
||||
play5s_ratio DECIMAL(10,6),
|
||||
played_end BIGINT,
|
||||
play_end_ratio DECIMAL(10,6),
|
||||
share BIGINT,
|
||||
comment BIGINT,
|
||||
likes BIGINT,
|
||||
report BIGINT,
|
||||
block BIGINT,
|
||||
item_negative BIGINT,
|
||||
live_share BIGINT,
|
||||
live_comment BIGINT,
|
||||
live_reward BIGINT,
|
||||
effective_play_count BIGINT,
|
||||
effective_play_ratio DECIMAL(10,6),
|
||||
conversion_num BIGINT,
|
||||
conversion_cost_esp DECIMAL(20,4),
|
||||
roi DECIMAL(10,6),
|
||||
gmv DECIMAL(20,4),
|
||||
t0_gmv DECIMAL(20,4),
|
||||
t1_gmv DECIMAL(20,4),
|
||||
t7_gmv DECIMAL(20,4),
|
||||
t15_gmv DECIMAL(20,4),
|
||||
t30_gmv DECIMAL(20,4),
|
||||
t0_roi DECIMAL(10,6),
|
||||
t1_roi DECIMAL(10,6),
|
||||
t7_roi DECIMAL(10,6),
|
||||
t15_roi DECIMAL(10,6),
|
||||
t30_roi DECIMAL(10,6),
|
||||
paied_order BIGINT,
|
||||
order_ratio DECIMAL(10,6),
|
||||
t0_order_cnt BIGINT,
|
||||
t0_order_cnt_cost DECIMAL(20,4),
|
||||
t0_order_cnt_ratio DECIMAL(10,6),
|
||||
t1_order_cnt BIGINT,
|
||||
t7_order_cnt BIGINT,
|
||||
t15_order_cnt BIGINT,
|
||||
t30_order_cnt BIGINT,
|
||||
merchant_reco_fans BIGINT,
|
||||
t1_retention DECIMAL(10,4),
|
||||
t7_retention DECIMAL(10,4),
|
||||
t15_retention DECIMAL(10,4),
|
||||
t30_retention DECIMAL(10,4),
|
||||
t1_retention_ratio DECIMAL(10,6),
|
||||
t7_retention_ratio DECIMAL(10,6),
|
||||
t15_retention_ratio DECIMAL(10,6),
|
||||
t30_retention_ratio DECIMAL(10,6),
|
||||
reservation_success BIGINT,
|
||||
reservation_cost DECIMAL(20,4),
|
||||
standard_live_played_started BIGINT,
|
||||
ad_live_play_cnt BIGINT,
|
||||
ad_live_play_cnt_cost DECIMAL(20,4),
|
||||
live_audience_cost DECIMAL(20,4),
|
||||
live_event_goods_view BIGINT,
|
||||
goods_click_ratio DECIMAL(10,6),
|
||||
direct_attr_plat_new_buyer_cnt BIGINT,
|
||||
t30_attr_plat_total_buyer_cnt BIGINT,
|
||||
direct_attr_seller_new_buyer_cnt BIGINT,
|
||||
t30_attr_seller_total_buyer_cnt BIGINT,
|
||||
t3_gmv DECIMAL(20,4),
|
||||
t3_order_cnt BIGINT,
|
||||
t3_roi DECIMAL(10,6),
|
||||
t7_indirect_order_amt DECIMAL(20,4),
|
||||
t7_indirect_order_cnt BIGINT,
|
||||
fans_t0_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t3_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t7_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t15_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t30_gmv_per_fans DECIMAL(20,4),
|
||||
reco_fans_cost DECIMAL(20,4),
|
||||
qcpx_whitebox_direct_order_payment_amt DECIMAL(20,4),
|
||||
qcpx_whitebox_direct_order_cnt BIGINT,
|
||||
fans_t0_gmv DECIMAL(20,4),
|
||||
fans_t1_gmv DECIMAL(20,4),
|
||||
fans_t7_gmv DECIMAL(20,4),
|
||||
fans_t15_gmv DECIMAL(20,4),
|
||||
fans_t30_gmv DECIMAL(20,4),
|
||||
fans_t0_roi DECIMAL(10,6),
|
||||
fans_t1_roi DECIMAL(10,6),
|
||||
fans_t7_roi DECIMAL(10,6),
|
||||
fans_t15_roi DECIMAL(10,6),
|
||||
fans_t30_roi DECIMAL(10,6),
|
||||
t0_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t1_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t3_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t7_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t15_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t30_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t0_shop_new_buyer_order_cnt BIGINT,
|
||||
t1_shop_new_buyer_order_cnt BIGINT,
|
||||
t3_shop_new_buyer_order_cnt BIGINT,
|
||||
t7_shop_new_buyer_order_cnt BIGINT,
|
||||
t15_shop_new_buyer_order_cnt BIGINT,
|
||||
t30_shop_new_buyer_order_cnt BIGINT,
|
||||
t1_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t3_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t7_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t15_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t30_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t0_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t1_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t3_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t7_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t15_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t30_shop_new_buyer_roi DECIMAL(10,6),
|
||||
create_card_order_cnt BIGINT,
|
||||
forward_ts_create_card_order_cnt BIGINT,
|
||||
create_card_order_cost DECIMAL(20,4),
|
||||
forward_ts_create_card_order_cost DECIMAL(20,4),
|
||||
activate_card_order_cnt BIGINT,
|
||||
forward_ts_activate_card_order_cnt BIGINT,
|
||||
activate_card_order_cost DECIMAL(20,4),
|
||||
forward_ts_activate_card_order_cost DECIMAL(20,4),
|
||||
create_card_order_ratio DECIMAL(10,6),
|
||||
forward_ts_create_card_order_ratio DECIMAL(10,6),
|
||||
activate_card_order_cnt_ratio DECIMAL(10,6),
|
||||
forward_ts_activate_card_order_ratio DECIMAL(10,6),
|
||||
live_play_cnt BIGINT,
|
||||
item_entrance_clk_cnt BIGINT,
|
||||
show_cnt BIGINT,
|
||||
report_date_str VARCHAR(50),
|
||||
campaign_id BIGINT,
|
||||
campaign_name VARCHAR(200),
|
||||
unit_id BIGINT,
|
||||
unit_name VARCHAR(200),
|
||||
creative_id BIGINT,
|
||||
creative_name VARCHAR(200),
|
||||
cid_actual_roi_after_subsidy DECIMAL(10,6),
|
||||
cid_coupon_amount BIGINT,
|
||||
cid_coupon_callback_paid_refund_amount BIGINT,
|
||||
cid_voucher_cost DECIMAL(20,4),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE campaign_report_detail IS '广告系列报告明细表';
|
||||
|
||||
CREATE INDEX idx_campaign_report_detail_cid ON campaign_report_detail(tenant_id, cid);
|
||||
CREATE INDEX idx_campaign_report_detail_campaign_id ON campaign_report_detail(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_campaign_report_detail_date ON campaign_report_detail(tenant_id, report_date_str);
|
||||
CREATE INDEX idx_campaign_report_detail_datasource ON campaign_report_detail(tenant_id, datasource);
|
||||
|
||||
-- =============================================
|
||||
-- 广告系列报告汇总表 (campaign_report_sum)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS campaign_report_sum_id_seq START WITH 1 INCREMENT BY 1;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS campaign_report_sum (
|
||||
id BIGINT NOT NULL DEFAULT nextval('campaign_report_sum_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(100) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
updater VARCHAR(100) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
t0_order_payment_amt DECIMAL(20,4),
|
||||
creative_material_type VARCHAR(100),
|
||||
live_name VARCHAR(200),
|
||||
author_id VARCHAR(100),
|
||||
pic_url VARCHAR(500),
|
||||
pic_name VARCHAR(200),
|
||||
pic_id VARCHAR(100),
|
||||
cover_url VARCHAR(500),
|
||||
cover_id BIGINT,
|
||||
item_order_conversion_ratio DECIMAL(10,6),
|
||||
item_card_click_ratio DECIMAL(10,6),
|
||||
item_card_clk_cnt BIGINT,
|
||||
live_play_cnt_cost DECIMAL(20,4),
|
||||
ad_merchant_follow_cost DECIMAL(20,4),
|
||||
ad_merchant_follow BIGINT,
|
||||
net_t0_order_cnt BIGINT,
|
||||
net_t0_roi DECIMAL(10,6),
|
||||
net_t0_gmv DECIMAL(20,4),
|
||||
photo_name VARCHAR(200),
|
||||
photo_id_str VARCHAR(100),
|
||||
photo_id VARCHAR(100),
|
||||
mod_price_segment VARCHAR(100),
|
||||
age_segment VARCHAR(100),
|
||||
province VARCHAR(100),
|
||||
gender VARCHAR(20),
|
||||
ad_photo_played_five_ratio DECIMAL(10,6),
|
||||
ad_photo_played_three_ratio DECIMAL(10,6),
|
||||
order_submit_roi DECIMAL(10,6),
|
||||
order_submit_amt BIGINT,
|
||||
event_order_submit_cost DECIMAL(20,4),
|
||||
event_order_submit BIGINT,
|
||||
event_order_paid_roi DECIMAL(10,6),
|
||||
event_app_invoked BIGINT,
|
||||
event_add_shopping_cart BIGINT,
|
||||
conversion_num_cost DECIMAL(20,4),
|
||||
ad_effective_play_num BIGINT,
|
||||
ad_item_click BIGINT,
|
||||
merchant_product_id VARCHAR(100),
|
||||
cost_total DECIMAL(20,4),
|
||||
ad_show BIGINT,
|
||||
ad_show1k_cost DECIMAL(20,4),
|
||||
impression BIGINT,
|
||||
photo_click BIGINT,
|
||||
photo_click_ratio DECIMAL(10,6),
|
||||
click BIGINT,
|
||||
actionbar_click BIGINT,
|
||||
actionbar_click_cost DECIMAL(20,4),
|
||||
esp_click_ratio DECIMAL(10,6),
|
||||
action_ratio DECIMAL(10,6),
|
||||
ad_item_click_count BIGINT,
|
||||
esp_live_played_seconds BIGINT,
|
||||
played_three_seconds BIGINT,
|
||||
play3s_ratio DECIMAL(10,6),
|
||||
played_five_seconds BIGINT,
|
||||
play5s_ratio DECIMAL(10,6),
|
||||
played_end BIGINT,
|
||||
play_end_ratio DECIMAL(10,6),
|
||||
share BIGINT,
|
||||
comment BIGINT,
|
||||
likes BIGINT,
|
||||
report BIGINT,
|
||||
block BIGINT,
|
||||
item_negative BIGINT,
|
||||
live_share BIGINT,
|
||||
live_comment BIGINT,
|
||||
live_reward BIGINT,
|
||||
effective_play_count BIGINT,
|
||||
effective_play_ratio DECIMAL(10,6),
|
||||
conversion_num BIGINT,
|
||||
conversion_cost_esp DECIMAL(20,4),
|
||||
roi DECIMAL(10,6),
|
||||
gmv DECIMAL(20,4),
|
||||
t0_gmv DECIMAL(20,4),
|
||||
t1_gmv DECIMAL(20,4),
|
||||
t7_gmv DECIMAL(20,4),
|
||||
t15_gmv DECIMAL(20,4),
|
||||
t30_gmv DECIMAL(20,4),
|
||||
t0_roi DECIMAL(10,6),
|
||||
t1_roi DECIMAL(10,6),
|
||||
t7_roi DECIMAL(10,6),
|
||||
t15_roi DECIMAL(10,6),
|
||||
t30_roi DECIMAL(10,6),
|
||||
paied_order BIGINT,
|
||||
order_ratio DECIMAL(10,6),
|
||||
t0_order_cnt BIGINT,
|
||||
t0_order_cnt_cost DECIMAL(20,4),
|
||||
t0_order_cnt_ratio DECIMAL(10,6),
|
||||
t1_order_cnt BIGINT,
|
||||
t7_order_cnt BIGINT,
|
||||
t15_order_cnt BIGINT,
|
||||
t30_order_cnt BIGINT,
|
||||
merchant_reco_fans BIGINT,
|
||||
t1_retention DECIMAL(10,4),
|
||||
t7_retention DECIMAL(10,4),
|
||||
t15_retention DECIMAL(10,4),
|
||||
t30_retention DECIMAL(10,4),
|
||||
t1_retention_ratio DECIMAL(10,6),
|
||||
t7_retention_ratio DECIMAL(10,6),
|
||||
t15_retention_ratio DECIMAL(10,6),
|
||||
t30_retention_ratio DECIMAL(10,6),
|
||||
reservation_success BIGINT,
|
||||
reservation_cost DECIMAL(20,4),
|
||||
standard_live_played_started BIGINT,
|
||||
ad_live_play_cnt BIGINT,
|
||||
ad_live_play_cnt_cost DECIMAL(20,4),
|
||||
live_audience_cost DECIMAL(20,4),
|
||||
live_event_goods_view BIGINT,
|
||||
goods_click_ratio DECIMAL(10,6),
|
||||
direct_attr_plat_new_buyer_cnt BIGINT,
|
||||
t30_attr_plat_total_buyer_cnt BIGINT,
|
||||
direct_attr_seller_new_buyer_cnt BIGINT,
|
||||
t30_attr_seller_total_buyer_cnt BIGINT,
|
||||
t3_gmv DECIMAL(20,4),
|
||||
t3_order_cnt BIGINT,
|
||||
t3_roi DECIMAL(10,6),
|
||||
t7_indirect_order_amt DECIMAL(20,4),
|
||||
t7_indirect_order_cnt BIGINT,
|
||||
fans_t0_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t3_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t7_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t15_gmv_per_fans DECIMAL(20,4),
|
||||
fans_t30_gmv_per_fans DECIMAL(20,4),
|
||||
reco_fans_cost DECIMAL(20,4),
|
||||
qcpx_whitebox_direct_order_payment_amt DECIMAL(20,4),
|
||||
qcpx_whitebox_direct_order_cnt BIGINT,
|
||||
fans_t0_gmv DECIMAL(20,4),
|
||||
fans_t1_gmv DECIMAL(20,4),
|
||||
fans_t7_gmv DECIMAL(20,4),
|
||||
fans_t15_gmv DECIMAL(20,4),
|
||||
fans_t30_gmv DECIMAL(20,4),
|
||||
fans_t0_roi DECIMAL(10,6),
|
||||
fans_t1_roi DECIMAL(10,6),
|
||||
fans_t7_roi DECIMAL(10,6),
|
||||
fans_t15_roi DECIMAL(10,6),
|
||||
fans_t30_roi DECIMAL(10,6),
|
||||
t0_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t1_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t3_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t7_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t15_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t30_shop_new_buyer_order_payment_amt DECIMAL(20,4),
|
||||
t0_shop_new_buyer_order_cnt BIGINT,
|
||||
t1_shop_new_buyer_order_cnt BIGINT,
|
||||
t3_shop_new_buyer_order_cnt BIGINT,
|
||||
t7_shop_new_buyer_order_cnt BIGINT,
|
||||
t15_shop_new_buyer_order_cnt BIGINT,
|
||||
t30_shop_new_buyer_order_cnt BIGINT,
|
||||
t1_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t3_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t7_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t15_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t30_new_buyer_repurchase_ratio DECIMAL(10,6),
|
||||
t0_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t1_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t3_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t7_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t15_shop_new_buyer_roi DECIMAL(10,6),
|
||||
t30_shop_new_buyer_roi DECIMAL(10,6),
|
||||
create_card_order_cnt BIGINT,
|
||||
forward_ts_create_card_order_cnt BIGINT,
|
||||
create_card_order_cost DECIMAL(20,4),
|
||||
forward_ts_create_card_order_cost DECIMAL(20,4),
|
||||
activate_card_order_cnt BIGINT,
|
||||
forward_ts_activate_card_order_cnt BIGINT,
|
||||
activate_card_order_cost DECIMAL(20,4),
|
||||
forward_ts_activate_card_order_cost DECIMAL(20,4),
|
||||
create_card_order_ratio DECIMAL(10,6),
|
||||
forward_ts_create_card_order_ratio DECIMAL(10,6),
|
||||
activate_card_order_cnt_ratio DECIMAL(10,6),
|
||||
forward_ts_activate_card_order_ratio DECIMAL(10,6),
|
||||
live_play_cnt BIGINT,
|
||||
item_entrance_clk_cnt BIGINT,
|
||||
show_cnt BIGINT,
|
||||
report_date_str VARCHAR(50),
|
||||
campaign_id BIGINT,
|
||||
campaign_name VARCHAR(200),
|
||||
unit_id BIGINT,
|
||||
unit_name VARCHAR(200),
|
||||
creative_id BIGINT,
|
||||
creative_name VARCHAR(200),
|
||||
cid_actual_roi_after_subsidy DECIMAL(10,6),
|
||||
cid_coupon_amount BIGINT,
|
||||
cid_coupon_callback_paid_refund_amount BIGINT,
|
||||
cid_voucher_cost DECIMAL(20,4),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE campaign_report_sum IS '广告系列报告汇总表';
|
||||
|
||||
CREATE INDEX idx_campaign_report_sum_cid ON campaign_report_sum(tenant_id, cid);
|
||||
CREATE INDEX idx_campaign_report_sum_campaign_id ON campaign_report_sum(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_campaign_report_sum_date ON campaign_report_sum(tenant_id, report_date_str);
|
||||
CREATE INDEX idx_campaign_report_sum_datasource ON campaign_report_sum(tenant_id, datasource);
|
||||
206
sql/04_creative_report_tables.sql
Normal file
206
sql/04_creative_report_tables.sql
Normal file
@@ -0,0 +1,206 @@
|
||||
-- Creative Report Tables (创意报告表)
|
||||
|
||||
-- =============================================
|
||||
-- 创意报告明细表 (creative_report_detail)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS creative_report_detail_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS creative_report_detail (
|
||||
id BIGINT NOT NULL DEFAULT nextval('creative_report_detail_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
render_mode VARCHAR(32) NOT NULL DEFAULT '',
|
||||
inventory_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
promotion_target_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
material_hash VARCHAR(128) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
primary_url VARCHAR(1024) NOT NULL DEFAULT '',
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_interaction_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_three_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_five_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_engage_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_share_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_comment_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_like_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_repost_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
game_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_install_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
onsite_leads_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE creative_report_detail IS '创意报告明细表';
|
||||
COMMENT ON COLUMN creative_report_detail.id IS '主键ID';
|
||||
COMMENT ON COLUMN creative_report_detail.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN creative_report_detail.creator IS '创建人';
|
||||
COMMENT ON COLUMN creative_report_detail.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN creative_report_detail.updater IS '更新人';
|
||||
COMMENT ON COLUMN creative_report_detail.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN creative_report_detail.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN creative_report_detail.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN creative_report_detail.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN creative_report_detail.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN creative_report_detail.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN creative_report_detail.ad_name IS '创意名称';
|
||||
COMMENT ON COLUMN creative_report_detail.render_mode IS '创意类型';
|
||||
COMMENT ON COLUMN creative_report_detail.inventory_type IS '投放位置';
|
||||
COMMENT ON COLUMN creative_report_detail.promotion_target_id IS '推广目标ID';
|
||||
COMMENT ON COLUMN creative_report_detail.material_hash IS '素材哈希';
|
||||
COMMENT ON COLUMN creative_report_detail.impression IS '展示数';
|
||||
COMMENT ON COLUMN creative_report_detail.click IS '点击数';
|
||||
COMMENT ON COLUMN creative_report_detail.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN creative_report_detail.ctr IS '点击率';
|
||||
COMMENT ON COLUMN creative_report_detail.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN creative_report_detail.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN creative_report_detail.conversion IS '转化数';
|
||||
COMMENT ON COLUMN creative_report_detail.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN creative_report_detail.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN creative_report_detail.primary_url IS '落地页URL';
|
||||
COMMENT ON COLUMN creative_report_detail.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN creative_report_detail.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN creative_report_detail.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN creative_report_detail.video_interaction_count IS '视频互动数';
|
||||
COMMENT ON COLUMN creative_report_detail.video_three_second_play_count IS '视频3秒播放次数';
|
||||
COMMENT ON COLUMN creative_report_detail.video_five_second_play_count IS '视频5秒播放次数';
|
||||
COMMENT ON COLUMN creative_report_detail.tweet_engage_count IS '推文参与数';
|
||||
COMMENT ON COLUMN creative_report_detail.tweet_share_count IS '推文分享数';
|
||||
COMMENT ON COLUMN creative_report_detail.tweet_comment_count IS '推文评论数';
|
||||
COMMENT ON COLUMN creative_report_detail.tweet_like_count IS '推文点赞数';
|
||||
COMMENT ON COLUMN creative_report_detail.tweet_repost_count IS '推文转发数';
|
||||
COMMENT ON COLUMN creative_report_detail.game_download_count IS '游戏下载数';
|
||||
COMMENT ON COLUMN creative_report_detail.app_download_count IS '应用下载数';
|
||||
COMMENT ON COLUMN creative_report_detail.app_install_count IS '应用安装数';
|
||||
COMMENT ON COLUMN creative_report_detail.onsite_leads_count IS '预注册数';
|
||||
COMMENT ON COLUMN creative_report_detail.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN creative_report_detail.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN creative_report_detail.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN creative_report_detail.day IS '数据日期';
|
||||
COMMENT ON COLUMN creative_report_detail.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_creative_report_detail_cid ON creative_report_detail(tenant_id, cid);
|
||||
CREATE INDEX idx_creative_report_detail_campaign_id ON creative_report_detail(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_creative_report_detail_ad_id ON creative_report_detail(tenant_id, ad_id);
|
||||
CREATE INDEX idx_creative_report_detail_day ON creative_report_detail(tenant_id, day);
|
||||
CREATE INDEX idx_creative_report_detail_datasource ON creative_report_detail(tenant_id, datasource);
|
||||
CREATE INDEX idx_creative_report_detail_material_hash ON creative_report_detail(tenant_id, material_hash);
|
||||
|
||||
-- =============================================
|
||||
-- 创意报告汇总表 (creative_report_sum)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS creative_report_sum_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS creative_report_sum (
|
||||
id BIGINT NOT NULL DEFAULT nextval('creative_report_sum_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
render_mode VARCHAR(32) NOT NULL DEFAULT '',
|
||||
inventory_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
promotion_target_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_interaction_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
game_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_install_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
onsite_leads_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
hour VARCHAR(2) NOT NULL DEFAULT '',
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE creative_report_sum IS '创意报告汇总表';
|
||||
COMMENT ON COLUMN creative_report_sum.id IS '主键ID';
|
||||
COMMENT ON COLUMN creative_report_sum.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN creative_report_sum.creator IS '创建人';
|
||||
COMMENT ON COLUMN creative_report_sum.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN creative_report_sum.updater IS '更新人';
|
||||
COMMENT ON COLUMN creative_report_sum.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN creative_report_sum.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN creative_report_sum.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN creative_report_sum.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN creative_report_sum.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN creative_report_sum.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN creative_report_sum.ad_name IS '创意名称';
|
||||
COMMENT ON COLUMN creative_report_sum.render_mode IS '创意类型';
|
||||
COMMENT ON COLUMN creative_report_sum.inventory_type IS '投放位置';
|
||||
COMMENT ON COLUMN creative_report_sum.promotion_target_id IS '推广目标ID';
|
||||
COMMENT ON COLUMN creative_report_sum.impression IS '展示数';
|
||||
COMMENT ON COLUMN creative_report_sum.click IS '点击数';
|
||||
COMMENT ON COLUMN creative_report_sum.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN creative_report_sum.ctr IS '点击率';
|
||||
COMMENT ON COLUMN creative_report_sum.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN creative_report_sum.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN creative_report_sum.conversion IS '转化数';
|
||||
COMMENT ON COLUMN creative_report_sum.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN creative_report_sum.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN creative_report_sum.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN creative_report_sum.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN creative_report_sum.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN creative_report_sum.video_interaction_count IS '视频互动数';
|
||||
COMMENT ON COLUMN creative_report_sum.game_download_count IS '游戏下载数';
|
||||
COMMENT ON COLUMN creative_report_sum.app_download_count IS '应用下载数';
|
||||
COMMENT ON COLUMN creative_report_sum.app_install_count IS '应用安装数';
|
||||
COMMENT ON COLUMN creative_report_sum.onsite_leads_count IS '预注册数';
|
||||
COMMENT ON COLUMN creative_report_sum.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN creative_report_sum.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN creative_report_sum.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN creative_report_sum.hour IS '数据小时';
|
||||
COMMENT ON COLUMN creative_report_sum.day IS '数据日期';
|
||||
COMMENT ON COLUMN creative_report_sum.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_creative_report_sum_cid ON creative_report_sum(tenant_id, cid);
|
||||
CREATE INDEX idx_creative_report_sum_campaign_id ON creative_report_sum(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_creative_report_sum_ad_id ON creative_report_sum(tenant_id, ad_id);
|
||||
CREATE INDEX idx_creative_report_sum_day ON creative_report_sum(tenant_id, day);
|
||||
CREATE INDEX idx_creative_report_sum_hour ON creative_report_sum(tenant_id, hour);
|
||||
CREATE INDEX idx_creative_report_sum_datasource ON creative_report_sum(tenant_id, datasource);
|
||||
CREATE UNIQUE INDEX idx_creative_report_sum_unique ON creative_report_sum(tenant_id, ad_id, hour, day, datasource);
|
||||
207
sql/05_unit_report_tables.sql
Normal file
207
sql/05_unit_report_tables.sql
Normal file
@@ -0,0 +1,207 @@
|
||||
-- Unit Report Tables (单元报告表)
|
||||
|
||||
-- =============================================
|
||||
-- 单元报告明细表 (unit_report_detail)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS unit_report_detail_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS unit_report_detail (
|
||||
id BIGINT NOT NULL DEFAULT nextval('unit_report_detail_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
marketing_target_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
marketing_target_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
placement_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
inventory_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
campaign_budget DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
adgroup_budget DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
bid_mode VARCHAR(32) NOT NULL DEFAULT '',
|
||||
bid_amount DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
primary_url VARCHAR(1024) NOT NULL DEFAULT '',
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_interaction_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_engage_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_share_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_comment_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_like_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_repost_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
game_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_install_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
onsite_leads_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE unit_report_detail IS '单元报告明细表';
|
||||
COMMENT ON COLUMN unit_report_detail.id IS '主键ID';
|
||||
COMMENT ON COLUMN unit_report_detail.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN unit_report_detail.creator IS '创建人';
|
||||
COMMENT ON COLUMN unit_report_detail.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN unit_report_detail.updater IS '更新人';
|
||||
COMMENT ON COLUMN unit_report_detail.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN unit_report_detail.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN unit_report_detail.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN unit_report_detail.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN unit_report_detail.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN unit_report_detail.adgroup_name IS '广告组名称';
|
||||
COMMENT ON COLUMN unit_report_detail.marketing_target_id IS '营销标的ID';
|
||||
COMMENT ON COLUMN unit_report_detail.marketing_target_name IS '营销标的名称';
|
||||
COMMENT ON COLUMN unit_report_detail.placement_type IS '投放版位';
|
||||
COMMENT ON COLUMN unit_report_detail.inventory_type IS '投放位置';
|
||||
COMMENT ON COLUMN unit_report_detail.campaign_budget IS '广告系列预算';
|
||||
COMMENT ON COLUMN unit_report_detail.adgroup_budget IS '广告组预算';
|
||||
COMMENT ON COLUMN unit_report_detail.bid_mode IS '出价方式';
|
||||
COMMENT ON COLUMN unit_report_detail.bid_amount IS '出价/代理出价';
|
||||
COMMENT ON COLUMN unit_report_detail.impression IS '展示数';
|
||||
COMMENT ON COLUMN unit_report_detail.click IS '点击数';
|
||||
COMMENT ON COLUMN unit_report_detail.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN unit_report_detail.ctr IS '点击率';
|
||||
COMMENT ON COLUMN unit_report_detail.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN unit_report_detail.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN unit_report_detail.conversion IS '转化数';
|
||||
COMMENT ON COLUMN unit_report_detail.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN unit_report_detail.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN unit_report_detail.primary_url IS '落地页URL';
|
||||
COMMENT ON COLUMN unit_report_detail.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN unit_report_detail.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN unit_report_detail.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN unit_report_detail.video_interaction_count IS '视频互动数';
|
||||
COMMENT ON COLUMN unit_report_detail.tweet_engage_count IS '推文参与数';
|
||||
COMMENT ON COLUMN unit_report_detail.tweet_share_count IS '推文分享数';
|
||||
COMMENT ON COLUMN unit_report_detail.tweet_comment_count IS '推文评论数';
|
||||
COMMENT ON COLUMN unit_report_detail.tweet_like_count IS '推文点赞数';
|
||||
COMMENT ON COLUMN unit_report_detail.tweet_repost_count IS '推文转发数';
|
||||
COMMENT ON COLUMN unit_report_detail.game_download_count IS '游戏下载数';
|
||||
COMMENT ON COLUMN unit_report_detail.app_download_count IS '应用下载数';
|
||||
COMMENT ON COLUMN unit_report_detail.app_install_count IS '应用安装数';
|
||||
COMMENT ON COLUMN unit_report_detail.onsite_leads_count IS '预注册数';
|
||||
COMMENT ON COLUMN unit_report_detail.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN unit_report_detail.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN unit_report_detail.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN unit_report_detail.day IS '数据日期';
|
||||
COMMENT ON COLUMN unit_report_detail.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_unit_report_detail_cid ON unit_report_detail(tenant_id, cid);
|
||||
CREATE INDEX idx_unit_report_detail_campaign_id ON unit_report_detail(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_unit_report_detail_adgroup_id ON unit_report_detail(tenant_id, adgroup_id);
|
||||
CREATE INDEX idx_unit_report_detail_day ON unit_report_detail(tenant_id, day);
|
||||
CREATE INDEX idx_unit_report_detail_datasource ON unit_report_detail(tenant_id, datasource);
|
||||
|
||||
-- =============================================
|
||||
-- 单元报告汇总表 (unit_report_sum)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS unit_report_sum_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS unit_report_sum (
|
||||
id BIGINT NOT NULL DEFAULT nextval('unit_report_sum_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
marketing_target_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
marketing_target_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
placement_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
inventory_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_interaction_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
game_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_install_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
onsite_leads_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
hour VARCHAR(2) NOT NULL DEFAULT '',
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE unit_report_sum IS '单元报告汇总表';
|
||||
COMMENT ON COLUMN unit_report_sum.id IS '主键ID';
|
||||
COMMENT ON COLUMN unit_report_sum.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN unit_report_sum.creator IS '创建人';
|
||||
COMMENT ON COLUMN unit_report_sum.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN unit_report_sum.updater IS '更新人';
|
||||
COMMENT ON COLUMN unit_report_sum.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN unit_report_sum.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN unit_report_sum.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN unit_report_sum.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN unit_report_sum.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN unit_report_sum.adgroup_name IS '广告组名称';
|
||||
COMMENT ON COLUMN unit_report_sum.marketing_target_id IS '营销标的ID';
|
||||
COMMENT ON COLUMN unit_report_sum.marketing_target_name IS '营销标的名称';
|
||||
COMMENT ON COLUMN unit_report_sum.placement_type IS '投放版位';
|
||||
COMMENT ON COLUMN unit_report_sum.inventory_type IS '投放位置';
|
||||
COMMENT ON COLUMN unit_report_sum.impression IS '展示数';
|
||||
COMMENT ON COLUMN unit_report_sum.click IS '点击数';
|
||||
COMMENT ON COLUMN unit_report_sum.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN unit_report_sum.ctr IS '点击率';
|
||||
COMMENT ON COLUMN unit_report_sum.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN unit_report_sum.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN unit_report_sum.conversion IS '转化数';
|
||||
COMMENT ON COLUMN unit_report_sum.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN unit_report_sum.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN unit_report_sum.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN unit_report_sum.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN unit_report_sum.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN unit_report_sum.video_interaction_count IS '视频互动数';
|
||||
COMMENT ON COLUMN unit_report_sum.game_download_count IS '游戏下载数';
|
||||
COMMENT ON COLUMN unit_report_sum.app_download_count IS '应用下载数';
|
||||
COMMENT ON COLUMN unit_report_sum.app_install_count IS '应用安装数';
|
||||
COMMENT ON COLUMN unit_report_sum.onsite_leads_count IS '预注册数';
|
||||
COMMENT ON COLUMN unit_report_sum.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN unit_report_sum.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN unit_report_sum.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN unit_report_sum.hour IS '数据小时';
|
||||
COMMENT ON COLUMN unit_report_sum.day IS '数据日期';
|
||||
COMMENT ON COLUMN unit_report_sum.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_unit_report_sum_cid ON unit_report_sum(tenant_id, cid);
|
||||
CREATE INDEX idx_unit_report_sum_campaign_id ON unit_report_sum(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_unit_report_sum_adgroup_id ON unit_report_sum(tenant_id, adgroup_id);
|
||||
CREATE INDEX idx_unit_report_sum_day ON unit_report_sum(tenant_id, day);
|
||||
CREATE INDEX idx_unit_report_sum_hour ON unit_report_sum(tenant_id, hour);
|
||||
CREATE INDEX idx_unit_report_sum_datasource ON unit_report_sum(tenant_id, datasource);
|
||||
CREATE UNIQUE INDEX idx_unit_report_sum_unique ON unit_report_sum(tenant_id, adgroup_id, hour, day, datasource);
|
||||
177
sql/06_storewide_report_tables.sql
Normal file
177
sql/06_storewide_report_tables.sql
Normal file
@@ -0,0 +1,177 @@
|
||||
-- Storewide Report Tables (全店报告表)
|
||||
|
||||
-- =============================================
|
||||
-- 全店报告明细表 (storewide_report_detail)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS storewide_report_detail_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS storewide_report_detail (
|
||||
id BIGINT NOT NULL DEFAULT nextval('storewide_report_detail_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
primary_url VARCHAR(1024) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
direct_conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
indirect_conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
roe DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
gmv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
order_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_order_price DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cart_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
favorite_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
page_view DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
browse_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_browse_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE storewide_report_detail IS '全店报告明细表';
|
||||
COMMENT ON COLUMN storewide_report_detail.id IS '主键ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.creator IS '创建人';
|
||||
COMMENT ON COLUMN storewide_report_detail.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN storewide_report_detail.updater IS '更新人';
|
||||
COMMENT ON COLUMN storewide_report_detail.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN storewide_report_detail.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN storewide_report_detail.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN storewide_report_detail.ad_name IS '创意名称';
|
||||
COMMENT ON COLUMN storewide_report_detail.primary_url IS '落地页URL';
|
||||
COMMENT ON COLUMN storewide_report_detail.impression IS '展示数';
|
||||
COMMENT ON COLUMN storewide_report_detail.click IS '点击数';
|
||||
COMMENT ON COLUMN storewide_report_detail.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN storewide_report_detail.ctr IS '点击率';
|
||||
COMMENT ON COLUMN storewide_report_detail.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN storewide_report_detail.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN storewide_report_detail.direct_conversion IS '直接转化数';
|
||||
COMMENT ON COLUMN storewide_report_detail.indirect_conversion IS '间接转化数';
|
||||
COMMENT ON COLUMN storewide_report_detail.conversion IS '总转化数';
|
||||
COMMENT ON COLUMN storewide_report_detail.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN storewide_report_detail.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN storewide_report_detail.roe IS '投资回报率(ROE)';
|
||||
COMMENT ON COLUMN storewide_report_detail.gmv IS 'GMV(元)';
|
||||
COMMENT ON COLUMN storewide_report_detail.order_count IS '订单数';
|
||||
COMMENT ON COLUMN storewide_report_detail.avg_order_price IS '平均客单价';
|
||||
COMMENT ON COLUMN storewide_report_detail.cart_count IS '加购数';
|
||||
COMMENT ON COLUMN storewide_report_detail.favorite_count IS '收藏数';
|
||||
COMMENT ON COLUMN storewide_report_detail.page_view IS '页面浏览数';
|
||||
COMMENT ON COLUMN storewide_report_detail.browse_duration IS '浏览时长';
|
||||
COMMENT ON COLUMN storewide_report_detail.avg_browse_duration IS '平均浏览时长(秒)';
|
||||
COMMENT ON COLUMN storewide_report_detail.day IS '数据日期';
|
||||
COMMENT ON COLUMN storewide_report_detail.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_storewide_report_detail_cid ON storewide_report_detail(tenant_id, cid);
|
||||
CREATE INDEX idx_storewide_report_detail_campaign_id ON storewide_report_detail(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_storewide_report_detail_ad_id ON storewide_report_detail(tenant_id, ad_id);
|
||||
CREATE INDEX idx_storewide_report_detail_day ON storewide_report_detail(tenant_id, day);
|
||||
CREATE INDEX idx_storewide_report_detail_datasource ON storewide_report_detail(tenant_id, datasource);
|
||||
|
||||
-- =============================================
|
||||
-- 全店报告汇总表 (storewide_report_sum)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS storewide_report_sum_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS storewide_report_sum (
|
||||
id BIGINT NOT NULL DEFAULT nextval('storewide_report_sum_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
direct_conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
indirect_conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
roe DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
gmv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
order_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_order_price DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cart_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
favorite_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
page_view DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
browse_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_browse_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
hour VARCHAR(2) NOT NULL DEFAULT '',
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE storewide_report_sum IS '全店报告汇总表';
|
||||
COMMENT ON COLUMN storewide_report_sum.id IS '主键ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.creator IS '创建人';
|
||||
COMMENT ON COLUMN storewide_report_sum.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN storewide_report_sum.updater IS '更新人';
|
||||
COMMENT ON COLUMN storewide_report_sum.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN storewide_report_sum.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN storewide_report_sum.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN storewide_report_sum.ad_name IS '创意名称';
|
||||
COMMENT ON COLUMN storewide_report_sum.impression IS '展示数';
|
||||
COMMENT ON COLUMN storewide_report_sum.click IS '点击数';
|
||||
COMMENT ON COLUMN storewide_report_sum.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN storewide_report_sum.ctr IS '点击率';
|
||||
COMMENT ON COLUMN storewide_report_sum.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN storewide_report_sum.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN storewide_report_sum.direct_conversion IS '直接转化数';
|
||||
COMMENT ON COLUMN storewide_report_sum.indirect_conversion IS '间接转化数';
|
||||
COMMENT ON COLUMN storewide_report_sum.conversion IS '总转化数';
|
||||
COMMENT ON COLUMN storewide_report_sum.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN storewide_report_sum.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN storewide_report_sum.roe IS '投资回报率(ROE)';
|
||||
COMMENT ON COLUMN storewide_report_sum.gmv IS 'GMV(元)';
|
||||
COMMENT ON COLUMN storewide_report_sum.order_count IS '订单数';
|
||||
COMMENT ON COLUMN storewide_report_sum.avg_order_price IS '平均客单价';
|
||||
COMMENT ON COLUMN storewide_report_sum.cart_count IS '加购数';
|
||||
COMMENT ON COLUMN storewide_report_sum.favorite_count IS '收藏数';
|
||||
COMMENT ON COLUMN storewide_report_sum.page_view IS '页面浏览数';
|
||||
COMMENT ON COLUMN storewide_report_sum.browse_duration IS '浏览时长';
|
||||
COMMENT ON COLUMN storewide_report_sum.avg_browse_duration IS '平均浏览时长(秒)';
|
||||
COMMENT ON COLUMN storewide_report_sum.hour IS '数据小时';
|
||||
COMMENT ON COLUMN storewide_report_sum.day IS '数据日期';
|
||||
COMMENT ON COLUMN storewide_report_sum.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_storewide_report_sum_cid ON storewide_report_sum(tenant_id, cid);
|
||||
CREATE INDEX idx_storewide_report_sum_campaign_id ON storewide_report_sum(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_storewide_report_sum_ad_id ON storewide_report_sum(tenant_id, ad_id);
|
||||
CREATE INDEX idx_storewide_report_sum_day ON storewide_report_sum(tenant_id, day);
|
||||
CREATE INDEX idx_storewide_report_sum_hour ON storewide_report_sum(tenant_id, hour);
|
||||
CREATE INDEX idx_storewide_report_sum_datasource ON storewide_report_sum(tenant_id, datasource);
|
||||
CREATE UNIQUE INDEX idx_storewide_report_sum_unique ON storewide_report_sum(tenant_id, ad_id, hour, day, datasource);
|
||||
184
sql/07_material_population_tables.sql
Normal file
184
sql/07_material_population_tables.sql
Normal file
@@ -0,0 +1,184 @@
|
||||
-- Material and Population Report Tables (素材报告和人群报告表)
|
||||
|
||||
-- =============================================
|
||||
-- 素材报告表 (material_report)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS material_report_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS material_report (
|
||||
id BIGINT NOT NULL DEFAULT nextval('material_report_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
material_hash VARCHAR(128) NOT NULL DEFAULT '',
|
||||
material_url VARCHAR(2048) NOT NULL DEFAULT '',
|
||||
material_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_three_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_five_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE material_report IS '素材报告表';
|
||||
COMMENT ON COLUMN material_report.id IS '主键ID';
|
||||
COMMENT ON COLUMN material_report.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN material_report.creator IS '创建人';
|
||||
COMMENT ON COLUMN material_report.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN material_report.updater IS '更新人';
|
||||
COMMENT ON COLUMN material_report.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN material_report.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN material_report.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN material_report.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN material_report.ad_name IS '创意名称';
|
||||
COMMENT ON COLUMN material_report.material_hash IS '素材哈希';
|
||||
COMMENT ON COLUMN material_report.material_url IS '素材URL';
|
||||
COMMENT ON COLUMN material_report.material_type IS '素材类型';
|
||||
COMMENT ON COLUMN material_report.impression IS '展示数';
|
||||
COMMENT ON COLUMN material_report.click IS '点击数';
|
||||
COMMENT ON COLUMN material_report.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN material_report.ctr IS '点击率';
|
||||
COMMENT ON COLUMN material_report.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN material_report.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN material_report.conversion IS '转化数';
|
||||
COMMENT ON COLUMN material_report.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN material_report.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN material_report.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN material_report.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN material_report.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN material_report.video_three_second_play_count IS '视频3秒播放次数';
|
||||
COMMENT ON COLUMN material_report.video_five_second_play_count IS '视频5秒播放次数';
|
||||
COMMENT ON COLUMN material_report.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN material_report.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN material_report.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN material_report.day IS '数据日期';
|
||||
COMMENT ON COLUMN material_report.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_material_report_cid ON material_report(tenant_id, cid);
|
||||
CREATE INDEX idx_material_report_ad_id ON material_report(tenant_id, ad_id);
|
||||
CREATE INDEX idx_material_report_material_hash ON material_report(tenant_id, material_hash);
|
||||
CREATE INDEX idx_material_report_day ON material_report(tenant_id, day);
|
||||
CREATE INDEX idx_material_report_datasource ON material_report(tenant_id, datasource);
|
||||
|
||||
-- =============================================
|
||||
-- 人群报告表 (population_report)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS population_report_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS population_report (
|
||||
id BIGINT NOT NULL DEFAULT nextval('population_report_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
audience_template_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
audience_template_name VARCHAR(255) NOT NULL DEFAULT '',
|
||||
audience_type VARCHAR(32) NOT NULL DEFAULT '',
|
||||
audience_source VARCHAR(32) NOT NULL DEFAULT '',
|
||||
impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
video_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_play_uv DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_video_play_duration DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_three_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
video_five_second_play_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_engage_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_share_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_comment_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_like_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
tweet_repost_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
game_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_download_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
app_install_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
onsite_leads_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_count DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
deep_convert_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
deep_convert_cost DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
day VARCHAR(10) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE population_report IS '人群报告表';
|
||||
COMMENT ON COLUMN population_report.id IS '主键ID';
|
||||
COMMENT ON COLUMN population_report.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN population_report.creator IS '创建人';
|
||||
COMMENT ON COLUMN population_report.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN population_report.updater IS '更新人';
|
||||
COMMENT ON COLUMN population_report.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN population_report.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN population_report.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN population_report.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN population_report.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN population_report.audience_template_id IS '人群包ID';
|
||||
COMMENT ON COLUMN population_report.audience_template_name IS '人群包名称';
|
||||
COMMENT ON COLUMN population_report.audience_type IS '人群类型';
|
||||
COMMENT ON COLUMN population_report.audience_source IS '人群来源';
|
||||
COMMENT ON COLUMN population_report.impression IS '展示数';
|
||||
COMMENT ON COLUMN population_report.click IS '点击数';
|
||||
COMMENT ON COLUMN population_report.cost IS '花费(元)';
|
||||
COMMENT ON COLUMN population_report.ctr IS '点击率';
|
||||
COMMENT ON COLUMN population_report.cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN population_report.cpm IS '千次展现成本';
|
||||
COMMENT ON COLUMN population_report.conversion IS '转化数';
|
||||
COMMENT ON COLUMN population_report.conversion_rate IS '转化率';
|
||||
COMMENT ON COLUMN population_report.cpp IS '单次转化成本';
|
||||
COMMENT ON COLUMN population_report.video_play_count IS '视频播放次数';
|
||||
COMMENT ON COLUMN population_report.video_play_uv IS '视频播放人数';
|
||||
COMMENT ON COLUMN population_report.avg_video_play_duration IS '平均播放时长(秒)';
|
||||
COMMENT ON COLUMN population_report.video_three_second_play_count IS '视频3秒播放次数';
|
||||
COMMENT ON COLUMN population_report.video_five_second_play_count IS '视频5秒播放次数';
|
||||
COMMENT ON COLUMN population_report.tweet_engage_count IS '推文参与数';
|
||||
COMMENT ON COLUMN population_report.tweet_share_count IS '推文分享数';
|
||||
COMMENT ON COLUMN population_report.tweet_comment_count IS '推文评论数';
|
||||
COMMENT ON COLUMN population_report.tweet_like_count IS '推文点赞数';
|
||||
COMMENT ON COLUMN population_report.tweet_repost_count IS '推文转发数';
|
||||
COMMENT ON COLUMN population_report.game_download_count IS '游戏下载数';
|
||||
COMMENT ON COLUMN population_report.app_download_count IS '应用下载数';
|
||||
COMMENT ON COLUMN population_report.app_install_count IS '应用安装数';
|
||||
COMMENT ON COLUMN population_report.onsite_leads_count IS '预注册数';
|
||||
COMMENT ON COLUMN population_report.deep_convert_count IS '深度转化数';
|
||||
COMMENT ON COLUMN population_report.deep_convert_rate IS '深度转化率';
|
||||
COMMENT ON COLUMN population_report.deep_convert_cost IS '深度转化成本';
|
||||
COMMENT ON COLUMN population_report.day IS '数据日期';
|
||||
COMMENT ON COLUMN population_report.datasource IS '数据源';
|
||||
|
||||
CREATE INDEX idx_population_report_cid ON population_report(tenant_id, cid);
|
||||
CREATE INDEX idx_population_report_campaign_id ON population_report(tenant_id, campaign_id);
|
||||
CREATE INDEX idx_population_report_adgroup_id ON population_report(tenant_id, adgroup_id);
|
||||
CREATE INDEX idx_population_report_audience_template_id ON population_report(tenant_id, audience_template_id);
|
||||
CREATE INDEX idx_population_report_day ON population_report(tenant_id, day);
|
||||
CREATE INDEX idx_population_report_datasource ON population_report(tenant_id, datasource);
|
||||
120
sql/08_sync_task_tables.sql
Normal file
120
sql/08_sync_task_tables.sql
Normal file
@@ -0,0 +1,120 @@
|
||||
-- Sync Task and Task Report Tables (同步任务日志和任务报告表)
|
||||
|
||||
-- =============================================
|
||||
-- 同步任务日志表 (sync_task_log)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS sync_task_log_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sync_task_log (
|
||||
id BIGINT NOT NULL DEFAULT nextval('sync_task_log_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
task_id BIGINT NOT NULL DEFAULT 0,
|
||||
report_type VARCHAR(64) NOT NULL DEFAULT '',
|
||||
report_date VARCHAR(10) NOT NULL DEFAULT '',
|
||||
cid VARCHAR(64) NOT NULL DEFAULT '',
|
||||
campaign_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
adgroup_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
ad_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
sync_status VARCHAR(32) NOT NULL DEFAULT '',
|
||||
error_message TEXT NOT NULL DEFAULT '',
|
||||
start_time TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
end_time TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE sync_task_log IS '同步任务日志表';
|
||||
COMMENT ON COLUMN sync_task_log.id IS '主键ID';
|
||||
COMMENT ON COLUMN sync_task_log.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN sync_task_log.creator IS '创建人';
|
||||
COMMENT ON COLUMN sync_task_log.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN sync_task_log.updater IS '更新人';
|
||||
COMMENT ON COLUMN sync_task_log.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN sync_task_log.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN sync_task_log.task_id IS '调控任务ID';
|
||||
COMMENT ON COLUMN sync_task_log.report_type IS '报告类型';
|
||||
COMMENT ON COLUMN sync_task_log.report_date IS '报告日期';
|
||||
COMMENT ON COLUMN sync_task_log.cid IS '广告账户ID';
|
||||
COMMENT ON COLUMN sync_task_log.campaign_id IS '广告系列ID';
|
||||
COMMENT ON COLUMN sync_task_log.adgroup_id IS '广告组ID';
|
||||
COMMENT ON COLUMN sync_task_log.ad_id IS '创意ID';
|
||||
COMMENT ON COLUMN sync_task_log.datasource IS '数据源';
|
||||
COMMENT ON COLUMN sync_task_log.sync_status IS '同步状态';
|
||||
COMMENT ON COLUMN sync_task_log.error_message IS '错误信息';
|
||||
COMMENT ON COLUMN sync_task_log.start_time IS '开始时间';
|
||||
COMMENT ON COLUMN sync_task_log.end_time IS '结束时间';
|
||||
|
||||
CREATE INDEX idx_sync_task_log_task_id ON sync_task_log(tenant_id, task_id);
|
||||
CREATE INDEX idx_sync_task_log_report_type ON sync_task_log(tenant_id, report_type);
|
||||
CREATE INDEX idx_sync_task_log_report_date ON sync_task_log(tenant_id, report_date);
|
||||
CREATE INDEX idx_sync_task_log_cid ON sync_task_log(tenant_id, cid);
|
||||
CREATE INDEX idx_sync_task_log_datasource ON sync_task_log(tenant_id, datasource);
|
||||
CREATE INDEX idx_sync_task_log_sync_status ON sync_task_log(tenant_id, sync_status);
|
||||
CREATE INDEX idx_sync_task_log_created_at ON sync_task_log(tenant_id, created_at);
|
||||
|
||||
-- =============================================
|
||||
-- 调控任务报告表 (task_report)
|
||||
-- =============================================
|
||||
CREATE SEQUENCE IF NOT EXISTS task_report_id_seq;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS task_report (
|
||||
id BIGINT NOT NULL DEFAULT nextval('task_report_id_seq'::regclass),
|
||||
tenant_id BIGINT NOT NULL DEFAULT 0,
|
||||
creator VARCHAR(64) DEFAULT '',
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
updater VARCHAR(64) DEFAULT '',
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT '0001-01-01 00:00:00+00:00',
|
||||
deleted_at TIMESTAMP WITH TIME ZONE,
|
||||
task_id BIGINT NOT NULL DEFAULT 0,
|
||||
datasource VARCHAR(64) NOT NULL DEFAULT '',
|
||||
report_date VARCHAR(10) NOT NULL DEFAULT '',
|
||||
total_count BIGINT NOT NULL DEFAULT 0,
|
||||
success_count BIGINT NOT NULL DEFAULT 0,
|
||||
fail_count BIGINT NOT NULL DEFAULT 0,
|
||||
skip_count BIGINT NOT NULL DEFAULT 0,
|
||||
total_cost DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
total_impression DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
total_click DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
total_conversion DECIMAL(20,6) NOT NULL DEFAULT 0,
|
||||
avg_ctr DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
avg_cpc DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
avg_cpm DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
avg_conversion_rate DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
avg_cpp DECIMAL(20,8) NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
COMMENT ON TABLE task_report IS '调控任务报告表';
|
||||
COMMENT ON COLUMN task_report.id IS '主键ID';
|
||||
COMMENT ON COLUMN task_report.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN task_report.creator IS '创建人';
|
||||
COMMENT ON COLUMN task_report.created_at IS '创建时间';
|
||||
COMMENT ON COLUMN task_report.updater IS '更新人';
|
||||
COMMENT ON COLUMN task_report.updated_at IS '更新时间';
|
||||
COMMENT ON COLUMN task_report.deleted_at IS '软删除时间';
|
||||
COMMENT ON COLUMN task_report.task_id IS '调控任务ID';
|
||||
COMMENT ON COLUMN task_report.datasource IS '数据源';
|
||||
COMMENT ON COLUMN task_report.report_date IS '报告日期';
|
||||
COMMENT ON COLUMN task_report.total_count IS '总数量';
|
||||
COMMENT ON COLUMN task_report.success_count IS '成功数量';
|
||||
COMMENT ON COLUMN task_report.fail_count IS '失败数量';
|
||||
COMMENT ON COLUMN task_report.skip_count IS '跳过数量';
|
||||
COMMENT ON COLUMN task_report.total_cost IS '总花费(元)';
|
||||
COMMENT ON COLUMN task_report.total_impression IS '总展示数';
|
||||
COMMENT ON COLUMN task_report.total_click IS '总点击数';
|
||||
COMMENT ON COLUMN task_report.total_conversion IS '总转化数';
|
||||
COMMENT ON COLUMN task_report.avg_ctr IS '平均点击率';
|
||||
COMMENT ON COLUMN task_report.avg_cpc IS '平均点击价格';
|
||||
COMMENT ON COLUMN task_report.avg_cpm IS '平均千次展现成本';
|
||||
COMMENT ON COLUMN task_report.avg_conversion_rate IS '平均转化率';
|
||||
COMMENT ON COLUMN task_report.avg_cpp IS '平均单次转化成本';
|
||||
|
||||
CREATE INDEX idx_task_report_task_id ON task_report(tenant_id, task_id);
|
||||
CREATE INDEX idx_task_report_datasource ON task_report(tenant_id, datasource);
|
||||
CREATE INDEX idx_task_report_report_date ON task_report(tenant_id, report_date);
|
||||
CREATE UNIQUE INDEX idx_task_report_unique ON task_report(tenant_id, task_id, datasource, report_date);
|
||||
@@ -1,9 +1,9 @@
|
||||
package syncdata
|
||||
|
||||
import (
|
||||
dto "cid/model/dto/copydata"
|
||||
"cid/service/copydata"
|
||||
"context"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
"dataengine/service/copydata"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package syncdata
|
||||
|
||||
import (
|
||||
"cid/model/dto/copydata"
|
||||
"dataengine/model/dto/copydata"
|
||||
)
|
||||
|
||||
type DataConverter struct{}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package syncdata
|
||||
|
||||
import (
|
||||
dao "cid/dao/copydata"
|
||||
dto "cid/model/dto/copydata"
|
||||
taskDto "cid/model/dto/copydata"
|
||||
"cid/service/copydata"
|
||||
"context"
|
||||
dao "dataengine/dao/copydata"
|
||||
dto "dataengine/model/dto/copydata"
|
||||
taskDto "dataengine/model/dto/copydata"
|
||||
"dataengine/service/copydata"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
Reference in New Issue
Block a user