exports.getSelectBlogs = (req, res) => { const info = req.body;

const sqlStr = `select * from blogs_info where title LIKE ? or author LIKE ? or classify LIKE ?`;
const searchStr = `%${info.keyword}%`;
db.query(sqlStr, [searchStr, searchStr, searchStr], (err, results) => {
    if (err) return res.cc(err);
    if (results.length === 0) return res.send({
        status: 0,
        message: '查询成功',
        data: []
    });
    res.send({
        status: 0,
        message: '查询成功',
        data: results
    });
});

};


原文地址: https://www.cveoy.top/t/topic/pKUF 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录