main
HuangHai 1 week ago
parent b6cfd9646b
commit 8161932048

@ -348,8 +348,8 @@ async def get_articles(page: int = 1, limit: int = 10):
offset = (page - 1) * limit offset = (page - 1) * limit
rows = await conn.fetch( rows = await conn.fetch(
""" """
SELECT a.id, a.title, a.source as source as name, SELECT a.id, a.title, a.source as name,
a.publish_time, a.collection_time a.publish_time, a.collection_time,a.url
FROM t_wechat_articles a FROM t_wechat_articles a
ORDER BY a.collection_time DESC ORDER BY a.collection_time DESC
LIMIT $1 OFFSET $2 LIMIT $1 OFFSET $2
@ -363,7 +363,8 @@ async def get_articles(page: int = 1, limit: int = 10):
"title": row[1], "title": row[1],
"source": row[2], "source": row[2],
"publish_date": row[3].strftime("%Y-%m-%d") if row[3] else None, "publish_date": row[3].strftime("%Y-%m-%d") if row[3] else None,
"collect_time": row[4].strftime("%Y-%m-%d %H:%M:%S") if row[4] else None "collect_time": row[4].strftime("%Y-%m-%d %H:%M:%S") if row[4] else None,
"url": row[5],
} }
for row in rows for row in rows
] ]

@ -16,15 +16,15 @@
<div class="layui-tab layui-tab-brief"> <div class="layui-tab layui-tab-brief">
<ul class="layui-tab-title"> <ul class="layui-tab-title">
<li class="layui-this">信息来源</li> <li class="layui-this">文章列表</li>
<li>文章列表</li> <li>信息来源</li>
</ul> </ul>
<div class="layui-tab-content"> <div class="layui-tab-content">
<div class="layui-tab-item layui-show"> <div class="layui-tab-item layui-show">
<table id="sourceTable" lay-filter="sourceTable"></table> <table id="articleTable" lay-filter="articleTable"></table>
</div> </div>
<div class="layui-tab-item"> <div class="layui-tab-item">
<table id="articleTable" lay-filter="articleTable"></table> <table id="sourceTable" lay-filter="sourceTable"></table>
</div> </div>
</div> </div>
</div> </div>
@ -50,7 +50,7 @@
}; };
}, },
cols: [[ cols: [[
{field: 'id', title: 'ID', width:80}, {field: 'id', title: '序号', width: 80},
{field: 'name', title: '账号名称'}, {field: 'name', title: '账号名称'},
{field: 'type', title: '来源类型'}, {field: 'type', title: '来源类型'},
{field: 'update_time', title: '更新时间'} {field: 'update_time', title: '更新时间'}
@ -71,11 +71,13 @@
}; };
}, },
cols: [[ cols: [[
{field: 'id', title: 'ID', width:80}, {field: 'id', title: '序号', width: 80},
{field: 'title', title: '标题'}, {field: 'title', title: '标题', templet: function(d){
{field: 'source', title: '来源'}, return '<a href="' + d.url + '" target="_blank" style="color: #1E88E5; text-decoration: underline; cursor: pointer;">' + d.title + '</a>';
{field: 'publish_date', title: '发布日期'}, }},
{field: 'collect_time', title: '采集时间'} {field: 'source', title: '来源', width: 150},
{field: 'publish_date', title: '发布日期', width: 120},
{field: 'collect_time', title: '采集时间', width: 150}
]] ]]
}); });
}); });

Loading…
Cancel
Save