mirror of
https://github.com/lxsang/antd-web-apps
synced 2025-07-27 02:59:47 +02:00
WIP: make code compatible with new SILK API
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good
All checks were successful
gitea-sync/antd-web-apps/pipeline/head This commit looks good
This commit is contained in:
@ -7,8 +7,13 @@ BaseController:subclass(
|
||||
)
|
||||
|
||||
local sectionsByCid = function(db, id)
|
||||
local cond = {exp = { ["and"] = {{["="] = {cid = id}}, {["= "] = {publish = 1}} }}, order = {start = "DESC"}}
|
||||
local data, a = db:find(cond)
|
||||
local data, a = db:find({
|
||||
where = {
|
||||
cid = id,
|
||||
publish = 1
|
||||
},
|
||||
order = {"start$desc"}
|
||||
})
|
||||
return data, a
|
||||
end
|
||||
|
||||
@ -16,8 +21,12 @@ function IndexController:index(...)
|
||||
local args = {...}
|
||||
-- now read all the data
|
||||
-- get all root sections as the toc
|
||||
local cond = {exp = {["="] = {pid = 0}}, order = {name = "ASC"}}
|
||||
local data, a = self.category:find(cond)
|
||||
local data, a = self.category:find({
|
||||
where = {
|
||||
pid = 0
|
||||
},
|
||||
order = {"name$asc"}
|
||||
})
|
||||
local toc = {}
|
||||
if not data then
|
||||
return self:error("Cannot query the ToC")
|
||||
@ -26,8 +35,12 @@ function IndexController:index(...)
|
||||
for key, cat in pairs(data) do
|
||||
cat.name = cat.name:gsub("^%d+%.", "")
|
||||
table.insert(toc, {cat.name, cat.id})
|
||||
cond = {exp = {["="] = {pid = cat.id}}, order = {name = "ASC"}}
|
||||
local children, b = self.category:find(cond)
|
||||
local children, b = self.category:find({
|
||||
where = {
|
||||
pid = cat.id
|
||||
},
|
||||
order = {"name$asc"}
|
||||
})
|
||||
if children and #children > 0 then
|
||||
for k, v in pairs(children) do
|
||||
v.sections = sectionsByCid(self.sections, v.id)
|
||||
|
@ -28,7 +28,7 @@ function UserController:photo(...)
|
||||
local prefix = data[1].photo:match("%a+://")
|
||||
local suffix = data[1].photo:gsub(prefix,"")
|
||||
local path = string.format("/home/%s/", self.registry.user)..suffix
|
||||
print(path)
|
||||
LOG_DEBUG("Photo path: %s", path)
|
||||
if ulib.exists(path) then
|
||||
local mime = std.mimeOf(path)
|
||||
std.sendFile(path)
|
||||
|
Reference in New Issue
Block a user