Files
assets/model/entity/sync/channel_config.go
2026-03-18 10:18:03 +08:00

109 lines
7.1 KiB
Go

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"
}