数据库访问

发布于 6 年前作者 yongfeng4059 次浏览最后编辑 6 年前来自 ask
  • 当前 Bug 的表现(可附上截图)原先查询数据库,有返回的记录,这几天查询成功,但返回的记录为

  • 预期表现

  • 复现路径

  • 提供一个最简复现 Demo

0SERVER端代码

const { mysql } = require(‘…/qcloud’)

async function get_goods(ctx, next) {

  await mysql(‘goods’).select(‘id’, ‘title’, ‘price’, ‘url1’,‘clickratenum’,‘volume’).then(res => {

    ctx.state.code = 0

   ctx.state.data = res

  }).catch(err => {

    ctx.state.code = -1

    throw new Error(err)

  })

}

module.exports = {

  get_goods

}

0 回复
暂无回复