Commit 3173a672 by 杨树贤

Merge branch 'ysx-可售库存-20251118' into dev

parents 75c4d7f6 04b6558a
...@@ -176,8 +176,8 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go ...@@ -176,8 +176,8 @@ func (ls *LyService) LyGoodsDetail(ctx context.Context, params RequestParams, go
sku.OnwayStock = ls.getOnwayStock(sku.GoodsId) sku.OnwayStock = ls.getOnwayStock(sku.GoodsId)
//获取新的限制库存信息 //获取新的限制库存信息
limitStock := ls.getLimitStock(sku.GoodsId) has, limitStock := ls.getLimitStock(sku.GoodsId)
if limitStock > 0 { if has {
sku.Stock = int64(limitStock) sku.Stock = int64(limitStock)
} }
......
...@@ -70,7 +70,7 @@ func (ss *LyService) getOnwayStock(goodsId string) int { ...@@ -70,7 +70,7 @@ func (ss *LyService) getOnwayStock(goodsId string) int {
} }
// 获取新的在途库存 // 获取新的在途库存
func (ss *LyService) getLimitStock(goodsId string) int { func (ss *LyService) getLimitStock(goodsId string) (has bool, stock int) {
redisConn := gredis.Conn("search_r") redisConn := gredis.Conn("search_r")
defer func() { defer func() {
redisConn.Close() redisConn.Close()
...@@ -78,8 +78,8 @@ func (ss *LyService) getLimitStock(goodsId string) int { ...@@ -78,8 +78,8 @@ func (ss *LyService) getLimitStock(goodsId string) int {
limitStockStr, _ := redis.String(redisConn.Do("HGET", "limit_stock", goodsId)) limitStockStr, _ := redis.String(redisConn.Do("HGET", "limit_stock", goodsId))
if limitStockStr == "" { if limitStockStr == "" {
return 0 return false, 0
} }
return gconv.Int(limitStockStr) return true, gconv.Int(limitStockStr)
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment