21 lines
553 B
Lua
21 lines
553 B
Lua
|
local cjson = require "cjson"
|
||
|
local session = require"resty.session".open()
|
||
|
|
||
|
local response = {}
|
||
|
if (session == nil or session.data.identify == nil) then
|
||
|
response.code = 1
|
||
|
response.message = "未登录,session is nil."
|
||
|
ngx.say(cjson.encode(response));
|
||
|
return
|
||
|
else
|
||
|
if (session.data.identify ~= "myself") then
|
||
|
response.code = 1
|
||
|
response.message = "未登录,identify:" .. session.data.identify
|
||
|
else
|
||
|
response.code = 0
|
||
|
response.user = user_infomation
|
||
|
end
|
||
|
ngx.say(cjson.encode(response));
|
||
|
end
|
||
|
|