Dockerfile
This commit is contained in:
108
model/entity/sync/channel_config.go
Normal file
108
model/entity/sync/channel_config.go
Normal file
@@ -0,0 +1,108 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
// ChannelConfig 渠道配置 - 租户针对三方渠道的配置信息
|
||||
type ChannelConfig struct {
|
||||
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段
|
||||
|
||||
// 渠道专用配置
|
||||
TaobaoConfig *TaobaoConfig `bson:"taobaoConfig,omitempty" json:"taobaoConfig,omitempty"`
|
||||
JDConfig *JDConfig `bson:"jdConfig,omitempty" json:"jdConfig,omitempty"`
|
||||
KuaishouConfig *KuaishouConfig `bson:"kuaishouConfig,omitempty" json:"kuaishouConfig,omitempty"`
|
||||
DouyinConfig *DouyinConfig `bson:"douyinConfig,omitempty" json:"douyinConfig,omitempty"`
|
||||
XhsConfig *XhsConfig `bson:"xhsConfig,omitempty" json:"xhsConfig,omitempty"`
|
||||
PddConfig *PddConfig `bson:"pddConfig,omitempty" json:"pddConfig,omitempty"`
|
||||
XianyuConfig *XianyuConfig `bson:"xianyuConfig,omitempty" json:"xianyuConfig,omitempty"`
|
||||
BlockchainConfig *BlockchainConfig `bson:"blockchainConfig,omitempty" json:"blockchainConfig,omitempty"`
|
||||
}
|
||||
|
||||
// 各渠道专用配置结构
|
||||
|
||||
// TaobaoConfig 淘宝配置
|
||||
type TaobaoConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
RefreshToken string `bson:"refreshToken" json:"refreshToken"` // 刷新令牌
|
||||
ShopID string `bson:"shopId" json:"shopId"` // 店铺ID
|
||||
SellerID string `bson:"sellerId" json:"sellerId"` // 卖家ID
|
||||
}
|
||||
|
||||
// JDConfig 京东配置
|
||||
type JDConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
VenderID string `bson:"venderId" json:"venderId"` // 商家ID
|
||||
WarehouseID string `bson:"warehouseId" json:"warehouseId"` // 仓库ID
|
||||
}
|
||||
|
||||
// KuaishouConfig 快手配置
|
||||
type KuaishouConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppID string `bson:"appId" json:"appId"` // 应用ID
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
LiveRoomID string `bson:"liveRoomId" json:"liveRoomId"` // 直播间ID
|
||||
}
|
||||
|
||||
// DouyinConfig 抖音配置
|
||||
type DouyinConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppID string `bson:"appId" json:"appId"` // 应用ID
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
LiveRoomID string `bson:"liveRoomId" json:"liveRoomId"` // 直播间ID
|
||||
VideoID string `bson:"videoId" json:"videoId"` // 视频ID
|
||||
}
|
||||
|
||||
// XhsConfig 小红书配置
|
||||
type XhsConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
NoteID string `bson:"noteId" json:"noteId"` // 笔记ID
|
||||
}
|
||||
|
||||
// PddConfig 拼多多配置
|
||||
type PddConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
ClientID string `bson:"clientId" json:"clientId"` // 客户端ID
|
||||
ClientSecret string `bson:"clientSecret" json:"clientSecret"` // 客户端密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
MallID string `bson:"mallId" json:"mallId"` // 店铺ID
|
||||
}
|
||||
|
||||
// XianyuConfig 闲鱼配置
|
||||
type XianyuConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
AppKey string `bson:"appKey" json:"appKey"` // 应用Key
|
||||
AppSecret string `bson:"appSecret" json:"appSecret"` // 应用密钥
|
||||
AccessToken string `bson:"accessToken" json:"accessToken"` // 访问令牌
|
||||
}
|
||||
|
||||
// BlockchainConfig 区块链配置
|
||||
type BlockchainConfig struct {
|
||||
Enabled bool `bson:"enabled" json:"enabled"` // 是否启用
|
||||
DefaultPriceAdjustment float64 `bson:"defaultPriceAdjustment" json:"defaultPriceAdjustment"` // 默认价格调整系数
|
||||
ChainName string `bson:"chainName" json:"chainName"` // 链名称
|
||||
ContractAddress string `bson:"contractAddress" json:"contractAddress"` // 合约地址
|
||||
PrivateKey string `bson:"privateKey" json:"privateKey"` // 私钥
|
||||
RPCURL string `bson:"rpcUrl" json:"rpcUrl"` // RPC地址
|
||||
}
|
||||
|
||||
// CollectionName 渠道配置集合名称
|
||||
func (ChannelConfig) CollectionName() string {
|
||||
return "channel_config"
|
||||
}
|
||||
45
model/entity/sync/channel_sync_record.go
Normal file
45
model/entity/sync/channel_sync_record.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"assets/consts/public"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// ChannelSyncRecord 渠道同步记录
|
||||
type ChannelSyncRecord struct {
|
||||
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段
|
||||
|
||||
// 关联关系
|
||||
AssetID *bson.ObjectID `bson:"assetId" json:"assetId"` // 关联资产ID
|
||||
SkuID *bson.ObjectID `bson:"skuId" json:"skuId"` // 关联SKU ID
|
||||
Channel public.SyncPlatform `bson:"channel" json:"channel"` // 渠道类型
|
||||
|
||||
// 同步状态信息
|
||||
Status public.SyncStatus `bson:"status" json:"status"` // 同步状态
|
||||
|
||||
// 渠道商品信息
|
||||
ChannelProductID *bson.ObjectID `bson:"channelProductId" json:"channelProductId"` // 渠道商品ID
|
||||
ChannelSkuID *bson.ObjectID `bson:"channelSkuId" json:"channelSkuId"` // 渠道SKU ID
|
||||
ChannelURL string `bson:"channelUrl" json:"channelUrl"` // 渠道商品链接
|
||||
|
||||
// 同步信息
|
||||
LastSyncTime *gtime.Time `bson:"lastSyncTime" json:"lastSyncTime"` // 最后同步时间
|
||||
LastSyncResult *SyncResult `bson:"lastSyncResult" json:"lastSyncResult"` // 最后同步结果
|
||||
ErrorCount int `bson:"errorCount" json:"errorCount"` // 错误次数
|
||||
}
|
||||
|
||||
// CollectionName 渠道同步记录集合名称
|
||||
func (ChannelSyncRecord) CollectionName() string {
|
||||
return "channel_sync_record"
|
||||
}
|
||||
|
||||
// SyncResult 同步结果
|
||||
type SyncResult struct {
|
||||
Success bool `bson:"success" json:"success"` // 是否成功
|
||||
ErrorMsg string `bson:"errorMsg" json:"errorMsg"` // 错误信息
|
||||
SyncTime *gtime.Time `bson:"syncTime" json:"syncTime"` // 同步时间
|
||||
Data map[string]interface{} `bson:"data" json:"data"` // 同步数据
|
||||
}
|
||||
30
model/entity/sync/sync_task.go
Normal file
30
model/entity/sync/sync_task.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package entity
|
||||
|
||||
import (
|
||||
"assets/consts/public"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// SyncTask 同步任务实体
|
||||
type SyncTask struct {
|
||||
beans.MongoBaseDO `bson:",inline"` // 嵌入基础字段:Id, Creator, CreatedAt, Updater, UpdatedAt, TenantId, IsDeleted
|
||||
|
||||
Platform public.SyncPlatform `json:"platform" bson:"platform"`
|
||||
SyncType public.SyncType `json:"syncType" bson:"syncType"`
|
||||
Status public.SyncStatus `json:"status" bson:"status"`
|
||||
AssetID *bson.ObjectID `json:"assetId" bson:"assetId"`
|
||||
AssetSKUID *bson.ObjectID `json:"assetSkuId" bson:"assetSkuId"`
|
||||
StockID *bson.ObjectID `json:"stockId" bson:"stockId"`
|
||||
ErrorMessage string `json:"errorMessage" bson:"errorMessage"`
|
||||
ErrorCount int `json:"errorCount" bson:"errorCount"`
|
||||
StartedAt *gtime.Time `json:"startedAt" bson:"startedAt"`
|
||||
FinishedAt *gtime.Time `json:"finishedAt" bson:"finishedAt"`
|
||||
}
|
||||
|
||||
// CollectionName 获取集合名称
|
||||
func (SyncTask) CollectionName() string {
|
||||
return "sync_task"
|
||||
}
|
||||
Reference in New Issue
Block a user