daShangDao_psiServer/models/response/product.go
Administrator a2ea0c3a40 1.在这个接口里 /api/product/updateNameAndImages,添加多张图片时,并未覆盖原来的多张图片。(Y)
2.从系统导出的excel数据,在外部对excel某一列进行更改时,新增的要回传到原来的地方;并对改动的地方进行覆盖。
3.销售单管理、出库管理、发货单三个接口里面展示第三方订单编号和快递单号
4.选择多个仓库时,只要选择发货单子就会报错
5.在这个/api/split-account-deduction-log/create接口里,当传参时,如果参数 total_amount 是0,则会报错 {"code":204,"data":{},"msg":"TotalAmount不能为空"} 0是金额数字,不能当空值进行判断(T)
传递参数created_by,没有往数据表里写入
6.商品销毁的同时写入日志,也能通过读取这个日志,还原销毁的商品。传出这个新增的接口
7.新增一个不需要签名认证的分帐扣钱日志列表接口,新增一个返回字段buniness_no,并对这个字段进行模糊查询。
测试接口:/open/split-account-deduction-log/list
8.增加个新接口:首先 调用 /api/sales-order/create 创建销售订单的时候会锁定库存,
现在我需要一个解锁库存的接口,传递参数是订单编号
POST /api/sales-order/unlock-inventory // 解锁销售订单库存
/api/split-account-deduction-log/update /api/sales-order/unlock-inventory 在这两个接口里不需要签名认证
/api/sales-order/unlock-inventory 在这个接口里面返回解锁的所有商品信息
/api/split-account-deduction-log/update  在这个接口里面的status也需要更改,status没有变化
2026-06-24 09:41:12 +08:00

254 lines
12 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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"` // 每页数量
LocatedCount int64 `json:"located_count"` // 已落位商品数
UnlocatedCount int64 `json:"unlocated_count"` // 未落位商品数
EnabledCount int64 `json:"enabled_count"` // 启用中商品数
DisabledCount int64 `json:"disabled_count"` // 已禁用商品数
}
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"` // 总库存数量type=0时使用
Warehouses []ProductInventoryWarehouse `json:"warehouses,omitempty"` // 仓库列表type=1时使用
}
// 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"` // 更新时间
}
// ProductInventoryWarehouse 商品库存仓库信息
type ProductInventoryWarehouse struct {
WarehouseID int64 `json:"warehouse_id"` // 仓库ID
WarehouseName string `json:"warehouse_name"` // 仓库名称
WarehouseCode string `json:"warehouse_code"` // 仓库编码
ProductName string `json:"product_name"` // 商品名称
ISBN string `json:"isbn"` // ISBN/条码
Appearance int64 `json:"appearance"` // 品相
TotalQuantity int64 `json:"total_quantity"` // 该仓库下该商品的总库存
}
// ProductFullInfoResponse 商品完整信息响应
type ProductFullInfoResponse struct {
ID int64 `json:"id"` // 商品ID
CategoryID int64 `json:"category_id"` // 分类ID
CategoryName string `json:"category_name"` // 分类名称
StandardProductID int64 `json:"standard_product_id"` // 标准商品ID
Name string `json:"name"` // 商品名称
Appearance int64 `json:"appearance"` // 外观/品相
Barcode string `json:"barcode"` // 条码
Price int64 `json:"price"` // 价格(分)
SalePrice int64 `json:"sale_price"` // 售价(分)
Cost int64 `json:"cost"` // 运费(分)
Stock int64 `json:"stock"` // 库存数量
LiveImage []string `json:"live_image"` // 实拍图
IsBatchManaged int8 `json:"is_batch_managed"` // 是否批次管理
IsShelfLifeManaged int8 `json:"is_shelf_life_managed"` // 是否保质期管理
Status int8 `json:"status"` // 状态
CreatedAt int64 `json:"created_at"` // 创建时间
UpdatedAt int64 `json:"updated_at"` // 更新时间
TotalStock int64 `json:"total_stock"` // 总库存数量
Inventories []ProductInventoryDetail `json:"inventories"` // 库存详情列表
ShopList []ShopInfo `json:"shop_list"` // 店铺信息列表
}
// ProductInventoryDetail 库存详情
type ProductInventoryDetail struct {
WarehouseID int64 `json:"warehouse_id"` // 仓库ID
WarehouseName string `json:"warehouse_name"` // 仓库名称
WarehouseCode string `json:"warehouse_code"` // 仓库编码
LocationID int64 `json:"location_id"` // 库位ID
LocationCode string `json:"location_code"` // 库位编码
LocationName string `json:"location_name"` // 库位名称
Quantity int64 `json:"quantity"` // 库存数量
InboundTime string `json:"inbound_time"` // 入库时间
}