- 查询订单失败,提示Err: Request failed with status code 404
const cloud = require('wx-server-sdk') const axios = require('axios') const config = require('../config') const Guid = require('guid') const fs = require('fs') const rsa = require('../rsa') const PRIMARY_KEY = fs.readFileSync('../apiclient_key.pem') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境e exports.main = async (event, context) => { function makeSignStr(...args) { return args.join('\n') + '\n' } function makeSignMes(obj) { return Object.keys(obj).map(key => `${key}="${obj[key]}"`).join() } let href = 'https://api.mch.weixin.qq.com/v3/pay/transactions/out-trade-no' let url = new URL(`${href}/${event.outTradeNo}?mchid=${config.mchid}`) let timestamp = Math.floor(+new Date / 1000).toString() let nonceStr = Guid.raw().replace(/-/g, '') // let nonceStr = '593BEC0C930BF1AFEB40B4A08C8FB242' let signStr = makeSignStr('GET', url.pathname + url.search, timestamp, nonceStr,"") let signature = rsa.sign(signStr, PRIMARY_KEY) let signMes = makeSignMes({ mchid: config.mchid, "serial_no": config.serial_no, "nonce_str": nonceStr, timestamp, signature }) const { data } = await axios.get(url.href, { headers: { "Accept": 'application/json', // 'Content-Type': 'application/json', "Authorization": 'WECHATPAY2-SHA256-RSA2048 '+ signMes } }) console.log(data) return data }
1天前 - 事务只能用doc(_id)筛选文档吗,可以用where吗?,云开发助手AI说可以,我试了几次都不行?
如题所示
08-24 - 关于new Date().setHours(0,0,0,0))生成时间错误的问题?
const today0=new Date(new Date().setHours(0,0,0,0)).toLocaleString() 以上代码打印出来的格式是: "2024/8/16上午12:00:00" 这是为何?不应该是"2024/8/16上午00:00:00"吗
08-16 - 云开发工作台为何打不开?
1.06.2405020win32-x64,云开发按钮点击无反应
08-10