mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-11-20 02:18:20 +01:00
fix request bug
This commit is contained in:
parent
0ad5eaa138
commit
6098e1b0ee
@ -17,10 +17,10 @@ function result(obj)
|
||||
end
|
||||
|
||||
function ServiceController:sendmail()
|
||||
if not REQUEST.query.json then
|
||||
if not REQUEST.json then
|
||||
fail("unknown request")
|
||||
end
|
||||
local rq = (JSON.decodeString(REQUEST.query.json))
|
||||
local rq = (JSON.decodeString(REQUEST.json))
|
||||
local to = "xsang.le@gmail.com"
|
||||
local from = "From: " .. rq.email .. "\n"
|
||||
local suject = "Subject: " .. rq.subject .. "\n"
|
||||
@ -40,10 +40,10 @@ function ServiceController:sendmail()
|
||||
end
|
||||
|
||||
function ServiceController:subscribe()
|
||||
if not REQUEST.query.json then
|
||||
if not REQUEST.json then
|
||||
fail("unknown request")
|
||||
end
|
||||
local rq = (JSON.decodeString(REQUEST.query.json))
|
||||
local rq = (JSON.decodeString(REQUEST.json))
|
||||
-- check if email is exist
|
||||
local data = self.subscribers:find({exp = {["="] = {email = rq.email}}})
|
||||
if data and #data > 0 then
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
if not REQUEST.query.json then
|
||||
if not REQUEST.json then
|
||||
fail("unknown request")
|
||||
end
|
||||
local rq = (JSON.decodeString(REQUEST.query.json))
|
||||
local rq = (JSON.decodeString(REQUEST.json))
|
||||
local to = "xsang.le@gmail.com"
|
||||
local from = "From: "..rq.email.."\n"
|
||||
local suject = "Subject: "..rq.subject.."\n"
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
if not REQUEST.query.json then
|
||||
if not REQUEST.json then
|
||||
fail("unknown request")
|
||||
end
|
||||
local rq = (JSON.decodeString(REQUEST.query.json))
|
||||
local rq = (JSON.decodeString(REQUEST.json))
|
||||
local sample = {name = "toto", email = "toto@mail.fr"}
|
||||
local db = require("db.model").get("mrsang","subscribers",sample)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user