bind_uid.lua 297 B

1234567891011
  1. local uidKey = KEYS[1]
  2. local bindUidKey = KEYS[2]
  3. local openID = ARGV[1]
  4. local uid = redis.call('HGET', bindUidKey, openID)
  5. if uid then
  6. return tonumber(uid)
  7. else
  8. local new_uid = redis.call('INCR', uidKey)
  9. redis.call('HSET', bindUidKey, openID, new_uid)
  10. return tonumber(new_uid)
  11. end