event.openid不要加双引号
appid和openid都是正确的,为什么还是会40003报错呢?const result = await cloud.openapi.subscribeMessage.send ({ "touser": "event.openid",//推送的用户 "page":'pages/index/index', "data": {//推送内容 "thing1":{ "value":'吃药' }, "time2":{ "value":'2024年1月11日15:30' }, "thing3":{ "value":'每次3粒' }, "short_thing17":{ "value":'每日2次' }, "thing5":{ "value":'注意辛辣' } }, "tmplateId": 'lb2gdJMstCICKoYmEQ2mA8wz2lmGOMrMFfcVUKuAwZM' }) console.log (result) return result }catch (err){ console.log (err) return err } } "Openid":"oVXS160K1CF1iwFokR6cKHZ4-rUw 这是为啥呢?
2024-01-14这别人能猜得出来?
今天小程序都调不通接口了 昨天还是好的 今天线上调不通了 为什么? 小程序还未备案今天小程序都调不通接口了 昨天还是好的 今天线上调不通了 为什么? 小程序还未备案
2024-01-13body传的啥
获取媒资列表报错[图片]
2024-01-12const {index} = e.currentTarget.dataset
为什么在forEach里用三元运算改值不对呢?[图片][图片]
2024-01-12media没传对位置,微信没拿到。可惜我不会php
小程序cgi-bin/media/upload接口报错41005错误码什么回事的呢?errcode":41005,"errmsg":"media data missing hint: [05443954] rid: 65a101b0-53920c02-56542908" $url = "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=".$ACCESS_TOKEN."&type=image"; if(class_exists('\CURLFile')){ $real_path = "D:\www_pro\WWW\winfully_cn_svn\public\balance.png"; $data = array( "access_token" => $ACCESS_TOKEN, "media" => new \CURLFile($real_path), ); }else{ echo "环境比较低无法上传"; exit(); } $result = $this->request_post($url,helper::jsonEncode($data)); halt($result); private function request_post($url = '', $data = ''){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER , true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER , false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST , false); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $res = curl_exec($ch); curl_close($ch); return $res; }
2024-01-12自己发出来的链接地址,自己都不看? [图片]
微信授权 accessToken 获取新的之后旧的还能使用吗?https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html 因为部署的环境是多台主机了,没有使用redis,放在内存里,可能会导致多台服务器获取不同的accessToken,旧的accessToken会立马过期么?还是怎么样的?
2024-01-12跟白名单有啥关系?为啥冲突?都不讲,咋猜
公司服务号ip白名单有两个ip,分别是两个业务,但互相冲突,只能删除一个白名单使用,不能两个兼容吗https://developers.weixin.qq.com/doc/offiaccount/Basic_Information/Get_access_token.html [图片]
2024-01-12代码写个寂寞,你从wx.login获取code,为啥还要写获取手机号?
为什么一直报错errCode: 40029?一直报错 设计一个登录代码,用的是"openapi.phonenumber.getPhoneNumber但是一直报错 errCode: 40029errMsg: "openapi.phonenumber.getPhoneNumber:fail invalid code hint: [rJfaxzI2e-sp68Oa] rid: 659fe0ac-422701b8-010bb3f1"以下是前端代码 <button open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumber">登录/注册</button> 以下是js代码 onGetPhoneNumber: function(e) { if (e.detail.errMsg === 'getPhoneNumber:ok') { // 调用wx.login获取code wx.login({ success: res => { if (res.code) { // 调用云函数进行登录或注册 wx.cloud.callFunction({ name: 'getPhoneNumber', data: { code: res.code }, success: result => { console.log('登录或注册成功:', result); }, fail: error => { console.error('登录或注册失败:', error); } }); } else { console.log('登录失败:' + res.errMsg); } } }); } else { console.log('用户拒绝授权获取手机号'); } }, 以下是云函数的代码(因为我要把手机号码存到数据库中): const cloud = require('wx-server-sdk'); cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }); exports.main = async (event, context) => { const { code } = event; const wxContext = cloud.getWXContext(); // 使用code调用getPhoneNumber接口 try { const result = await cloud.openapi.phonenumber.getPhoneNumber({ code: code }); if (result.errCode === 0) { const phoneNumber = result.phone_info.phoneNumber; const db = cloud.database(); const userCollection = db.collection('user'); console.log("phoneNumber:"+phoneNumber); // 检查用户是否已注册 const userResult = await userCollection.where({ phoneNumber: phoneNumber }).get(); if (userResult.data.length === 0) { // 用户未注册,执行注册流程 await userCollection.add({ data: { phoneNumber: phoneNumber, createTime: new Date() } }); return { result: '注册成功', phoneNumber: phoneNumber }; } else { // 用户已注册,返回登录成功 return { result: '登录成功', phoneNumber: phoneNumber }; } } else { return { error: result.errMsg }; } } catch (err) { return { error: err }; } };
2024-01-11不支持java,只支持php
同样的数据结构为什么apifox好使,Java的不好使?请求:https://api.weixin.qq.com/wxa/sec/order/upload_combined_shipping_info [图片][图片] 返回报错:{"errcode":47001,"errmsg":"data format error rid: 659d05aa-581dd59a-61d09113"}
2024-01-09卡密小程序是啥
卡密小程序后端配置可以使用云开发和云托管吗?卡密小程序后端可以使用云开发和云托管真整不明白。
2024-01-09