Commit fb35df18 by hcy

扣锁库

parent b01fac9e
Showing with 6 additions and 2 deletions
......@@ -266,8 +266,12 @@ func (ls *LyService) GetStock(sku model.LySku) (stock int64) {
//获取锁库库存
redisCon := gredis.Conn("search_r")
stockStr, _ := redis.String(redisCon.Do("HGET", "sku_lock_stock", sku.GoodsId))
stock, _ = strconv.ParseInt(stockStr, 10, 64)
return sku.Stock - stock
lockStock, _ := strconv.ParseInt(stockStr, 10, 64)
if sku.Stock < lockStock {
return 0
} else {
return sku.Stock - lockStock
}
}
return sku.Stock
}
......
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