forked from Tank/braga
25 lines
634 B
Lua
25 lines
634 B
Lua
local template = require "resty.template"
|
|
local handle = require('framework.handle')
|
|
|
|
local function resp(start,ends)
|
|
local view = template.new("index.html", "layout.html")
|
|
view.title = "Бродильные емкости"
|
|
view:render()
|
|
end
|
|
|
|
local request = {
|
|
POST = function()
|
|
ngx.req.read_body()
|
|
local args, err = ngx.req.get_post_args()
|
|
resp(string.match(args['datetimes'], "([%d-%s:]+)%s>%s([%d-%s:]+)"))
|
|
end,
|
|
GET = function()
|
|
local ends = os.date('%Y-%m-%d %H:%M:%S',os.time()+14400)
|
|
local start = os.date('%Y-%m-%d %H:%M:%S',os.time()-86400)
|
|
resp(start,ends)
|
|
end
|
|
}
|
|
|
|
ngx.say(handle(request))
|
|
|