看完3-10节课之后, 进行云端测试, 日志显示插入失败
来源:3-11 歌单数据去重
丛从绿草
2021-05-20
返回结果
null
日志
START
[
{
“id”: 6758920974,
“type”: 0,
“name”: “520来啦~想为你定制一场有声的浪漫告白”,
“copywriter”: “编辑推荐:我一行一行给你写,我的最后一封情书”,
“picUrl”: “https://p2.music.126.net/W94DvunFBadkERB7DWmb2A==/109951165981047821.jpg”,
“canDislike”: false,
“trackNumberUpdateTime”: 1621354991450,
“playCount”: 395890,
“trackCount”: 45,
“highQuality”: false,
“alg”: “featured”
},
{
“id”: 6764413405,
“type”: 0,
“name”: “氛围电子 | 绵延着黄昏的温柔”,
“copywriter”: “编辑推荐:只为收集世间温柔去见你,与星辉一同为你沉沦”,
“picUrl”: “https://p2.music.126.net/1ieA-zrCtaqYP21ngUHK4A==/109951165989885480.jpg”,
“canDislike”: false,
“trackNumberUpdateTime”: 1621412537483,
“playCount”: 55631,
“trackCount”: 33,
“highQuality”: false,
“alg”: “featured”
},
{
“id”: 6732050568,
“type”: 0,
“name”: “「车载流行」一路热歌伴你前行”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/DD0bb93v6u6UMdN6qDbGQg==/109951165928561400.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1619595551068,
“playCount”: 126998,
“trackCount”: 29,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5146965725,
“type”: 0,
“name”: “你-总是有各种理由让我放弃你☹”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/A5vMlKxhsLYqRQLZKYydWQ==/109951165226049642.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620633266563,
“playCount”: 11299952,
“trackCount”: 97,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3187366465,
“type”: 0,
“name”: “网易云音乐年度热议单曲总结”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/KKmRs2NGtac4-R5px16IWw==/109951165291298691.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1599105748588,
“playCount”: 1501577,
“trackCount”: 162,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5122844786,
“type”: 0,
“name”: “季节轮换 你也会随着时间把我淡忘”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/s5uY41zbEnUFxC0_LUrW0g==/109951165741572266.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621398593088,
“playCount”: 3741723,
“trackCount”: 220,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5159439062,
“type”: 0,
“name”: “留给我们的夏天,大概还有一首歌那么长”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/THc2dGCHBcMLuRlwQjccFg==/109951165210824295.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621262717313,
“playCount”: 6329025,
“trackCount”: 36,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 2974449693,
“type”: 0,
“name”: “我想你了 其实我也很脆弱”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/fob5pHV3xzGlJ_-KEeLFLg==/109951165693966983.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1612493399745,
“playCount”: 55972016,
“trackCount”: 183,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3173391820,
“type”: 0,
“name”: ““中途离开的人都是说过会陪你好久的人””,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/zyiAnTJpsfHPSPVCVPXSEA==/109951165764984626.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1614438622110,
“playCount”: 2305976,
“trackCount”: 80,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5068534740,
“type”: 0,
“name”: “还好大雾四起 藏匿难言爱意”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/UDv_LqXIRs91911xBuVhhg==/109951165612512203.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1618445537808,
“playCount”: 4020157,
“trackCount”: 175,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 906626701,
“type”: 0,
“name”: “精选新疆买西来普舞曲,”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/kHhWviQwPuSgOj5P-zUCzQ==/109951163024332153.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1615370038568,
“playCount”: 1987528,
“trackCount”: 81,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5063965580,
“type”: 0,
“name”: “「超好听的歌曲高潮翻唱合辑」”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/cggF0nGXDZ14gbok15MJdw==/109951165800851690.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621347508232,
“playCount”: 951487,
“trackCount”: 482,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 4859324535,
“type”: 0,
“name”: “【翻/原】温柔不是我说 而是你觉得.”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/PJylNWy_2-jI7LRgQ2Cm6w==/109951165649129522.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621080091876,
“playCount”: 3299152,
“trackCount”: 295,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5274380829,
“type”: 0,
“name”: “网络热歌分享〖持续更新〗”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/H4QICPuwNQjRALUweNTTdA==/109951165484908224.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621052939904,
“playCount”: 378238,
“trackCount”: 97,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5051447966,
“type”: 0,
“name”: “神仙翻唱 | 这些翻唱这么火大概就是好听吧”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/ns0C_DgZp8SAxwWLjtJ_7Q==/109951165137169029.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1618728154476,
“playCount”: 8396576,
“trackCount”: 62,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3110865674,
“type”: 0,
“name”: “你数数 这是你第几次丢下我”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/Xvo6PwBcdOA69ipcpV9YYg==/109951165463253777.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621443728422,
“playCount”: 11876357,
“trackCount”: 123,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5389350615,
“type”: 0,
“name”: “爱而不得的又不止你我”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/-B6xquvnaRDLwcIxD9rXdg==/109951165608496833.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620916549948,
“playCount”: 2838868,
“trackCount”: 153,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3047591896,
“type”: 0,
“name”: “宝藏音乐观丨舒适旋律渲染微醺夜色”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/Dgx4j4kDXIzuBOBuBqZNxQ==/109951164666693147.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1616062226292,
“playCount”: 3724263,
“trackCount”: 70,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3184948872,
“type”: 0,
“name”: “「神仙翻唱」原创听腻了?试试这些神仙翻唱”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/rVQlZwxRpeLWO7BC0t4Z6w==/109951165054685886.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1612729523115,
“playCount”: 1634002,
“trackCount”: 97,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 4957083693,
“type”: 0,
“name”: “别用你短暂的喜欢来打扰我了”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/vDXcwE1NqRhoU-genmWzZg==/109951165651193628.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620717351115,
“playCount”: 829637,
“trackCount”: 282,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 2563964746,
“type”: 0,
“name”: “网易云那些10至100w+评论的歌单按专辑排序”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/pw6D4jBzPOIpdz4cAMTkVg==/109951164845611021.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620751301435,
“playCount”: 3180070,
“trackCount”: 350,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5087806619,
“type”: 0,
“name”: ““好听的歌没有完整版,就像我们没有结果””,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/w8HtRC-TK4ZLFJTMbD16jQ==/109951165307788332.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620833640032,
“playCount”: 373941,
“trackCount”: 128,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5152332685,
“type”: 0,
“name”: “我们不能总为不值得的人流太多眼泪”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/AB-3WsIeCfDPkRyF_csLVQ==/109951165260265255.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621094500504,
“playCount”: 23508048,
“trackCount”: 235,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5096346427,
“type”: 0,
“name”: “「车载」欧美音乐私人订制”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/dnmBYW7GwYo0NNjBiX_XQQ==/109951165186820897.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1619620833438,
“playCount”: 143353,
“trackCount”: 213,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3189806116,
“type”: 0,
“name”: “听完这些歌我就把你忘了吧”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/6km6Xkab6NWCiDzMUavsCw==/109951165791338146.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1620744825358,
“playCount”: 5054332,
“trackCount”: 149,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 316867856,
“type”: 0,
“name”: “我是歌手第三季-所有歌曲”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/DprdNIWpRWYZJak4Q-cS-Q==/2891715582273535.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1458195309894,
“playCount”: 162542,
“trackCount”: 115,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 3107640832,
“type”: 0,
“name”: “网易云评论最多粤语歌TOP50”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/OPCbPz6GgtiPLtTZ5p_6dg==/109951164536740824.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1610817515646,
“playCount”: 5640023,
“trackCount”: 116,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5346481834,
“type”: 0,
“name”: “把挽留的话停在对话框”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/xQYcCLMmayn1aeBc3TD1sQ==/109951165489499941.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1616750105777,
“playCount”: 1460802,
“trackCount”: 94,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 2934064202,
“type”: 0,
“name”: “迈出六亲不认の态度【西装灭霸】”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/nOCA1TbK-Q7mDJGJvMoSng==/109951165510662523.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621319574183,
“playCount”: 179053,
“trackCount”: 568,
“highQuality”: false,
“alg”: “cityLevel_unknow”
},
{
“id”: 5121921415,
“type”: 0,
“name”: “神仙歌单:超好听的歌曲集”,
“copywriter”: “热门推荐”,
“picUrl”: “https://p2.music.126.net/e2NZVcG4fR60Hc0BO3pDeg==/109951165143676266.jpg”,
“canDislike”: true,
“trackNumberUpdateTime”: 1621178965616,
“playCount”: 6441440,
“trackCount”: 262,
“highQuality”: false,
“alg”: “cityLevel_unknow”
}
]
插入失败
REPORT RequestId:d2aeebe0-c60c-49db-8ef6-163f2ebdb4b9 Duration:591ms Memory:256MB MemUsage:32.121094MB
END
这是云端测试的时候返回的日志结果,
// 云函数入口文件
const cloud = require(‘wx-server-sdk’)
// 这里我本来是用cloud.init() , 运行的时候,提示:“当前未指定env,将默认使用第一个创建的环境!”, 我看了源码就 按一下填的.
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV
})
// 云数据库
const db = cloud.database()
const axios = require(“axios”)
const URL = “https://apis.imooc.com/personalized?icode=”
const playlistCollection = db.collection(‘playlist’)
// 云函数入口函数
exports.main = async (event, context) => {
// 请求数据
const { data } = await axios.get(URL)
if (data.code >= 1000) {
console.log(data.msg)
return 0
}
const playlist = data.result
console.log(playlist)
// 批量插入数据库
if (playlist && playlist.length) {
await playlistCollection.add({
data: […playlist]
}).then(res => {
console.log(“插入成功”)
}).catch(err => {
console.warn(“插入失败”)
})
}
}
1回答
-
如果显示插入失败,可以在catch中输入这个err,看下错误信息是什么,就找到问题了。
022021-05-21
相似问题
回答 1
回答 1