微信云开发官网
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloudrun/src/development/call/mini.html
"resourceEnv": "xd-coffee-5gqwrfi9568ad835" //环境 "resourceAppid": "wxa8daa8c7e5199273" //第三方平台appid "extAppid": "wx4540b11d2d2aca56" //商家appid 批量代云开发 用这个触发云函数api 文档地址 curl -d '{}' \ 'https://api.weixin.qq.com/tcb/invokecloudfunction?access_token=ACCESS_TOKEN&env=ENV&name=login' 注意事项由 HTTP API 触发的云函数可以使用云调用。注意事项写的是可以使用云调用 我在同一个云函数里调用了 cloud.openapi({ appid }).subscribeMessage.send //这个用了好几年了 一点问题没有 cloud.openapi({ appid }).cloudbase.addDelayedFunctionTask //新加上去的 发现会报错 下面是报错的信息 大腿大神能不能帮忙看看 谢谢 感谢万分 <3 { status: 'rejected', reason: CloudSDKError: errCode: -501000 | errMsg: openapi.cloudbase.addDelayedFunctionTask:fail 未找到指定的 Namespace,请创建后再试。 TcbCode: [ResourceNotFound.Namespace] rid: 673b95dd-3221d179-0ffed976 at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2397:31) at processTicksAndRejections (node:internal/process/task_queues:96:5) { errCode: -501000, errMsg: 'openapi.cloudbase.addDelayedFunctionTask:fail 未找到指定的Namespace,请创建后再试。 TcbCode: [ResourceNotFound.Namespace] rid: 673b95dd-3221d179-0ffed976' } }
如题, 本地进行页面开发,使用了文档中推荐的一键登录 mplogin 函数, 但是该方法依赖于静态资源存储库的自动授权功能,但是上传文件等功能需要登录,但是在本地调试又无法登陆,该如何解决这一矛盾?
https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/storage/security-rules.html
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloudrun/src/guide/service/image.html
[图片]日志内容 Request ID: 2429c522-0c8c-49d5-a2b1-89b223fadc3f 执行时间: 0ms内存使用: Zero KB 返回结果 (空) 日志 云函数初始化完成 cloudbase适配器初始化完成 cloudbase适配器初始化完成 TypeError: Cannot read properties of undefined (reading 'toString') at writeRuntimeFile (/data/scf/frame/node16/runtime.js:65:37) at main (/data/scf/frame/node16/runtime.js:259:7) at Object.<anonymous> (/data/scf/frame/node16/runtime.js:268:1) at Module._compile (node:internal/modules/cjs/loader:1101:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:981:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:17:47 START RequestId: b32a909f-783c-4c0c-8cbc-49afc64e5fb6 Init Report RequestId: b32a909f-783c-4c0c-8cbc-49afc64e5fb6 Coldstart: 9ms (InitRuntime: 9ms InitFunction: 0ms) Memory: 256MB MemUsage: 0.00MB ERROR RequestId: b32a909f-783c-4c0c-8cbc-49afc64e5fb6 Result: {"errorCode": -1, "errorMessage": "145 code exit unexpected", "statusCode": 443} END RequestId: b32a909f-783c-4c0c-8cbc-49afc64e5fb6 Report RequestId: b32a909f-783c-4c0c-8cbc-49afc64e5fb6 Duration: 0ms Memory: 256MB MemUsage: 0.000000MB
[图片] 我用的微信开发者工具, 感谢能帮忙解答下? 这个线上云服务的代码,难道被删掉了吗? 我已经发布到线上的代码,如何加载到本地呢?
实现效果:当置顶后,需要按着置顶的时长,自动取消置顶。 如图:当置顶时长到了之后自动删除topping字段,以达到自动取消置顶的效果,自己写了一段代码,能够实现自动删除这个字段,但是当所有数据中都没有topping这个字段后就会报错。哪位大师提供一个更好的实现案例学习下 [图片] [图片] 代码: // 取消置顶 async timer(){ await app.loadUserInfo(); let openid = await app.globalData.userInfo._openid; const toppings = await db.collection("wehicle").where({ _openid: openid }).get() if(toppings){ const wehicles = toppings.data; console.log(wehicles); wehicles.forEach((wehicle, index) => { const id = wehicle._id; console.log(id); if(wehicle.topping.timelength){ setTimeout(function(){ db.collection("wehicle").doc(id).update({ data:{ "topping":_.remove() } }) },wehicle.topping.timelength*1000*60) } }) } },
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/reference-http-api/https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/billing/instruction.html 问题1:开通云开发至少要19.9元每月的意思?我用不了19.9元包含的那么多内容,能不能直接按量计费? 问题2:开通了云开发之后,云函数和云数据库是不是另外还要给钱?
cloud.openapi.ocr.idcard({ img_url: img_url }).then(res => { console.log(res) resolve({ msg: 200, data: res }) }).catch(err => { // console.log(err) let title = "识别失败,请重新上传身份证人像面照片"; let errCode = err.errCode; switch (err.errCode) { case -1: title = "系统繁忙,请稍后再试"; break; case 101000: title = "图片无效,请重新上传身份证人像面照片"; break; case 101001: title = "图片无效,请重新上传身份证人像面照片"; break; case 101002: title = "图片无效,请重新上传身份证人像面照片"; break; case 101003: title = "暂时无法提供图片识别服务,请联系管理员"; break; } console.log(title) delumage(data.fileID) resolve({ msg: 300, title: title, errCode: errCode }) }) [图片] 本地调试可以成功,使用云调用就返回没权限调用api了;
如图,当点击查询按钮时,报错,当点击选项卡的时候,获取到对应的数据,当下拉刷新时,没有反应,当点击选项卡时,获取到对应的数据。求指教,这个查询条件的索引要如何弄? [图片][图片] data: { title: ["全部", "我要找车", "我要找人", "我找货车", "我要找货"], hasmore: false, vehicles: '', startPoint: '', goal: '', isQuerying: false, currentIndex: '', vhereRes: '', }, /** * 获取选项卡 */ onItemChengdeEvent(event) { var index = event.detail.index; this.setData({ currentIndex: index }); if (!this.data.isQuerying) { this.lowdrelease(); } else { this.onchaxun() } }, /** * 获取数据库数据 */ async loadData(start = 0, vehicle) { const that = this; const index = that.data.currentIndex; let query = {}; switch (index) { case 0: break; case 1: query = {carpool: '我要找车'}; break; case 2: query = {carpool: '我要找人'}; break; case 3: query = {carpool: '我找货车'}; break; case 4: query = {carpool: '我要找货'}; break; } console.log(query) const vhereRes = { startPoint: db.RegExp({ regexp: that.data.startPoint, options: 'i' }), goal: db.RegExp({ regexp: that.data.goal, options: 'i' }) }; console.log('查询事件起点和终点条件', vhereRes) const quer = that.data.isQuerying ? _.and(vhereRes, query) : query; console.log(quer) const promise = db.collection(vehicle).skip(start).limit(2) .orderBy("redden.reddenStartTime", 'desc') .orderBy("topping.toppingStarttime", "desc") .orderBy("create_time", "desc"); const dataRes = await promise.where(quer).get(); const vehicles = dataRes.data; console.log(vehicles); const countRes = await db.collection(vehicle).where(quer).count(); const total = countRes.total; console.log(total) const newVehicles = start > 0 ? this.data.vehicles.concat(vehicles) : vehicles; newVehicles.forEach((vehicle, index) => { vehicle.create_time = vehicle.create_time.toString(); }); const hasmore = false return {newVehicles,total,hasmore}; }, /** * 获取初始数据 */ async lowdrelease(start = 0) { const that = this; const {newVehicles: vehicles,total: vehiclesTotal,hasmore: hasmore} = await that.loadData(start, 'vehicle'); that.setData({ vehicles: vehicles, hasmore: hasmore, result: vehiclesTotal }) }, /** * 点击查询事件 */ async onchaxun(start = 0) { const that = this; that.setData({ isQuerying: true, }) const {newVehicles: vehicles,total: vehiclesTotal,hasmore: hasmore} = await that.loadData(start, 'vehicle'); that.setData({ startPointStr: '', goalStr: '', vehicles: vehicles, hasmore: hasmore, result: vehiclesTotal }); },
在创建字段时,是否唯一明明选择“否”,会被强制改为“是”,数据类型明明选择“多对多”,会被强制改为“一对一”,清理删除整个模型重新创建也没用,毫无规律,无法复现,快被整崩溃了。 [图片] [图片] [图片]
微信云开发是否可以用于企业微信小程序开发,服务端的api调用,企业微信自建应用要设置ip白名单以及可信任域名[图片]
很长一段时间没进行小程序维护,现在登录发现之前保存在云开发DB中的数据表都不见了 之前云开发环境中的keyvalue数据库是免费提供的,里面存了很多数据,现在打开云开发,发现环境和数据库都不见了,如何找回数据啊?
问题1:如果我有一百个云函数都要通过数据模型操作数据库,那我要不要每个云函数的package.json 所在目录下执行以下命令吗? npm install --save @cloudbase/wx-cloud-client-sdk wx-server-sdkg 这样的话,每个云函数中都多了一个 node_modules 目录,请大神说一下这样设计的原理 问题2: 一个云函数中,操作数据库时,是不是只能操作一种事情? 比如,我想对user表增删改查操作时,是不是要创建四个云函数? 能不能像js的模块化一样,一个云函数中写多个操作数据库的方法?
[图片] 云函数中的查询数量已经得到,但是页面js端,想要拿到数字 1 的时候,返回值类型为object这是为何呢 [图片] 请问这个数据如何才能拿到,还是需要变化下类型把object换成number就可以了 感谢您的回复。 返回json格式,还是返回NUll [图片] [图片]
云函数的日志报错:{"errcode":"InnerError.FailedOperation","errmsg":"{\"message\":\"微信支付SDK请求失败, 响应码:403,错误码:NO_AUTH, 错误信息: 此商家的收款功能已被限制,暂无法支付。商家可登录微信商户平台/微信支付商家助手小程序/经营账户页面查看原因和解决方案。\"}"} 在商户助手里没看到受限制 日志 开发工具报错:{errMsg: "requestPayment:fail parameter error: parameter.tim…er.paySign should be String instead of Undefined;"} 这个是跟哪里有关呢,谢谢!
Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: Error: errCode: -501001 resource system error | errMsg: security.getWxContext:fail [100003] Param Invalid: env check invalid be filterd (cba0e7ca-d110-4e00-b012-3f5c36d69f89) 请前往云开发AI小助手查看问题:https://tcb.cloud.tencent.com/dev#/helper/copilot?q=INVALID_ENV at callGeneralOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:426:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2364:28) at async exports.main (/var/user/index.js:31:18) (callId: 1743150524134-0.195116592419468) (trace: 16:28:44 start->16:28:44 system error (Error: errCode: -504002 functions execute fail | errMsg: Error: errCode: -501001 resource system error | errMsg: security.getWxContext:fail [100003] Param Invalid: env check invalid be filterd (cba0e7ca-d110-4e00-b012-3f5c36d69f89) 请前往云开发AI小助手查看问题:https://tcb.cloud.tencent.com/dev#/helper/copilot?q=INVALID_ENV at callGeneralOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:426:19) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2364:28) at async exports.main (/var/user/index.js:31:18)), abort) at O (<anonymous>:1:256424) at <anonymous>:1:292776(env: Windows,mp,1.06.2409140; lib: 3.7.11)
1.我的商户是间连渠道服务商下的子商户。在渠道商那边已经关联了小程序的APPID和商户号 2.我是用的小程序云开发,调用的CloudPay.unifiedOrder()下单 这个API返回「受理关系不存在」的错误。我应该如何操作? [图片]
云函数部署了三年了,一直没问题,也没有更新,今天发现有问题了,看业务代码打印的日志,业务代码已经走完了。看日志报的这个错误。 RequestId: 2394de4a-8688-4320-9953-fd78ebf0132c getContextBean:com.fasterxml.jackson.core.JsonParseException: Unexpected character ('%' (code 37)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: (String)"%7B%22environ%22%3A%22WX_OPENID%3Dwxopenid匿名化了%3BSCF_NAMESPACE%3D 后面省略了
小程序示例
小程序官方示例Demo,包含云开发示例。
小程序示例
扫码体验
这个是云托管服务,报 500 的话检查服务日志,是 spring boot 里面哪里有问题。