★★★
★★★★
★★★
★★★★
★★★
★★★
★★★★
★★★
★★★
★★
★★
★★
★★
★★
★★★
★★★
★★★
★★★★
★★★
★★★★
★★★
★★★★
★★★
★★★
★★★
★★★★
★★★★
★★★
★★★
★★★
★★★★
★★★★
★★★
★★★
★★★
★★★
★★★
★★★★
★★★★
★★★★
★★★
★★★
★★★★
★★★★
★★★★
★★★★
★★★
★★★
★★
★★★
★★★★
★★★★
★★★★
★★★
★★★★
★★★
★★★
★★★★
★★★★
★★★★
★★★
★★★
★★★★
local stock = tonumber(redis.call('GET', KEYS[1]))
if stock and stock > 0 then
redis.call('DECR', KEYS[1])
return 1 -- 扣减成功
end
return 0 -- 库存不足
★★★
★★★★
★★★★
★★★★
★★★
★★★
★★★