查询云数据库时,电脑端正常拿到数据并显示,但是手机端没有数据? 在线等解决,非常感谢。

小程序 文章 2021-04-08 09:22 393 0 全屏看文

AI助手支持GPT4.0

查询云数据库时,电脑端正常拿到数据并显示,但是手机端没有数据? 在线等解决,非常感谢。When querying the cloud database, the computer terminal normally gets the data and displays it, but there is no data on the mobile terminal? Please wait for the solution online, thank you very much.

查询云数据库时,电脑端正常拿到数据并显示,但是手机端没有数据? 在线等解决,非常感谢。

正常使用wx.cloud.callFunction(),调用写的查询语句,电脑上一切正常,但是到手机端了就没有数据了。用vconsole调试,发现数据库查询返回的是空数组,但是电脑上用微信开发工具是正常地,权限也放开了,真的很奇怪,,在线等解决,感激不尽。(附三张图)

手机端:

Normal use wx.cloud.callFunction (), call the written query statement, everything is normal on the computer, but there is no data on the mobile phone. Debugging with vconsole, we found that the database query returned an empty array, but the wechat development tool on the computer is normal, and the permissions are also released. It's really strange. Thank you for solving the problem online. (three pictures attached) mobile terminal:

回答:

天河人家:有用
当乙醇爱上了铜:
// 云函数入口函数exports.main = async (event, context) => {  let { str_location, section_b, section_e, str_date} = event  return await db.collection("schedule").where({    location: db.RegExp({      regexp: '^([' + str_location + '])' ,  //加括号因为^和[ ]不能连用,示例: '^([123])'      option: 'i'    }),    section_b: _.gte(section_b),    section_e: _.lte(section_e),    date: str_date  }).get()}


调用:

wx.cloud.callFunction({      name"searchtb_list",      data:{        str_location,        section_b,        section_e,        str_date      }    }).then(res=>{      console.log(res)      this.setData({        result: res.result.data      })    })


 :

可以把云函数部分代码贴一下

Mr.Zhao:看看云函数代码

-EOF-

AI助手支持GPT4.0