---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Administrator.
--- DateTime: 2018-03-13 10:42
--- 订单、施工单版本号判断
---
local key = KEYS[1]
local idOrder = ARGV[1]
local inputVersion = tonumber(ARGV[2])

local nowVersion = tonumber(redis.call('HGET', key, idOrder))
if (nowVersion == nil) then
    nowVersion = 0
end

local afterNum = -1;
if (inputVersion == nowVersion) then
    afterNum = tonumber(redis.call("HINCRBY", key, idOrder, 1))
end
return  tostring(afterNum);




