代码初始化

This commit is contained in:
2026-04-02 11:51:44 +08:00
commit b87244638f
83 changed files with 13084 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
package api_feature
// ApiMethod 接口请求方法
type ApiMethod string
const (
ApiMethodGet ApiMethod = "GET" // GET请求
ApiMethodPost ApiMethod = "POST" // POST请求
ApiMethodPut ApiMethod = "PUT" // PUT请求
ApiMethodDelete ApiMethod = "DELETE" // DELETE请求
ApiMethodPatch ApiMethod = "PATCH" // PATCH请求
ApiMethodHead ApiMethod = "HEAD" // HEAD请求
ApiMethodOptions ApiMethod = "OPTIONS" // OPTIONS请求
)
func (m ApiMethod) String() string {
return string(m)
}

View File

@@ -0,0 +1,13 @@
package api_feature
// AppStatus 应用状态
type AppStatus string
const (
AppStatusActive AppStatus = "active" // 启用
AppStatusInactive AppStatus = "inactive" // 停用
)
func (s AppStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,17 @@
package api_feature
// AppType 应用类型
type AppType string
const (
AppTypeWeb AppType = "web" // Web应用
AppTypeMobile AppType = "mobile" // 移动应用
AppTypeMiniApp AppType = "mini_app" // 小程序
AppTypeH5 AppType = "h5" // H5应用
AppTypeDesktop AppType = "desktop" // 桌面应用
AppTypeThirdParty AppType = "third_party" // 第三方应用
)
func (s AppType) String() string {
return string(s)
}

View File

@@ -0,0 +1,16 @@
package api_feature
// FetchStatus 数据获取状态
type FetchStatus string
const (
FetchStatusPending FetchStatus = "pending" // 待执行
FetchStatusRunning FetchStatus = "running" // 执行中
FetchStatusSuccess FetchStatus = "success" // 成功
FetchStatusFailed FetchStatus = "failed" // 失败
FetchStatusRateLimit FetchStatus = "rate_limit" // 触发限流
)
func (f FetchStatus) String() string {
return string(f)
}

View File

@@ -0,0 +1,14 @@
package api_feature
// LimitType 限流类型
type LimitType string
const (
LimitTypeApp LimitType = "app" // 应用维度限流
LimitTypeTenant LimitType = "tenant" // 租户维度限流
LimitTypeApi LimitType = "api" // 接口维度限流
)
func (l LimitType) String() string {
return string(l)
}

View File

@@ -0,0 +1,13 @@
package api_feature
// MappingStatus 映射状态
type MappingStatus string
const (
MappingStatusActive MappingStatus = "active" // 启用
MappingStatusInactive MappingStatus = "inactive" // 停用
)
func (s MappingStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,13 @@
package api_feature
// PlatformStatus 平台状态
type PlatformStatus string
const (
PlatformStatusActive PlatformStatus = "active" // 启用
PlatformStatusInactive PlatformStatus = "inactive" // 停用
)
func (s PlatformStatus) String() string {
return string(s)
}

View File

@@ -0,0 +1,21 @@
package api_feature
// SyncPlatform 同步平台类型
type SyncPlatform string
const (
PlatformTaobao SyncPlatform = "taobao" // 淘宝
PlatformJD SyncPlatform = "jd" // 京东
PlatformKuaishou SyncPlatform = "kuaishou" // 快手
PlatformDouyin SyncPlatform = "douyin" // 抖音
PlatformXhs SyncPlatform = "xhs" // 小红书
PlatformPdd SyncPlatform = "pdd" // 拼多多
PlatformXianyu SyncPlatform = "xianyu" // 闲鱼
PlatformTmall SyncPlatform = "tmall" // 天猫
PlatformWechat SyncPlatform = "wechat" // 微信
PlatformCustom SyncPlatform = "custom" // 自定义平台
)
func (s SyncPlatform) String() string {
return string(s)
}

View File

@@ -0,0 +1,16 @@
package api_feature
// TransformType 转换类型
type TransformType string
const (
TransformTypeFixed TransformType = "fixed" // 固定值
TransformTypeMapping TransformType = "mapping" // 值映射
TransformTypeRegex TransformType = "regex" // 正则转换
TransformTypeFunction TransformType = "function" // 函数转换
TransformTypeScript TransformType = "script" // 脚本转换
)
func (t TransformType) String() string {
return string(t)
}

51
consts/dict/consts.go Normal file
View File

@@ -0,0 +1,51 @@
package dict
// 转换类型
const (
TransformTypeDirect = "direct" // 直接映射
TransformTypeFormatDate = "formatDate" // 日期格式化
TransformTypeMapValue = "mapValue" // 值映射
TransformTypeConcat = "concat" // 拼接
TransformTypeCalc = "calc" // 计算
TransformTypeRegex = "regex" // 正则提取
)
// 业务域
const (
BusinessDomainUser = "user" // 用户
BusinessDomainOrder = "order" // 订单
BusinessDomainProduct = "product" // 商品
BusinessDomainPayment = "payment" // 支付
)
// 字段类型
const (
FieldTypeString = "string"
FieldTypeNumber = "number"
FieldTypeInteger = "integer"
FieldTypeBoolean = "boolean"
FieldTypeArray = "array"
FieldTypeObject = "object"
FieldTypeDate = "date"
FieldTypeTime = "time"
FieldTypeDateTime = "datetime"
)
// 平台状态
type PlatformStatus string
const (
PlatformStatusActive PlatformStatus = "active"
PlatformStatusInactive PlatformStatus = "inactive"
)
// 接口方法
type ApiMethod string
const (
ApiMethodGET ApiMethod = "GET"
ApiMethodPOST ApiMethod = "POST"
ApiMethodPUT ApiMethod = "PUT"
ApiMethodDELETE ApiMethod = "DELETE"
ApiMethodPATCH ApiMethod = "PATCH"
)

View File

@@ -0,0 +1,19 @@
package public
// PostgreSQL表名常量
const (
ApiInterfaceTable = "cid_api_interface" // 接口管理表
CidAccountReportDetailTable = "cid_account_report_detail" // 广告账户数据明细表
CidAccountReportSumTable = "cid_account_report_sum" // 广告账户数据汇总表
FieldMappingConfigTable = "field_mapping_config" // 字段映射表
DatasourcePlatformTable = "datasource_platform" // 数据源平台表
TaskReportTable = "task_report" // 调控任务数据表
PopulationReportTable = "population_report" // 人群报表表
MaterialReportTable = "material_report" // 素材报表表
StorewideReportSumTable = "storewide_report_sum" // 全站数据sum表
StorewideReportDetailTable = "storewide_report_detail" // 全站数据detail表
CreativeReportSumTable = "creative_report_sum" // 广告创意数据sum表
CreativeReportDetailTable = "creative_report_detail" // 广告创意数据detail表
UnitReportSumTable = "unit_report_sum" // 广告创意数据detail表
UnitReportDetailTable = "unit_report_detail" // 广告创意数据detail表
)