Dockerfile
This commit is contained in:
56
model/entity/data/api_interface.go
Normal file
56
model/entity/data/api_interface.go
Normal file
@@ -0,0 +1,56 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
consts "cid/consts/data"
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// ApiInterface 接口管理实体
|
||||
type ApiInterface struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
// 基础信息
|
||||
PlatformId int64 `orm:"platform_id" json:"platformId" description:"所属平台ID"`
|
||||
Name string `orm:"name" json:"name" description:"接口名称"`
|
||||
Code string `orm:"code" json:"code" description:"接口编码"`
|
||||
Url string `orm:"url" json:"url" description:"接口地址"`
|
||||
Method consts.ApiMethod `orm:"method" json:"method" description:"请求方法:GET/POST/PUT/DELETE等"`
|
||||
Status consts.PlatformStatus `orm:"status" json:"status" description:"接口状态:active启用/inactive停用"`
|
||||
// 认证类型
|
||||
AuthType string `orm:"auth_type" json:"authType" description:"认证类型:oauth2/apikey/basic等"`
|
||||
// 请求配置 (JSONB)
|
||||
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置"`
|
||||
// 响应配置 (JSONB)
|
||||
ResponseConfig map[string]interface{} `orm:"response_config" json:"responseConfig" description:"响应配置"`
|
||||
// 独立限流配置 (JSONB)
|
||||
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"接口独立限流配置(可选,覆盖平台配置)"`
|
||||
}
|
||||
|
||||
// ApiInterfaceCol 接口表字段定义
|
||||
type ApiInterfaceCol struct {
|
||||
beans.SQLBaseCol
|
||||
PlatformId string
|
||||
Name string
|
||||
Code string
|
||||
Url string
|
||||
Method string
|
||||
Status string
|
||||
AuthType string
|
||||
RequestConfig string
|
||||
ResponseConfig string
|
||||
LimitConfig string
|
||||
}
|
||||
|
||||
// ApiInterfaceCols 接口表字段常量
|
||||
var ApiInterfaceCols = ApiInterfaceCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
PlatformId: "platform_id",
|
||||
Name: "name",
|
||||
Code: "code",
|
||||
Url: "url",
|
||||
Method: "method",
|
||||
Status: "status",
|
||||
AuthType: "auth_type",
|
||||
RequestConfig: "request_config",
|
||||
ResponseConfig: "response_config",
|
||||
LimitConfig: "limit_config",
|
||||
}
|
||||
58
model/entity/data/data_fetch_log.go
Normal file
58
model/entity/data/data_fetch_log.go
Normal file
@@ -0,0 +1,58 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
consts "cid/consts/data"
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// DataFetchLog 数据获取日志实体
|
||||
type DataFetchLog struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
// 关联信息
|
||||
PlatformId int64 `orm:"platform_id" json:"platformId" description:"平台ID"`
|
||||
InterfaceId int64 `orm:"interface_id" json:"interfaceId" description:"接口ID"`
|
||||
RequestId string `orm:"request_id" json:"requestId" description:"请求ID"`
|
||||
// 执行状态
|
||||
Status consts.FetchStatus `orm:"status" json:"status" description:"执行状态:pending/running/success/failed/rate_limit"`
|
||||
StartTime int64 `orm:"start_time" json:"startTime" description:"开始时间(时间戳)"`
|
||||
EndTime int64 `orm:"end_time" json:"endTime" description:"结束时间(时间戳)"`
|
||||
Duration int `orm:"duration" json:"duration" description:"执行时长(毫秒)"`
|
||||
// 请求响应数据
|
||||
RequestConfig map[string]interface{} `orm:"request_config" json:"requestConfig" description:"请求配置参数"`
|
||||
ResponseData string `orm:"response_data" json:"responseData" description:"响应数据(JSON)"`
|
||||
ErrorMessage string `orm:"error_message" json:"errorMessage" description:"错误信息"`
|
||||
// 重试信息
|
||||
RetryCount int `orm:"retry_count" json:"retryCount" description:"重试次数"`
|
||||
}
|
||||
|
||||
// DataFetchLogCol 数据获取日志表字段定义
|
||||
type DataFetchLogCol struct {
|
||||
beans.SQLBaseCol
|
||||
PlatformId string
|
||||
InterfaceId string
|
||||
RequestId string
|
||||
Status string
|
||||
StartTime string
|
||||
EndTime string
|
||||
Duration string
|
||||
RequestConfig string
|
||||
ResponseData string
|
||||
ErrorMessage string
|
||||
RetryCount string
|
||||
}
|
||||
|
||||
// DataFetchLogCols 数据获取日志表字段常量
|
||||
var DataFetchLogCols = DataFetchLogCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
PlatformId: "platform_id",
|
||||
InterfaceId: "interface_id",
|
||||
RequestId: "request_id",
|
||||
Status: "status",
|
||||
StartTime: "start_time",
|
||||
EndTime: "end_time",
|
||||
Duration: "duration",
|
||||
RequestConfig: "request_config",
|
||||
ResponseData: "response_data",
|
||||
ErrorMessage: "error_message",
|
||||
RetryCount: "retry_count",
|
||||
}
|
||||
46
model/entity/data/platform.go
Normal file
46
model/entity/data/platform.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
consts "cid/consts/data"
|
||||
"gitea.com/red-future/common/beans"
|
||||
)
|
||||
|
||||
// Platform 平台管理实体
|
||||
type Platform struct {
|
||||
beans.SQLBaseDO `orm:",inherit"`
|
||||
// 基础信息
|
||||
Name string `orm:"name" json:"name" description:"平台名称"`
|
||||
Type consts.SyncPlatform `orm:"type" json:"type" description:"平台类型"`
|
||||
Status consts.PlatformStatus `orm:"status" json:"status" description:"平台状态:active启用/inactive停用"`
|
||||
Description string `orm:"description" json:"description" description:"平台描述"`
|
||||
// 认证配置 (JSONB)
|
||||
AuthConfig map[string]interface{} `orm:"auth_config" json:"authConfig" description:"认证配置"`
|
||||
// 限流配置 (JSONB)
|
||||
LimitConfig map[string]interface{} `orm:"limit_config" json:"limitConfig" description:"限流配置"`
|
||||
// 平台专用配置 (JSONB)
|
||||
PlatformConfig map[string]interface{} `orm:"platform_config" json:"platformConfig" description:"平台专用配置"`
|
||||
}
|
||||
|
||||
// PlatformCol 平台表字段定义
|
||||
type PlatformCol struct {
|
||||
beans.SQLBaseCol
|
||||
Name string
|
||||
Type string
|
||||
Status string
|
||||
Description string
|
||||
AuthConfig string
|
||||
LimitConfig string
|
||||
PlatformConfig string
|
||||
}
|
||||
|
||||
// PlatformCols 平台表字段常量
|
||||
var PlatformCols = PlatformCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
Name: "name",
|
||||
Type: "type",
|
||||
Status: "status",
|
||||
Description: "description",
|
||||
AuthConfig: "auth_config",
|
||||
LimitConfig: "limit_config",
|
||||
PlatformConfig: "platform_config",
|
||||
}
|
||||
Reference in New Issue
Block a user