diff --git a/cms/server/src/index.js b/cms/server/src/index.js index 4149bf5..f09f315 100644 --- a/cms/server/src/index.js +++ b/cms/server/src/index.js @@ -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.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.post('/api/cms/articles', (req,res)=>{ 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 services 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`), 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]) => {