media/wwwroot/image/get_images.dspy
2025-06-24 11:45:33 +08:00

35 lines
706 B
Plaintext

ns = {
'page':params_kw.get('page', 1),
'sort':'name',
'rowpages':80
}
userid = await get_user()
if not userid:
return {
"widgettype":"Error",
"options":{
"title":"Authorization Error",
"timeout":3,
"cwidth":16,
"cheight":9,
"message":"Please login"
}
}
ns['ownerid'] = userid
sql = """select * from media where mtype = 'image' and (ownerid=${ownerid}$ or ownerid is NULL)"""
if params_kw.search:
b = params_kw.search.split(' ')
b.insert(0, '')
b.append('')
loc = '%'.join(b)
ns['loc'] = loc
sql += " and mlocation like ${loc}$"
db = DBPools()
async with db.sqlorContext('mediadb') as sor:
r = await sor.sqlPaging(sql, ns.copy())
return r
return {
'total':0,
'rows':[]
}