1
0
mirror of https://github.com/lxsang/antd-lua-plugin synced 2024-12-29 10:48:21 +01:00
antd-lua-plugin/example-app/os/system/logout.lua
2018-09-19 15:08:49 +02:00

17 lines
449 B
Lua

if SESSION.sessionid ~= nil and SESSION.sessionid ~= '0' then
local cookie = {sessionid='0'}
local db = sysdb()
if db ~= nil then
--local data = db:find("sessionid ='"..SESSION.sessionid.."'")
--if data and data[0] ~= nil then
-- db:delete(data[0].id)
--end
local cond = {["="] = { sessionid = SESSION.sessionid }}
db:delete(cond)
db:close()
end
std.cjson(cookie)
else
std.json()
end
std.t(JSON.encode({error=false,result=true}))