创建一个接口,不需要签名认证,通过传入的商品id与user_id 去分库查询并返回商品的所有信息
This commit is contained in:
parent
687159f4b3
commit
1d622ed889
@ -229,6 +229,7 @@ type ProductFullInfoResponse struct {
|
||||
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"` // 店铺信息列表
|
||||
}
|
||||
|
||||
@ -495,6 +495,13 @@ func (s *ProductService) GetProductFullInfo(req systemReq.GetProductFullInfoRequ
|
||||
|
||||
fmt.Printf("【断点8】库存信息查询完成 - 数量: %d\n", len(inventories))
|
||||
|
||||
totalStock := int64(0)
|
||||
for _, inv := range inventories {
|
||||
totalStock += inv.Quantity
|
||||
}
|
||||
|
||||
fmt.Printf("【断点9】计算总库存: %d\n", totalStock)
|
||||
|
||||
outTaskInfoMap, err := s.getProductOutTaskInfo(databaseConn, []int64{req.ProductID})
|
||||
if err != nil {
|
||||
utils.ErrorLog(constant.LoggerChannelWork, map[string]interface{}{
|
||||
@ -508,7 +515,7 @@ func (s *ProductService) GetProductFullInfo(req systemReq.GetProductFullInfoRequ
|
||||
shopList = outTaskInfo.ShopList
|
||||
}
|
||||
|
||||
fmt.Printf("【断点9】店铺信息查询完成 - 数量: %d\n", len(shopList))
|
||||
fmt.Printf("【断点10】店铺信息查询完成 - 数量: %d\n", len(shopList))
|
||||
|
||||
response := &systemRes.ProductFullInfoResponse{
|
||||
ID: product.ID,
|
||||
@ -526,11 +533,12 @@ func (s *ProductService) GetProductFullInfo(req systemReq.GetProductFullInfoRequ
|
||||
Status: product.Status,
|
||||
CreatedAt: product.CreatedAt,
|
||||
UpdatedAt: product.UpdatedAt,
|
||||
TotalStock: totalStock,
|
||||
Inventories: inventories,
|
||||
ShopList: shopList,
|
||||
}
|
||||
|
||||
fmt.Printf("【断点10】商品完整信息查询成功,准备返回\n")
|
||||
fmt.Printf("【断点11】商品完整信息查询成功,准备返回\n")
|
||||
|
||||
utils.InfoLog(constant.LoggerChannelWork, map[string]interface{}{
|
||||
"action": "商品完整信息查询成功",
|
||||
@ -538,6 +546,7 @@ func (s *ProductService) GetProductFullInfo(req systemReq.GetProductFullInfoRequ
|
||||
"user_id": req.UserID,
|
||||
"product_name": product.Name,
|
||||
"barcode": product.Barcode,
|
||||
"total_stock": totalStock,
|
||||
"inventory_count": len(inventories),
|
||||
"shop_count": len(shopList),
|
||||
"success": true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user