收藏
回答

(in promise) MiniProgramError errCode: -501007 ?

我想把data数据上传到云数据库

错误:VM1378:2 (in promise) MiniProgramError

errCode: -501007 invalid parameters | errMsg: [InvalidParameter] Check request parameter fail. Please check your request, but if the problem cannot be solved, contact us.

Error: errCode: -501007 invalid parameters | errMsg: [InvalidParameter] Check request parameter fail. Please check your request, but if the problem cannot be solved, contact us.


playlist.js:

const db = wx.cloud.database() 
Page({
  data: {
        playlist:[{"_id":"1""playCount":1.4641238e+06,"highQuality":false,"type":0.0,"canDislike":true,"name":"天气转热了,适合听点凉爽的歌。"},
         {"_id":"08560c9e5d042a5c0174f1da7aa357aa","highQuality":false,"playCount":622822.6,"id":2.740107647e+09,"name":"「时空潜行","type":0.0},
         {"_id":"08560c9e5d042a5c0174f1de21c7e79e","id":2.828842343e+09,"type":0.0,"name":"粤语","canDislike":true},
         {"_id":"08560c9e5d042a5d0174f1e67d1bb16f","playCount":7.719329e+06,"highQuality":false"id":9.17794768e+08,"type":0.0,"name":"翻唱简史","canDislike":true}
          ]
  },
  playlisttodb()
  {
    const len=this.data.playlist.length
    for (let i = 0; i < len; i++) {
       let that=this
       let arr=this.data.playlist[i]
       that.setData({
         arr:arr,
       })
       db.collection('playlistdb').add({
        data:
        {
          arr,
          createTime: db.serverDate(),
        }
      })
    }
 },
onLoadfunction (options{
  },
onReadyfunction () {
  }
}


playlist.wxml

<view>
  <button bind:tap="playlisttodb">歌单转入数据库</button>
</view>
最后一次编辑于  2020-09-30
回答关注问题邀请回答
收藏

1 个回答

  • o0o有脾气的酸奶
    o0o有脾气的酸奶
    2020-10-23
    试试吧
    async playlisttodb()
      {
        const len=this.data.playlist.length
        for (let i = 0; i < len; i++) {
           let that=this
           let arr=this.data.playlist[i]
           that.setData({
             arr:arr,
           })
           await db.collection('playlistdb').add({
            data:
            {
              arr,
              createTime: db.serverDate(),
            }
          })
        }
     },
    
    
    
    
    
    2020-10-23
    有用
    回复
登录 后发表内容
问题标签