93 lines
1.9 KiB
Plaintext
93 lines
1.9 KiB
Plaintext
|
|
ns = params_kw.copy()
|
|
|
|
print(f'get_iptvchannels.dspy:{ns=}')
|
|
if not ns.get('page'):
|
|
ns['page'] = 1
|
|
if not ns.get('sort'):
|
|
|
|
|
|
ns['sort'] = 'tv_name'
|
|
|
|
|
|
filterjson = params_kw.get('data_filter')
|
|
if not filterjson:
|
|
fields = [ f['name'] for f in [
|
|
{
|
|
"name": "id",
|
|
"title": "\u7f16\u53f7",
|
|
"type": "str",
|
|
"length": 32
|
|
},
|
|
{
|
|
"name": "tv_group",
|
|
"title": "\u9891\u9053\u7ec4",
|
|
"type": "str",
|
|
"length": 500
|
|
},
|
|
{
|
|
"name": "tv_name",
|
|
"title": "\u9891\u9053\u540d\u79f0",
|
|
"type": "str",
|
|
"length": 500
|
|
},
|
|
{
|
|
"name": "logo_url",
|
|
"title": "\u53f0\u6807url",
|
|
"type": "str",
|
|
"length": 1000
|
|
},
|
|
{
|
|
"name": "url",
|
|
"title": "url",
|
|
"type": "str",
|
|
"length": 1000
|
|
},
|
|
{
|
|
"name": "media_type",
|
|
"title": "\u5a92\u4f53\u7c7b\u578b",
|
|
"type": "str",
|
|
"length": 100
|
|
},
|
|
{
|
|
"name": "download_date",
|
|
"title": "\u4e0b\u8f7d\u65e5\u671f",
|
|
"type": "str",
|
|
"length": 10
|
|
},
|
|
{
|
|
"name": "channel_delay",
|
|
"title": "\u9891\u9053\u5ef6\u8fdf",
|
|
"type": "short"
|
|
},
|
|
{
|
|
"name": "channel_grade",
|
|
"title": "\u9891\u9053\u7b49\u7ea7",
|
|
"type": "short"
|
|
},
|
|
{
|
|
"name": "del_flg",
|
|
"title": "\u5220\u9664\u6807\u5fd7",
|
|
"type": "str",
|
|
"length": 1
|
|
}
|
|
] ]
|
|
filterjson = default_filterjson(fields, ns)
|
|
sql = '''select * from iptvchannels where 1=1 {}'''
|
|
if filterjson:
|
|
dbf = DBFilter(filterjson)
|
|
conds = dbf.gen(ns)
|
|
if conds:
|
|
ns.update(dbf.consts)
|
|
sql = sql.format(' and ' + conds)
|
|
else:
|
|
sql = sql.format('')
|
|
print(f'{sql=}')
|
|
db = DBPools()
|
|
async with db.sqlorContext('iptvdb') as sor:
|
|
r = await sor.sqlPaging(sql, ns)
|
|
return r
|
|
return {
|
|
"total":0,
|
|
"rows":[]
|
|
} |