- 为什么for中console.log打印错误?
[图片]
2021-07-25 - 云开发数据库数组里的字段自增?
var shuju = await db.collection("fangjian").doc(event._id).update({ data: { kyy[event.id].jine: _.inc(10) } }) event.id 怎么写在kyy里? 还有自增怎么没反应啊?
2021-01-30 - 请问这个弹窗怎么做?
[图片]
2021-01-29 - 云函数分账添加方,请教?
var die = await cloud.CloudPay.profitSharingAddReceiver({ sub_mch_id: '1579010231', nonce_str:'5K8264ILTKCH16CQ2502SI8ZNMTM67VS', receiver:{ "type":'PERSONAL_OPENID', "account": event._openid, "relation_type":'PARTNER', } })
2021-01-24 - 请教云函数调用微信支付订单查询?
请教云函数调用微信支付订单查询 请教各位大神 // 云函数入口文件 const cloud = require('wx-server-sdk') cloud.init() // 云函数入口函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext() var cdcd = cloud.CloudPay.queryOrder({ "sub_mch_id" : '1579010231', "out_trade_no" : event._id, "nonce_str" : new Date().getTime(), }) return { event, } } 回调结果: Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 990d0ef2-4e89-11eb-b1d3-525400a8c4bb, cloud function service error code -504002, error message TypeError: Cannot read property 'queryOrder' of undefined at Runtime.exports.main [as handler] (:12220/var/user/index.js:9) at Runtime.handleOnce (:12220/var/runtime/node10/Runtime.engine.js:214) at Timeout.setTimeout [as _onTimeout] (:12220/var/runtime/node10/Runtime.engine.js:54) at ontimeout (:12220/appservice/timers.js:436) at tryOnTimeout (:12220/appservice/timers.js:300) at listOnTimeout (:12220/appservice/timers.js:263) at Timer.processTimers (:12220/appservice/timers.js:223); at cloud.callFunction api; at new u (WAService.js:1) at d (WAService.js:1) at f (WAService.js:1) at Function.success (WAService.js:1) at WAService.js:1 at C (WAService.js:1) at i. (WAService.js:1) at i.emit (WAService.js:1) at Rs (WAService.js:1) at WAService.js:1
2021-01-04 - 怎么我用旧版本没问题,下载了新版本出现这样?
// 云函数入口文件 const cloud = require('wx-server-sdk') var util = require('util.js'); cloud.init() const db = cloud.database() var shijian = util.formatTime(new Date()); // 云函数入口函数 //查询"附近拼单" exports.main = async (event, context) => { var options = { uri: 'https://apis.map.qq.com/ws/direction/v1/driving/?from=39.915285,116.403857&to=39.915285,116.803857&waypoints=39.111,116.112;39.112,116.113&output=json&callback=cb&key=O3IBZ-WC7WJ-JTHFZ-FKFME-XUOSH-SFBSI', method: 'GET', json: true } console.log(options.result) console.log("333") } 返回结果 {"errorCode":-1,"errorMessage":"Runtime.HandlerNotFound: index:main is undefined or not exported\n at Object.module.exports.load (/var/runtime/node10/UserFunction.js:47:11)\n at Runtime.handleOnce (/var/runtime/node10/Runtime.engine.js:95:38)\n at Timeout.setTimeout [as _onTimeout] (/var/runtime/node10/Runtime.engine.js:54:12)\n at ontimeout (timers.js:436:11)\n at tryOnTimeout (timers.js:300:5)\n at listOnTimeout (timers.js:263:5)\n at Timer.processTimers (timers.js:223:10)"}
2020-11-28 - 云函数腾讯路线规划怎么调用?调用失败
const cloud = require('wx-server-sdk') cloud.init() const db = cloud.database() var QQ = require('aaa.js'); var qqmama = new QQ({ key: 'O3IBZ-WC7WJ-JTHFZ-FKFME-XUOSH-SFBSI' // 必填 }); exports.main = async (event, context) => { const countResult = await db.collection('zhuguan').where({ }).get() for (let i = 0; i < countResult.data.length; i++) { qqmama.calculateDistance({ mode: 'driving',//可选值:'driving'(驾车)、'walking'(步行),不填默认:'walking' from: '30.878231,120.139122', to: '23.694044,113.134750', //若起点有数据则采用起点坐标,若为空默认当前地址 success: function(res) {//成功后的回调 }, }); } } 日志{"msg":"ERROR RequestId:499d4337-2f94-11eb-aa44-525400ff21a1 Result:{\"errCode\":1,\"errMsg\":\"user code exception caught\",\"stackTrace\":\"ReferenceError: wx is not defined\\n at locationsuccess (/var/user/aaa.js:1016:13)\\n at Object.locationProcess (/var/user/aaa.js:650:13)\\n at QQMapWX.calculateDistance (/var/user/aaa.js:1022:17)\\n at Runtime.exports.main [as handler] (/var/user/index.js:15:28)\\n at process._tickCallback (internal/process/next_tick.js:68:7)\"}","level":"error","src":"app","requestId":"499d4337-2f94-11eb-aa44-525400ff21a1","function":"xc","timestamp":"1606359950353721"}
2020-11-26