202 lines
8.6 KiB
Go
202 lines
8.6 KiB
Go
package response
|
|
|
|
import (
|
|
"encoding/json"
|
|
"psi/models"
|
|
)
|
|
|
|
type ProductListResponse struct {
|
|
List []ProductItem `json:"list"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
}
|
|
|
|
type ProductItem struct {
|
|
ID int64 `json:"id"`
|
|
CategoryID int64 `json:"category_id"`
|
|
CategoryName string `json:"category_name"`
|
|
StandardProductID int64 `json:"standard_product_id"`
|
|
Name string `json:"name"`
|
|
Appearance int64 `json:"appearance"`
|
|
Barcode string `json:"barcode"`
|
|
Price int64 `json:"price"`
|
|
SalePrice int64 `json:"sale_price"`
|
|
LiveImage []string `json:"live_image"`
|
|
IsBatchManaged int8 `json:"is_batch_managed"`
|
|
IsShelfLifeManaged int8 `json:"is_shelf_life_managed"`
|
|
Status int8 `json:"status"`
|
|
WarehouseID int64 `json:"warehouse_id"`
|
|
WarehouseCode string `json:"warehouse_code"`
|
|
WarehouseName string `json:"warehouse_name"`
|
|
LocationID int64 `json:"location_id"`
|
|
LocationCode string `json:"location_code"`
|
|
Quantity int64 `json:"quantity"`
|
|
InboundTime string `json:"inbound_time"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
ShopList []ShopInfo `json:"shop_list"`
|
|
FirPrice float64 `json:"fir_price"`
|
|
}
|
|
|
|
type ShopInfo struct {
|
|
ShopID string `json:"shop_id"`
|
|
ShopAliasName string `json:"shop_alias_name"`
|
|
ShopType int8 `json:"shop_type"`
|
|
ShopTypeName string `json:"shop_type_name"`
|
|
IsSent bool `json:"is_sent"`
|
|
OutTaskLogID int64 `json:"out_task_log_id"`
|
|
OutTaskID int64 `json:"out_task_id"`
|
|
LogStatus int8 `json:"status"`
|
|
LogMsg string `json:"msg"`
|
|
LogCreatedAt int64 `json:"created_at"`
|
|
}
|
|
|
|
type ProductWithInfo struct {
|
|
models.Product
|
|
CategoryName string `gorm:"column:category_name"`
|
|
WarehouseID int64 `gorm:"column:warehouse_id"`
|
|
WarehouseCode string `gorm:"column:warehouse_code"`
|
|
WarehouseName string `gorm:"column:warehouse_name"`
|
|
LocationID int64 `gorm:"column:location_id"`
|
|
LocationCode string `gorm:"column:location_code"`
|
|
Quantity int64 `gorm:"column:quantity"`
|
|
FirPrice float64 `json:"fir_price"`
|
|
InboundTime string `json:"inbound_time"`
|
|
}
|
|
|
|
// ExportProductResponse 导出商品响应
|
|
type ExportProductResponse struct {
|
|
Total int64 `json:"total"`
|
|
FileName string `json:"file_name,omitempty"`
|
|
FilePath string `json:"file_path,omitempty"`
|
|
}
|
|
|
|
func ConvertProductWithInfoToItem(product ProductWithInfo) ProductItem {
|
|
var liveImage []string
|
|
if len(product.LiveImage) > 0 {
|
|
json.Unmarshal(product.LiveImage, &liveImage)
|
|
}
|
|
|
|
return ProductItem{
|
|
ID: product.ID,
|
|
CategoryID: product.CategoryID,
|
|
CategoryName: product.CategoryName,
|
|
StandardProductID: product.StandardProductID,
|
|
Name: product.Name,
|
|
Appearance: product.Appearance,
|
|
Barcode: product.Barcode,
|
|
Price: product.Price,
|
|
SalePrice: product.SalePrice,
|
|
LiveImage: liveImage,
|
|
IsBatchManaged: product.IsBatchManaged,
|
|
IsShelfLifeManaged: product.IsShelfLifeManaged,
|
|
Status: product.Status,
|
|
WarehouseID: product.WarehouseID,
|
|
WarehouseCode: product.WarehouseCode,
|
|
WarehouseName: product.WarehouseName,
|
|
LocationID: product.LocationID,
|
|
LocationCode: product.LocationCode,
|
|
Quantity: product.Quantity,
|
|
CreatedAt: product.CreatedAt,
|
|
UpdatedAt: product.UpdatedAt,
|
|
InboundTime: product.InboundTime,
|
|
ShopList: []ShopInfo{},
|
|
FirPrice: product.FirPrice,
|
|
}
|
|
}
|
|
|
|
type ProductLogItem struct {
|
|
ID int64 `json:"id"`
|
|
Barcode string `json:"barcode"`
|
|
Md5Data string `json:"md5_data"`
|
|
OldName string `json:"old_name"`
|
|
NewName string `json:"new_name"`
|
|
OldPublisher string `json:"old_publisher"`
|
|
NewPublisher string `json:"new_publisher"`
|
|
OldAuthor string `json:"old_author"`
|
|
NewAuthor string `json:"new_author"`
|
|
OldPublicationTime int64 `json:"old_publication_time"`
|
|
NewPublicationTime int64 `json:"new_publication_time"`
|
|
OldPrice int64 `json:"old_price"`
|
|
NewPrice int64 `json:"new_price"`
|
|
OldBindingLayout string `json:"old_binding_layout"`
|
|
NewBindingLayout string `json:"new_binding_layout"`
|
|
OldPageCount int64 `json:"old_page_count"`
|
|
NewPageCount int64 `json:"new_page_count"`
|
|
OldWordCount int64 `json:"old_word_count"`
|
|
NewWordCount int64 `json:"new_word_count"`
|
|
OldLiveImage []string `json:"old_live_image"`
|
|
NewLiveImage []string `json:"new_live_image"`
|
|
OldIsSuit int8 `json:"old_is_suit"`
|
|
NewIsSuit int8 `json:"new_is_suit"`
|
|
Status int8 `json:"status"`
|
|
CreateBy int64 `json:"create_by"`
|
|
AuditBy int64 `json:"audit_by"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
type ProductLogListResponse struct {
|
|
List []ProductLogItem `json:"list"`
|
|
Total int64 `json:"total"`
|
|
Page int `json:"page"`
|
|
PageSize int `json:"pageSize"`
|
|
}
|
|
|
|
// ProductInventoryResponse 商品库存响应
|
|
type ProductInventoryResponse struct {
|
|
Quantity int64 `json:"quantity"`
|
|
}
|
|
|
|
// ShopProductDetailResponse 店铺商品详情响应
|
|
type ShopProductDetailResponse struct {
|
|
ID int64 `json:"id"` // 店铺ID
|
|
ShopName string `json:"shop_name"` // 店铺名称
|
|
ShopAliasName string `json:"shop_alias_name"` // 店铺别名
|
|
ShopType int8 `json:"shop_type"` // 店铺类型
|
|
ShopTypeName string `json:"shop_type_name"` // 店铺类型名称
|
|
CreatedAt int64 `json:"created_at"` // 创建时间
|
|
UpdatedAt int64 `json:"updated_at"` // 更新时间
|
|
Products []ProductInShop `json:"products"` // 商品列表
|
|
Total int64 `json:"total"` // 总数
|
|
Page int `json:"page"` // 当前页
|
|
PageSize int `json:"page_size"` // 每页条数
|
|
SuccessCount int64 `json:"success_count"` // 成功数量
|
|
NotSentCount int64 `json:"not_sent_count"` // 任务已创建未发送到店铺数量
|
|
FailedCount int64 `json:"failed_count"` // 发送到店铺失败数量
|
|
}
|
|
|
|
// PushProductToShopResponse 上架到商铺响应
|
|
type PushProductToShopResponse struct {
|
|
UserID int64 `json:"user_id,string"` // 用户ID
|
|
WarehouseID int64 `json:"warehouse_id"` // 仓库ID
|
|
ProductID int64 `json:"product_id"` // 商品ID
|
|
ISBN string `json:"isbn"` // ISBN
|
|
}
|
|
|
|
// ProductInShop 店铺中的商品信息
|
|
type ProductInShop struct {
|
|
ID int64 `json:"id"` // 商品ID
|
|
Name string `json:"name"` // 商品名称
|
|
Barcode string `json:"barcode"` // 条码
|
|
LiveImage []string `json:"live_image"` // 实拍图
|
|
Price int64 `json:"price"` // 价格
|
|
SalePrice int64 `json:"sale_price"` // 售价
|
|
Quantity int64 `json:"quantity"` // 库存数量
|
|
WarehouseName string `json:"warehouse_name"` // 仓库名称
|
|
LocationCode string `json:"location_code"` // 库位编码
|
|
IsBatchManaged int8 `json:"is_batch_managed"` // 是否批次管理
|
|
IsShelfLifeManaged int8 `json:"is_shelf_life_managed"` // 是否效期管理
|
|
OutTaskLogID int64 `json:"out_task_log_id"` // 出库任务日志ID
|
|
StatusInShop int8 `json:"status_in_shop"` // 在店铺中的状态 0未发布 1已发布
|
|
Msg string `json:"msg"` // 消息
|
|
WaveNo string `json:"wave_no"` // 波次编号
|
|
WaveTaskNo string `json:"wave_task_no"` // 波次任务编号
|
|
OutTaskNo int64 `json:"out_task_no"` // 出库任务编号
|
|
SalesOrderNo string `json:"sales_order_no"` // 销售单编号
|
|
ShippingNo string `json:"shipping_no"` // 发货单编号
|
|
CreatedAt int64 `json:"created_at"` // 创建时间
|
|
UpdatedAt int64 `json:"updated_at"` // 更新时间
|
|
}
|