- 关于跳转型开卡组件问题?
用微信的APPID与secret可以开卡和获取开卡会员卡号,但有时获取不到,估计与公众号网站获取accesstoken干扰有关,后改为用小程序appid与secret , 报48001错误,api没有权限, 在小程序中也设置了白名单依然报48001错误 ,不知道哪里问题了。
2021-09-17 - 云函数获取accesstoken ?
const cloud = require('wx-server-sdk') const request = require('request'); const got = require('got'); cloud.init({ env:"xcx-16888-8gdoshjo1f8f465f" }) // 云函数入口函数 exports.main = async (event, context) => { // var biz=""; // var encrypt_card_id=""; //let postRespone = await got ('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=“”&secret=“”') //return postRespone.body wx.request({ url: 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=“”&secret=“”', //appid保密了 method:"GET", header:{"Content-Type" :"json"},//applicationg/ success:function(res){ var ACCESS_TOKEN = res; return ACCESS_TOKEN; } }) 两种请求写法出现同样错误: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail requestID 389246a2-1386-11ec-9863-5a70464c32c8, cloud function service error code -504002, error message ReferenceError: wx is not defined 有固定IP,open平台也已将公众号与小程序绑定,白名单也已加上。
2021-09-12 - 麻烦给看看物流助手logistics.addOrder返回9300535 shop故障在哪里?
云函数: const result = await cloud.openapi.logistics.addOrder({ // openapi. openid: wxContext.OPENID, //用户openid addSource: event.addSource, //订单来源0为小程序 orderId: event.orderId,//订单ID deliveryId: event.deliveryId, //快递公司ID bizId: event.bizId, //快递客户编码 customRemark:event.customRemark, //备注信息 "sender": { "name": event.name, //发件人姓名 "tel": event.tel, //固话 "mobile": event.mobile,//手机号 "company": event.company,//公司名 "country":event.country,//国家 "province": event.province,//省份 "city":event.city, //城市 "area": event.area, //区 "address": event.address,//详细地址 "postCode": event.postCode//区号 }, "receiver": { "name": event.name, //收件人姓名 "tel": event.tel, //固话 "mobile": event.mobile,//手机号 "company": event.company,//公司名 "country": event.country,//国家 "province": event.province,//省份 "city":event.city, //城市 "area": event.area, //区 "address": event.address,//详细地址 "postCode": event.postCode//区号 }, "shop": { "wxaPath": event.wxaPath, "imgUrl": event.imgUrl, "goodsName": event.goodsName, "goodsCount": event.goodsCount, }, "cargo": { "count": event.count, "weight":event.weight, "spaceX": event.spaceX, "spaceY": event.spaceY, "spaceZ": event.spaceZ, "detailList": [ { "name": event.name, "count": event.count }, { "name": event. name, "count": event.count } ] }, "insured": { "useInsured":event.useInsured, "insuredValue": event.insuredValue, }, "service": { "serviceType": event.serviceType, "serviceName": event.serviceName }, }) return result } catch(err){ return err } 小程序: data:{ addSource: 0, orderId: that.data.timeStamp, //订单id that.data.timeStamp deliveryId: "TEST", //快递公司id:"SF",沙盒测试(TEST) bizId: "test_biz_id", // 快递客户编码,沙盒测试(test_biz_id) customRemark: "易碎物品", "sender":{ "name":"张三", //发件人信息 "tel": "020-88888888", "mobile": "13074754578", "company": "公司名", "postCode": "123456", "country": "中国", "province": "广东省", "city": "广州市", "area": "海珠区", "address": "XX路XX号XX大厦XX栋XX" }, "receiver": { "name": that.data.receiver.name, //收货人详细信息 "tel": that.data.receiver.tel, "mobile": that.data.receiver.mobile, "company": that.data.receiver.company, "postCode": that.data.receiver.postCode, "country": that.data.receiver.country, "province": that.data.receiver.province, "area": that.data.receiver.area, "address": that.data.receiver.address }, "shop": { "wxaPath":"/pages/OrderPage/OrderPage?id="+that.data.timeStamp, //订单详情页 "imgUrl":"cloud://xcx-16888-2go48vd360242d28.7863-xcx-16888-2go48vd360242d28-1304305727/1608343196467.jpeg", //"https://7863-xcx-16888-2go48vd360242d28-1304305727.tcb.qcloud.la/1608343196467.jpeg?sign=830e6dcd2ff8b3fee27c7d301fa49e6e&t=1615460661", //that.data.product[0].src[0], "goodsName":"微信气泡狗抱枕&微信气泡狗钥匙扣", "goodsCount":2 , //这个订单几件货物 }, " cargo": { "count": 2, "weight": 5.5, //需要计算物品体积 "spaceX": 30.5, "spaceY": 20, "spaceZ": 20, "detailList": [ { "name": "微信气泡狗抱枕", "count": 1 }, { "name": "微信气泡狗钥匙扣", "count": 1 } ] }, "insured": { "useInsured": 1, "insuredValue": 10000 }, "service": { "serviceType":1, //0, "serviceName":"test_service_name" //"标准快递"(沙盒测试) } }, result: {errCode: 9300535, errMsg: "openapi.logistics.addOrder:fail invalid shop args rid: 604b0674-3e08c0c7-7cc83734"}__proto__: Object
2021-03-12