官网文章列表在推荐权重相同时按发布时间从新到旧排序(内容系统发布的文章权重都是 0,之前顺序混乱)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -295,7 +295,7 @@ app.put('/api/cms/cases/:id', (req,res)=>{
|
|||||||
app.delete('/api/cms/cases/:id', (req,res)=> db.run(`DELETE FROM cases WHERE id=?`,[req.params.id], e=> res.json({code:0,msg:'删除成功'})));
|
app.delete('/api/cms/cases/:id', (req,res)=> db.run(`DELETE FROM cases WHERE id=?`,[req.params.id], e=> res.json({code:0,msg:'删除成功'})));
|
||||||
|
|
||||||
// 文章
|
// 文章
|
||||||
app.get('/api/cms/articles', (req,res)=> db.all(`SELECT * FROM articles ORDER BY recommend_weight DESC, created_at DESC`, (e,r)=> res.json({code:0,data:r})));
|
app.get('/api/cms/articles', (req,res)=> db.all(`SELECT * FROM articles ORDER BY recommend_weight DESC, publish_time DESC, created_at DESC`, (e,r)=> res.json({code:0,data:r})));
|
||||||
app.get('/api/cms/articles/:id', (req,res)=> db.get(`SELECT * FROM articles WHERE id=?`,[req.params.id], (e,r)=> res.json({code:0,data:r})));
|
app.get('/api/cms/articles/:id', (req,res)=> db.get(`SELECT * FROM articles WHERE id=?`,[req.params.id], (e,r)=> res.json({code:0,data:r})));
|
||||||
app.post('/api/cms/articles', (req,res)=>{
|
app.post('/api/cms/articles', (req,res)=>{
|
||||||
const b=req.body; if(!b.title) return res.status(400).json({code:400,msg:'标题必填'});
|
const b=req.body; if(!b.title) return res.status(400).json({code:400,msg:'标题必填'});
|
||||||
@@ -333,7 +333,7 @@ app.get('/api/cms/public', (req,res)=>{
|
|||||||
queryAll(`SELECT * FROM ten_systems WHERE status='published' ORDER BY sort_order DESC`),
|
queryAll(`SELECT * FROM ten_systems WHERE status='published' ORDER BY sort_order DESC`),
|
||||||
queryAll(`SELECT * FROM services WHERE status='published' ORDER BY sort_weight DESC`),
|
queryAll(`SELECT * FROM services WHERE status='published' ORDER BY sort_weight DESC`),
|
||||||
queryAll(`SELECT * FROM cases WHERE status='published' ORDER BY sort_weight DESC`),
|
queryAll(`SELECT * FROM cases WHERE status='published' ORDER BY sort_weight DESC`),
|
||||||
queryAll(`SELECT * FROM articles WHERE status='published' ORDER BY recommend_weight DESC`),
|
queryAll(`SELECT * FROM articles WHERE status='published' ORDER BY recommend_weight DESC, publish_time DESC, created_at DESC`),
|
||||||
queryOne(`SELECT * FROM self_check WHERE id=1`),
|
queryOne(`SELECT * FROM self_check WHERE id=1`),
|
||||||
queryAll(`SELECT id, label, value FROM site_texts ORDER BY id`),
|
queryAll(`SELECT id, label, value FROM site_texts ORDER BY id`),
|
||||||
]).then(([config, home_sections, ameba, experts, evolution_thought, four_values, amb_states, evolution_process, ten_systems, services, cases, articles, self_check, texts]) => {
|
]).then(([config, home_sections, ameba, experts, evolution_thought, four_values, amb_states, evolution_process, ten_systems, services, cases, articles, self_check, texts]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user