Commit 30ba49a4 authored by wty's avatar wty

后端代码错误处理更新1

parent 725350d2
...@@ -23,7 +23,7 @@ router.get('/getUser', function (req, res, next) { ...@@ -23,7 +23,7 @@ router.get('/getUser', function (req, res, next) {
// } // }
const SQL = 'SELECT * FROM `user` WHERE `user`.uid = ?' const SQL = 'SELECT * FROM `user` WHERE `user`.uid = ?'
Mysql.query(SQL, [uid], (err, result) => { Mysql.query(SQL, [uid], (err, result) => {
if (err) { if (err || !result) {
res.send({ res.send({
success: false, success: false,
err err
...@@ -32,11 +32,7 @@ router.get('/getUser', function (req, res, next) { ...@@ -32,11 +32,7 @@ router.get('/getUser', function (req, res, next) {
} }
console.log(result) console.log(result)
const _result = result.slice() const _result = result.slice()
_result[0]?.follow = JSON.parse(_result[0].follow) _result[0]?.follow = JSON.parse(_result[0].follow)
res.send({ res.send({
success: true, success: true,
data: { data: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment