--- redis一次性HINCRBY多个字段

local key = KEYS[1]
local jsonData = ARGV[1]

local fields = cjson.decode(jsonData)

local result = {}

result['error'] = 0
result['errorMsg'] = ''

local currIndex = 1
local nums = {}
for k, v in pairs(fields) do
    local numKey = v['numKey']
    local numField = v['numField']
    local incrNum = v['incrNum']

    local afterNum = redis.call("HINCRBY", numKey, numField, incrNum)

    nums[currIndex] = {}
    nums[currIndex]['numField'] = numField
    nums[currIndex]['afterNum'] = afterNum

    currIndex = currIndex + 1
end

result['numList'] = nums

local re = cjson.encode(result);

return re