微信云开发官网
如题,目前小程序所有功能均使用云函数开发,在物流插件的api文档中没有看到云函数的调用方式,是必须要独立后端调用接口吗?
购买的是19.9的基础基础套餐,要更换去哪里选择
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/model/mysql.htmlhttps://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/basis/getting-started.html 你好,我想要了解更多关于【数据模型SDK】使用办法时,在该页面点击【增删查改】后跳转到了404界面,我应该如何获得这个文档的完成使用说明书?[图片]
云函数部署了三年了,一直没问题,也没有更新,今天发现有问题了,看业务代码打印的日志,业务代码已经走完了。看日志报的这个错误。 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 后面省略了
小程序端 [图片] 云函数 [图片] 在云端测试正常,但是到了小程序端返回的就是空值 [图片] 有没有大佬知道为什么
// 云函数入口文件 const cloud = require('wx-server-sdk') const request = require('request'); // 引入 request 库 const crypto = require('crypto'); cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境 // 云函数入口函数 exports.main = async (event, context) => { const wxContext = cloud.getWXContext() try { // 获取access_token和请求参 const { access_token, queryParams } = event // 获取加密请求数据 const ctxEco = getEcoCtx('https://api.weixin.qq.com/cgi-bin/express/intracity/querystore') // 开发者本地信息 console.log("ctxEco", ctxEco) const req = queryParams // 请求数据 console.log("req", req) const newReq = getNewReq(ctxEco, req) // 生成加密请求数据 console.log("newReq", newReq) const ctxSign = getSignCtx('https://api.weixin.qq.com/cgi-bin/express/intracity/querystore') console.log("ctxSign", ctxSign) const signature = getSignature(ctxSign, newReq) // 获取签名 console.log("signature", signature) // 执行查询门店接口请求 const response = await queryStore(access_token, signature, newReq) console.log("response", response) return response; } catch (error) { console.error('请求错误:', error); return error; } } // 查询门店信息的POST请求 async function queryStore(access_token, signature, newReq) { const url = `https://api.weixin.qq.com/cgi-bin/express/intracity/querystore?access_token=${access_token}`; const rp = options => new Promise((resolve, reject) => { request(options, (error, response, body) => { if (error) { reject(error); } resolve(response); }); }); const result = await rp({ url: url, method: 'POST', json: true, // 自动将请求体转换为JSON格式 headers: { 'Wechatmp-Appid': 'appid', 'Wechatmp-TimeStamp': newReq.req_ts, 'Wechatmp-Signature': signature }, body: newReq // 将加密数据作为请求体 }); return result.body; } // 获取开发者本地信息 function getSignCtx(url) { let ctx = { local_private_key: "-----BEGIN RSA PRIVATE KEY-----\n-----END RSA PRIVATE KEY-----", local_sn: "sn", local_appid: "appid", url_path: url } return ctx } // 仅做演示,敏感信息请勿硬编码 function getEcoCtx(url) { let ctx = { local_sym_key: "sym_key", local_sym_sn: "sym_sn", local_appid: "appid", url_path: url } return ctx } // 获取加密后的请求数据 function getNewReq(ctx, req) { const { local_sym_key, local_sym_sn, local_appid, url_path } = ctx // 开发者本地信息 const local_ts = Math.floor(Date.now() / 1000) //加密签名使用的统一时间戳 const nonce = crypto.randomBytes(16).toString('base64').replace(/=/g, '') const reqex = { _n: nonce, _appid: local_appid, _timestamp: local_ts } const real_req = Object.assign({}, reqex, req) // 生成并添加安全校验字段 const plaintext = JSON.stringify(real_req) const aad = `${url_path}|${local_appid}|${local_ts}|${local_sym_sn}` const real_key = Buffer.from(local_sym_key, "base64") const real_iv = crypto.randomBytes(12) const real_aad = Buffer.from(aad, "utf-8") const real_plaintext = Buffer.from(plaintext, "utf-8") const cipher = crypto.createCipheriv("aes-256-gcm", real_key, real_iv) cipher.setAAD(real_aad) let cipher_update = cipher.update(real_plaintext) let cipher_final = cipher.final() const real_ciphertext = Buffer.concat([cipher_update, cipher_final]) const real_authTag = cipher.getAuthTag() const iv = real_iv.toString("base64") const data = real_ciphertext.toString("base64") const authtag = real_authTag.toString("base64") const req_data = { iv, data, authtag, } const new_req = { req_ts: local_ts, req_data: JSON.stringify(req_data) } return new_req } // 获取签名 function getSignature(ctx, req) { const { local_private_key, local_sn, local_appid, url_path } = ctx // 开发者本地信息 const { req_ts, req_data } = req // 待请求API数据 const payload = `${url_path}\n${local_appid}\n${req_ts}\n${req_data}` const data_buffer = Buffer.from(payload, 'utf-8') const key_obj = { key: local_private_key, padding: crypto.constants.RSA_PKCS1_PSS_PADDING, saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST // salt长度,需与SHA256结果长度(32)一致 } const sig_buffer = ss_buffer = crypto.sign( 'RSA-SHA256', data_buffer, key_obj ) const sig = sig_buffer.toString('base64') return sig }
[图片]车辆使用台账,自动获取车牌号和上一次出车的终点里程作为本次用车的起点里程,填写后提交。 [图片]总共有10辆车的使用记录,其中9辆车后台能够按照正常的终止里程、时间进行倒序排列,并且能够在小程序端正确获取数据,以上为其中正常车辆台账的示意图。 [图片] [图片] 以上两张图片,为问题车辆的台账记录。该车辆使用记录排序混乱,且在小程序端获取到的终止里程数据为“9900”,及第一页第一条数据。 注意:以上所有车辆记录都是保存在一个云开发数据库内,使用的逻辑代码也都是同一套。
[图片][图片]
开通云开发的时候提示Error: Error: Base resp abnormal, {"ret":-2,"errmsg":"system error.","wx_req_id":"TiGfPBpre-7nV1Oa-1731577237"} [图片]
一直提示存在无效域名 https://fanbook.cc 文件链接:https://fanbook.cc/8264429345.txt 也是可以正常访问的 但就是无法配置 [图片]
微信开发者工具 Stable 1.06.2405020,云开发用不了
请问,我在微信云开发上发布了小程序,显示发布成功(让去提交审核)。web端的链接可以打开,但是手机扫码小程序时预览的界面却是空的,这是怎么回事?哪位大神了解,求告知,谢谢。 [图片] [图片]
await db.collection('channel').aggregate() .lookup({ from: 'user', let: { channelid: '$_id' }, pipeline: $.pipeline().match( _.expr( $.eq(['$channel', '$$channelid']) ) ).done(), as: 'usercount' }) .group({ _id:"_id", total:$.size("$usercount") }) .limit(100) .end() 请教一个问题,我目前有两个表格,表格一渠道channel,表格二user。管理关系是channel里面的_id和user里面chanel关联。我现在需要更新channel里面的统计数据,我想计算返回对应渠道中user数量,更新到channel表中。如果这个能一起行完成很ok,如果不行我想两次操作,第一次操作算出来渠道的数量,然后for更新到chanel里面。
https://developers.weixin.qq.com/miniprogram/dev/wxcloudservice/wxcloud/guide/init.html 注意小程序需先开通云服务,开通的方法是点击工具栏左上角的 “控制台” 按钮)这里可以加一个截图指出在哪里
https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/express/business/freight_insurance.html
遇上一个问题,目前我有一个集合,集合里有两种类型 类型一:价格低于指定值,可用 类型二:价格满指定值,可用 我怎么通过查询获取到两个数组,一个可用,一个不可用。这两个数组可能存在都包含以上两种类型。脑子快想破了
小程序云开发环境共享给公众号,接收公众号的用户消息,回复发送link消息给用户报错: Error: errCode: 40003 | errMsg: openapi.customerServiceMessage.send:fail invalid openid rid: 67317881-75b4d516-3fe67e7e at callWXOpenAPI (/var/user/node_modules/wx-server-sdk/index.js:2392:31) 发送消息的参数openid取自用户消息的“FromUserName”,调试打印出来是正确的。 { touser: openid, msgtype: 'link', link: { title, description, url, thumb_url } } 不知为何报错
如图,当点击查询按钮时,报错,当点击选项卡的时候,获取到对应的数据,当下拉刷新时,没有反应,当点击选项卡时,获取到对应的数据。求指教,这个查询条件的索引要如何弄? [图片][图片] 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 }); },
[图片] 云函数中的查询数量已经得到,但是页面js端,想要拿到数字 1 的时候,返回值类型为object这是为何呢 [图片] 请问这个数据如何才能拿到,还是需要变化下类型把object换成number就可以了 感谢您的回复。 返回json格式,还是返回NUll [图片] [图片]
绑定状态,和jsapi权限授权都不行 [图片]
小程序示例
小程序官方示例Demo,包含云开发示例。
小程序示例
扫码体验
看文档,支持云调用的,就能调用,不支持云调用的,自己想办法,一般只能自备后台服务器。