Dockerfile
This commit is contained in:
248
model/dto/sync/platform_dto.go
Normal file
248
model/dto/sync/platform_dto.go
Normal file
@@ -0,0 +1,248 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
consts "assets/consts/public"
|
||||
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// AssetRequest 通用资产请求结构体
|
||||
type AssetRequest struct {
|
||||
ID *bson.ObjectID `json:"id" dc:"资产ID"`
|
||||
Name string `json:"name" dc:"资产名称"`
|
||||
CategoryID *bson.ObjectID `json:"categoryId" dc:"分类ID"`
|
||||
ImageURL string `json:"imageUrl" dc:"主图URL"`
|
||||
Images interface{} `json:"images" dc:"图片列表"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
BasePrice float64 `json:"basePrice" dc:"基础价格"`
|
||||
SalePrice float64 `json:"salePrice" dc:"销售价格"`
|
||||
BrandID string `json:"brandId" dc:"品牌ID"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
}
|
||||
|
||||
// AssetResponse 通用资产响应结构体
|
||||
type AssetResponse struct {
|
||||
ID *bson.ObjectID `json:"id" dc:"资产ID"`
|
||||
Name string `json:"name" dc:"资产名称"`
|
||||
CategoryID *bson.ObjectID `json:"categoryId" dc:"分类ID"`
|
||||
ImageURL string `json:"imageUrl" dc:"主图URL"`
|
||||
Images interface{} `json:"images" dc:"图片列表"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
BasePrice float64 `json:"basePrice" dc:"基础价格"`
|
||||
SalePrice float64 `json:"salePrice" dc:"销售价格"`
|
||||
Platform string `json:"platform" dc:"平台"`
|
||||
}
|
||||
|
||||
// APIResponse 通用API响应结构体
|
||||
type APIResponse struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
ErrorCode int64 `json:"error_code,omitempty" dc:"错误码"`
|
||||
ErrorMsg string `json:"error_msg,omitempty" dc:"错误信息"`
|
||||
Data interface{} `json:"data,omitempty" dc:"响应数据"`
|
||||
}
|
||||
|
||||
// PlatformMapping 平台映射结构体
|
||||
type PlatformMapping struct {
|
||||
AssetID string `json:"asset_id" dc:"资产ID"`
|
||||
PlatformID string `json:"platform_id" dc:"平台ID"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
PlatformType string `json:"platform_type" dc:"平台类型"`
|
||||
}
|
||||
|
||||
// KuaishouAssetRequest 快手资产请求结构体
|
||||
type KuaishouAssetRequest struct {
|
||||
Title string `json:"title" dc:"商品标题"`
|
||||
CategoryID int64 `json:"category_id" dc:"分类ID"`
|
||||
MainImage string `json:"main_image" dc:"主图"`
|
||||
Images interface{} `json:"images" dc:"图片列表"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
}
|
||||
|
||||
// KuaishouAssetResponse 快手资产响应结构体
|
||||
type KuaishouAssetResponse struct {
|
||||
ItemID string `json:"item_id" dc:"商品ID"`
|
||||
Title string `json:"title" dc:"商品标题"`
|
||||
CategoryID int64 `json:"category_id" dc:"分类ID"`
|
||||
MainImage string `json:"main_image" dc:"主图"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// KuaishouSkuRequest 快手SKU请求结构体
|
||||
type KuaishouSkuRequest struct {
|
||||
SkuName string `json:"sku_name" dc:"SKU名称"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
StockNum int64 `json:"stock_num" dc:"库存数量"`
|
||||
Specs interface{} `json:"specs" dc:"规格参数"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// KuaishouStockRequest 快手库存请求结构体
|
||||
type KuaishouStockRequest struct {
|
||||
SkuID string `json:"sku_id" dc:"SKU ID"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
StockNum int64 `json:"stock_num" dc:"库存数量"`
|
||||
LockStockNum int64 `json:"lock_stock_num" dc:"锁定库存"`
|
||||
InTransitNum int64 `json:"in_transit_num" dc:"在途数量"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// DouyinAssetRequest 抖音资产请求结构体
|
||||
type DouyinAssetRequest struct {
|
||||
Goods struct {
|
||||
ProductName string `json:"product_name" dc:"商品名称"`
|
||||
SecCategoryID int64 `json:"sec_category_id" dc:"二级分类ID"`
|
||||
MainImg string `json:"main_img" dc:"主图"`
|
||||
Imgs interface{} `json:"imgs" dc:"图片列表"`
|
||||
DetailHTML string `json:"detail_html" dc:"详情HTML"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
DiscountPrice float64 `json:"discount_price" dc:"折扣价"`
|
||||
MobileDetail string `json:"mobile_detail" dc:"移动端详情"`
|
||||
PayType int `json:"pay_type" dc:"支付类型"`
|
||||
DeliveryInfo interface{} `json:"delivery_info" dc:"配送信息"`
|
||||
} `json:"goods" dc:"商品信息"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
}
|
||||
|
||||
// DouyinAssetResponse 抖音资产响应结构体
|
||||
type DouyinAssetResponse struct {
|
||||
GoodsID string `json:"goods_id" dc:"商品ID"`
|
||||
ProductName string `json:"product_name" dc:"商品名称"`
|
||||
SecCategoryID int64 `json:"sec_category_id" dc:"二级分类ID"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
DiscountPrice float64 `json:"discount_price" dc:"折扣价"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// DouyinSkuRequest 抖音SKU请求结构体
|
||||
type DouyinSkuRequest struct {
|
||||
SkuName string `json:"sku_name" dc:"SKU名称"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
StockNum int64 `json:"stock_num" dc:"库存数量"`
|
||||
Specs interface{} `json:"specs" dc:"规格参数"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// DouyinStockRequest 抖音库存请求结构体
|
||||
type DouyinStockRequest struct {
|
||||
SkuID string `json:"sku_id" dc:"SKU ID"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
StockNum int64 `json:"stock_num" dc:"库存数量"`
|
||||
LockStockNum int64 `json:"lock_stock_num" dc:"锁定库存"`
|
||||
InTransitNum int64 `json:"in_transit_num" dc:"在途数量"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// JDAssetRequest 京东资产请求结构体
|
||||
type JDAssetRequest struct {
|
||||
Product struct {
|
||||
Name string `json:"name" dc:"商品名称"`
|
||||
CategoryID string `json:"category_id" dc:"分类ID"`
|
||||
BrandID string `json:"brand_id" dc:"品牌ID"`
|
||||
MainImage string `json:"main_image" dc:"主图"`
|
||||
Images interface{} `json:"images" dc:"图片列表"`
|
||||
Description string `json:"description" dc:"描述"`
|
||||
Specifications interface{} `json:"specifications" dc:"规格参数"`
|
||||
Logistics interface{} `json:"logistics" dc:"物流信息"`
|
||||
AfterSales interface{} `json:"after_sales" dc:"售后信息"`
|
||||
SupplyPrice float64 `json:"supply_price" dc:"供货价"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
} `json:"product" dc:"商品信息"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
}
|
||||
|
||||
// JDAssetResponse 京东资产响应结构体
|
||||
type JDAssetResponse struct {
|
||||
SkuID string `json:"sku_id" dc:"SKU ID"`
|
||||
WareID string `json:"ware_id" dc:"商品ID"`
|
||||
ProductName string `json:"product_name" dc:"商品名称"`
|
||||
CategoryID string `json:"category_id" dc:"分类ID"`
|
||||
SupplyPrice float64 `json:"supply_price" dc:"供货价"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
ExternalID string `json:"external_id" dc:"外部ID"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// JDSkuRequest 京东SKU请求结构体
|
||||
type JDSkuRequest struct {
|
||||
SkuName string `json:"sku_name" dc:"SKU名称"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
StockNum int64 `json:"stock_num" dc:"库存数量"`
|
||||
Specification string `json:"specification" dc:"规格"`
|
||||
Status string `json:"status" dc:"状态"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// JDStockRequest 京东库存请求结构体
|
||||
type JDStockRequest struct {
|
||||
SkuID string `json:"sku_id" dc:"SKU ID"`
|
||||
OuterSkuID string `json:"outer_sku_id" dc:"外部SKU ID"`
|
||||
Quantity int64 `json:"quantity" dc:"库存数量"`
|
||||
LockQuantity int64 `json:"lock_quantity" dc:"锁定库存"`
|
||||
InTransit int64 `json:"in_transit" dc:"在途数量"`
|
||||
Location string `json:"location" dc:"仓库位置"`
|
||||
SyncPlatform string `json:"sync_platform" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// PinduoduoAssetRequest 拼多多资产请求结构体
|
||||
type PinduoduoAssetRequest struct {
|
||||
GoodsID string `json:"goods_id" dc:"商品ID"`
|
||||
GoodsName string `json:"goods_name" dc:"商品名称"`
|
||||
GoodsDesc string `json:"goods_desc" dc:"商品描述"`
|
||||
CatID string `json:"cat_id" dc:"分类ID"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
GoodsImageURL string `json:"goods_image_url" dc:"商品主图"`
|
||||
GoodsGalleryURLs interface{} `json:"goods_gallery_urls" dc:"商品轮播图"`
|
||||
}
|
||||
|
||||
// PinduoduoAssetResponse 拼多多资产响应结构体
|
||||
type PinduoduoAssetResponse struct {
|
||||
GoodsID string `json:"goods_id" dc:"商品ID"`
|
||||
GoodsName string `json:"goods_name" dc:"商品名称"`
|
||||
GoodsDesc string `json:"goods_desc" dc:"商品描述"`
|
||||
CatID string `json:"cat_id" dc:"分类ID"`
|
||||
MarketPrice float64 `json:"market_price" dc:"市场价"`
|
||||
GoodsImageURL string `json:"goods_image_url" dc:"商品主图"`
|
||||
}
|
||||
|
||||
// SkuRequest 通用SKU请求结构体
|
||||
type SkuRequest struct {
|
||||
ID string `json:"id" dc:"SKU ID"`
|
||||
SkuCode string `json:"skuCode" dc:"SKU编码"`
|
||||
Price float64 `json:"price" dc:"价格"`
|
||||
Stock int64 `json:"stock" dc:"库存"`
|
||||
Specification interface{} `json:"specification" dc:"规格"`
|
||||
}
|
||||
|
||||
// StockRequest 通用库存请求结构体
|
||||
type StockRequest struct {
|
||||
ID string `json:"id" dc:"库存ID"`
|
||||
AssetSkuID string `json:"assetSkuId" dc:"资产SKU ID"`
|
||||
AvailableQty int64 `json:"availableQty" dc:"可用数量"`
|
||||
LockedQty int64 `json:"lockedQty" dc:"锁定数量"`
|
||||
InTransitQty int64 `json:"inTransitQty" dc:"在途数量"`
|
||||
Location string `json:"location" dc:"位置"`
|
||||
}
|
||||
|
||||
// SyncResult 同步结果结构体
|
||||
type SyncResult struct {
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
Message string `json:"message" dc:"消息"`
|
||||
Data interface{} `json:"data" dc:"数据"`
|
||||
Platform consts.SyncPlatform `json:"platform" dc:"平台"`
|
||||
ExternalID string `json:"external_id,omitempty" dc:"外部ID"`
|
||||
}
|
||||
142
model/dto/sync/sync_dto.go
Normal file
142
model/dto/sync/sync_dto.go
Normal file
@@ -0,0 +1,142 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
consts "assets/consts/public"
|
||||
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
// CreateSyncTaskReq 创建同步任务请求
|
||||
type CreateSyncTaskReq struct {
|
||||
g.Meta `path:"/createSyncTask" method:"post" tags:"同步任务" summary:"创建同步任务" dc:"创建新的同步任务"`
|
||||
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
SyncType consts.SyncType `json:"syncType" v:"required" dc:"同步类型:full全量/incremental增量"`
|
||||
AssetID *bson.ObjectID `json:"assetId,omitempty" dc:"资产ID"`
|
||||
AssetSKUID *bson.ObjectID `json:"assetSkuId,omitempty" dc:"资产SKU ID"`
|
||||
StockID *bson.ObjectID `json:"stockId,omitempty" dc:"库存ID"`
|
||||
}
|
||||
|
||||
// CreateSyncTaskRes 创建同步任务响应
|
||||
type CreateSyncTaskRes struct {
|
||||
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// ListSyncTaskReq 同步任务列表请求
|
||||
type ListSyncTaskReq struct {
|
||||
g.Meta `path:"/listSyncTasks" method:"get" tags:"同步任务" summary:"获取同步任务列表" dc:"分页查询同步任务列表,支持多条件筛选"`
|
||||
beans.Page
|
||||
Platform consts.SyncPlatform `json:"platform,omitempty" dc:"同步平台"`
|
||||
Status consts.SyncStatus `json:"status,omitempty" dc:"同步状态"`
|
||||
StartTime *gtime.Time `json:"startTime,omitempty" dc:"开始时间"`
|
||||
EndTime *gtime.Time `json:"endTime,omitempty" dc:"结束时间"`
|
||||
}
|
||||
|
||||
// ListSyncTaskRes 同步任务列表响应
|
||||
type ListSyncTaskRes struct {
|
||||
List []*SyncTaskItem `json:"list" dc:"同步任务列表"`
|
||||
Total int64 `json:"total" dc:"总数"`
|
||||
}
|
||||
|
||||
// SyncTaskItem 同步任务项
|
||||
type SyncTaskItem struct {
|
||||
ID *bson.ObjectID `json:"id" dc:"任务ID"`
|
||||
Platform consts.SyncPlatform `json:"platform" dc:"同步平台"`
|
||||
SyncType consts.SyncType `json:"syncType" dc:"同步类型"`
|
||||
Status consts.SyncStatus `json:"status" dc:"同步状态"`
|
||||
AssetID *bson.ObjectID `json:"assetId,omitempty" dc:"资产ID"`
|
||||
AssetSKUID *bson.ObjectID `json:"assetSkuId,omitempty" dc:"资产SKU ID"`
|
||||
StockID *bson.ObjectID `json:"stockId,omitempty" dc:"库存ID"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
|
||||
ErrorCount int `json:"errorCount" dc:"错误次数"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
StartedAt *gtime.Time `json:"startedAt,omitempty" dc:"开始时间"`
|
||||
FinishedAt *gtime.Time `json:"finishedAt,omitempty" dc:"完成时间"`
|
||||
}
|
||||
|
||||
// GetSyncTaskReq 获取同步任务详情请求
|
||||
type GetSyncTaskReq struct {
|
||||
g.Meta `path:"/getSyncTask" method:"get" tags:"同步任务" summary:"获取同步任务详情" dc:"获取同步任务详情"`
|
||||
ID *bson.ObjectID `json:"id" v:"required" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// GetSyncTaskRes 获取同步任务详情响应
|
||||
type GetSyncTaskRes struct {
|
||||
SyncTaskItem
|
||||
}
|
||||
|
||||
// UpdateSyncTaskStatusReq 更新同步任务状态请求
|
||||
type UpdateSyncTaskStatusReq struct {
|
||||
g.Meta `path:"/updateSyncTaskStatus" method:"put" tags:"同步任务" summary:"更新同步任务状态" dc:"更新同步任务状态"`
|
||||
ID *bson.ObjectID `json:"id" v:"required" dc:"任务ID"`
|
||||
Status consts.SyncStatus `json:"status" v:"required" dc:"同步状态"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty" dc:"错误信息"`
|
||||
}
|
||||
|
||||
// SyncAssetReq 同步资产请求
|
||||
type SyncAssetReq struct {
|
||||
g.Meta `path:"/syncAsset" method:"post" tags:"资产同步" summary:"同步资产" dc:"同步资产到指定平台"`
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
AssetID *bson.ObjectID `json:"assetId" v:"required" dc:"资产ID"`
|
||||
}
|
||||
|
||||
// SyncAssetRes 同步资产响应
|
||||
type SyncAssetRes struct {
|
||||
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// SyncAssetSkuReq 同步资产SKU请求
|
||||
type SyncAssetSkuReq struct {
|
||||
g.Meta `path:"/syncAssetSku" method:"post" tags:"SKU同步" summary:"同步资产SKU" dc:"同步资产SKU到指定平台"`
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
AssetSKUID *bson.ObjectID `json:"assetSkuId" v:"required" dc:"资产SKU ID"`
|
||||
}
|
||||
|
||||
// SyncAssetSkuRes 同步资产SKU响应
|
||||
type SyncAssetSkuRes struct {
|
||||
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// SyncStockReq 同步库存请求
|
||||
type SyncStockReq struct {
|
||||
g.Meta `path:"/syncStock" method:"post" tags:"库存同步" summary:"同步库存" dc:"同步库存到指定平台"`
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
StockID *bson.ObjectID `json:"stockId" v:"required" dc:"库存ID"`
|
||||
}
|
||||
|
||||
// SyncStockRes 同步库存响应
|
||||
type SyncStockRes struct {
|
||||
TaskID *bson.ObjectID `json:"taskId" dc:"任务ID"`
|
||||
}
|
||||
|
||||
// BatchSyncAssetsReq 批量同步资产请求
|
||||
type BatchSyncAssetsReq struct {
|
||||
g.Meta `path:"/batchSyncAssets" method:"post" tags:"批量同步" summary:"批量同步资产" dc:"批量同步资产到指定平台"`
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
AssetIDs []*bson.ObjectID `json:"assetIds" v:"required" dc:"资产ID列表"`
|
||||
}
|
||||
|
||||
// BatchSyncAssetsRes 批量同步资产响应
|
||||
type BatchSyncAssetsRes struct {
|
||||
TaskIDs []*bson.ObjectID `json:"taskIds" dc:"任务ID列表"`
|
||||
}
|
||||
|
||||
// GetPlatformSyncStatusReq 获取平台同步状态请求
|
||||
type GetPlatformSyncStatusReq struct {
|
||||
g.Meta `path:"/getPlatformSyncStatus" method:"get" tags:"平台状态" summary:"获取平台同步状态" dc:"获取指定平台的同步状态"`
|
||||
Platform consts.SyncPlatform `json:"platform" v:"required" dc:"同步平台"`
|
||||
}
|
||||
|
||||
// GetPlatformSyncStatusRes 获取平台同步状态响应
|
||||
type GetPlatformSyncStatusRes struct {
|
||||
Platform consts.SyncPlatform `json:"platform" dc:"同步平台"`
|
||||
IsEnabled bool `json:"isEnabled" dc:"是否启用"`
|
||||
LastSyncTime *gtime.Time `json:"lastSyncTime,omitempty" dc:"最后同步时间"`
|
||||
NextSyncTime *gtime.Time `json:"nextSyncTime,omitempty" dc:"下次同步时间"`
|
||||
SyncCount int64 `json:"syncCount" dc:"同步次数"`
|
||||
SuccessCount int64 `json:"successCount" dc:"成功次数"`
|
||||
FailedCount int64 `json:"failedCount" dc:"失败次数"`
|
||||
}
|
||||
Reference in New Issue
Block a user