1、文档规范化

2、增加cid核心功能entity
This commit is contained in:
2026-08-25 15:06:34 +08:00
parent b3c0855236
commit 6ce3ebbb91
22 changed files with 1108 additions and 194 deletions
+60
View File
@@ -0,0 +1,60 @@
package platform
import (
"gitea.redpowerfuture.com/red-future/common/beans"
)
// AdAccount 广告账户实体(平台凭据 + 多级层级 + API能力标识)
type AdAccount struct {
beans.SQLBaseDO `orm:",inherit"`
// 业务字段
AdvertiserID int64 `orm:"advertiser_id" json:"advertiserId" description:"归属广告主ID"`
Name string `orm:"name" json:"name" description:"账户显示名"`
Platform string `orm:"platform" json:"platform" description:"广告平台 douyin/xiaohongshu/kuaishou"`
AccountID string `orm:"account_id" json:"accountId" description:"平台侧账户ID"`
ParentAccountID int64 `orm:"parent_account_id" json:"parentAccountId" description:"上级账户ID(多级代理层级,自引用)"`
AccountRole string `orm:"account_role" json:"accountRole" description:"账户角色 agent/owner/sub"`
Capabilities string `orm:"capabilities" json:"capabilities" description:"API能力(JSON) attribution/delivery/report"`
AppID string `orm:"app_id" json:"appId" description:"应用ID"`
AppSecret string `orm:"app_secret" json:"appSecret" description:"应用密钥"`
AccessToken string `orm:"access_token" json:"accessToken" description:"访问令牌"`
TokenExpireAt int64 `orm:"token_expire_at" json:"tokenExpireAt" description:"令牌过期时间戳"`
Config string `orm:"config" json:"config" description:"平台特定配置(JSON) 含回传事件映射等"`
Enabled bool `orm:"enabled" json:"enabled" description:"是否启用"`
}
// AdAccountCol 广告账户表字段定义
type AdAccountCol struct {
beans.SQLBaseCol
AdvertiserID string
Name string
Platform string
AccountID string
ParentAccountID string
AccountRole string
Capabilities string
AppID string
AppSecret string
AccessToken string
TokenExpireAt string
Config string
Enabled string
}
// AdAccountCols 广告账户表字段常量
var AdAccountCols = AdAccountCol{
SQLBaseCol: beans.DefSQLBaseCol,
AdvertiserID: "advertiser_id",
Name: "name",
Platform: "platform",
AccountID: "account_id",
ParentAccountID: "parent_account_id",
AccountRole: "account_role",
Capabilities: "capabilities",
AppID: "app_id",
AppSecret: "app_secret",
AccessToken: "access_token",
TokenExpireAt: "token_expire_at",
Config: "config",
Enabled: "enabled",
}
@@ -1,45 +0,0 @@
package platform
import (
"gitea.redpowerfuture.com/red-future/common/beans"
)
// AdPlatformAccount 广告平台账户配置实体(上游广告平台对接凭据)
type AdPlatformAccount struct {
beans.SQLBaseDO `orm:",inherit"`
// 业务字段
Platform string `orm:"platform" json:"platform" description:"广告平台 douyin/xiaohongshu/kuaishou"`
AccountID string `orm:"account_id" json:"accountId" description:"平台侧账户ID"`
AppID string `orm:"app_id" json:"appId" description:"应用ID"`
AppSecret string `orm:"app_secret" json:"appSecret" description:"应用密钥"`
AccessToken string `orm:"access_token" json:"accessToken" description:"访问令牌"`
TokenExpireAt int64 `orm:"token_expire_at" json:"tokenExpireAt" description:"令牌过期时间戳"`
Config string `orm:"config" json:"config" description:"平台特定配置(JSON)"`
Enabled bool `orm:"enabled" json:"enabled" description:"是否启用"`
}
// AdPlatformAccountCol 广告平台账户表字段定义
type AdPlatformAccountCol struct {
beans.SQLBaseCol
Platform string
AccountID string
AppID string
AppSecret string
AccessToken string
TokenExpireAt string
Config string
Enabled string
}
// AdPlatformAccountCols 广告平台账户表字段常量
var AdPlatformAccountCols = AdPlatformAccountCol{
SQLBaseCol: beans.DefSQLBaseCol,
Platform: "platform",
AccountID: "account_id",
AppID: "app_id",
AppSecret: "app_secret",
AccessToken: "access_token",
TokenExpireAt: "token_expire_at",
Config: "config",
Enabled: "enabled",
}
@@ -8,32 +8,38 @@ import (
type CommercePlatformConfig struct {
beans.SQLBaseDO `orm:",inherit"`
// 业务字段
Platform string `orm:"platform" json:"platform" description:"电商平台 jd/taobao"`
AppKey string `orm:"app_key" json:"appKey" description:"应用Key"`
AppSecret string `orm:"app_secret" json:"appSecret" description:"应用密钥"`
CallbackURL string `orm:"callback_url" json:"callbackUrl" description:"订单回调接收URL"`
Config string `orm:"config" json:"config" description:"平台特定配置(JSON)"`
Enabled bool `orm:"enabled" json:"enabled" description:"是否启用"`
AdvertiserID int64 `orm:"advertiser_id" json:"advertiserId" description:"归属广告主ID"`
Name string `orm:"name" json:"name" description:"配置显示名"`
Platform string `orm:"platform" json:"platform" description:"电商平台 jd/taobao"`
AppKey string `orm:"app_key" json:"appKey" description:"应用Key"`
AppSecret string `orm:"app_secret" json:"appSecret" description:"应用密钥"`
CallbackURL string `orm:"callback_url" json:"callbackUrl" description:"订单回调接收URL"`
Config string `orm:"config" json:"config" description:"平台特定配置(JSON)"`
Enabled bool `orm:"enabled" json:"enabled" description:"是否启用"`
}
// CommercePlatformConfigCol 电商平台配置表字段定义
type CommercePlatformConfigCol struct {
beans.SQLBaseCol
Platform string
AppKey string
AppSecret string
CallbackURL string
Config string
Enabled string
AdvertiserID string
Name string
Platform string
AppKey string
AppSecret string
CallbackURL string
Config string
Enabled string
}
// CommercePlatformConfigCols 电商平台配置表字段常量
var CommercePlatformConfigCols = CommercePlatformConfigCol{
SQLBaseCol: beans.DefSQLBaseCol,
Platform: "platform",
AppKey: "app_key",
AppSecret: "app_secret",
CallbackURL: "callback_url",
Config: "config",
Enabled: "enabled",
SQLBaseCol: beans.DefSQLBaseCol,
AdvertiserID: "advertiser_id",
Name: "name",
Platform: "platform",
AppKey: "app_key",
AppSecret: "app_secret",
CallbackURL: "callback_url",
Config: "config",
Enabled: "enabled",
}
+3
View File
@@ -8,6 +8,7 @@ import (
type ItemMapping struct {
beans.SQLBaseDO `orm:",inherit"`
// 业务字段
AdvertiserID int64 `orm:"advertiser_id" json:"advertiserId" description:"归属广告主ID"`
AdPlatform string `orm:"ad_platform" json:"adPlatform" description:"广告平台"`
AdItemID string `orm:"ad_item_id" json:"adItemId" description:"广告平台侧商品ID"`
CommercePlatform string `orm:"commerce_platform" json:"commercePlatform" description:"电商平台"`
@@ -19,6 +20,7 @@ type ItemMapping struct {
// ItemMappingCol 商品映射表字段定义
type ItemMappingCol struct {
beans.SQLBaseCol
AdvertiserID string
AdPlatform string
AdItemID string
CommercePlatform string
@@ -30,6 +32,7 @@ type ItemMappingCol struct {
// ItemMappingCols 商品映射表字段常量
var ItemMappingCols = ItemMappingCol{
SQLBaseCol: beans.DefSQLBaseCol,
AdvertiserID: "advertiser_id",
AdPlatform: "ad_platform",
AdItemID: "ad_item_id",
CommercePlatform: "commerce_platform",