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:
@ -9,5 +9,8 @@ BaseModel:subclass("AnalyticalModel",{
|
||||
})
|
||||
|
||||
function AnalyticalModel:similarof(id)
|
||||
return self:find({ exp = {["="] = {pid = id}}, order = {score = "DESC"}})
|
||||
return self:find({
|
||||
where = {pid = id},
|
||||
order = { "score$desc"}
|
||||
})
|
||||
end
|
@ -15,28 +15,27 @@ BaseModel:subclass("BlogModel",{
|
||||
})
|
||||
|
||||
function BlogModel:fetch(cnd, limit, order)
|
||||
local exp = {}
|
||||
exp[1] = {["="] = { publish = 1 }}
|
||||
if cnd then
|
||||
exp[2] = cnd
|
||||
else
|
||||
|
||||
end
|
||||
|
||||
local cond = {
|
||||
exp = {["and"] = exp },
|
||||
order = { ctime = "DESC" },
|
||||
local filter = {
|
||||
order = { "ctime$desc" },
|
||||
fields = {
|
||||
"id", "title", "utime", "ctime", "utimestr", "content", "ctimestr", "rendered", "tags"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if limit then
|
||||
cond.limit = limit
|
||||
filter.limit = limit
|
||||
end
|
||||
if order then
|
||||
cond.order = order
|
||||
filter.order = order
|
||||
end
|
||||
return self:find(cond)
|
||||
|
||||
filter.where = {}
|
||||
if cnd then
|
||||
filter.where = cnd
|
||||
end
|
||||
filter.where.publish = 1
|
||||
|
||||
return self:find(filter)
|
||||
end
|
||||
|
||||
function BlogModel:minid()
|
||||
|
Reference in New Issue
Block a user