- 使用微信公众号上传素材接口功能问题?
使用接口上传微信公众号上传素材时能否添加创建素材分组功能,毕竟网页端能创建素材分组,但是现在使用接口上传素材是到默认分组.
2023-01-06 - 本地测试与云函数使用测试结果不同?
主要使用superagent. 发送Post请求进行登录,本地测试是通过的,也就是能正常登录,但云端测试一直无法正常登录. const cheerio = require("cheerio"); const superagent = require("superagent"); const cloud = require('wx-server-sdk') cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }); var login_url = "http://us.nwpu.edu.cn/eams/login.action"; // 获取openId云函数入口函数 exports.main = async (event, context) => { // 获取基础信息 const uid = event.sno; const pwd = event.password; var all_course_info = ""; return new Promise((resolve, reject) => { superagent .post(login_url) .type("form") .set({ "Content-Type": "application/x-www-form-urlencoded", Host: "us.nwpu.edu.cn", Origin: "http://us.nwpu.edu.cn", Referer: "http://us.nwpu.edu.cn/eams/login.action", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62" }) .send({ username: uid, password: pwd, encodedPassword: "", session_locale: "zh_CN", }) .end(function (err, res) { //检测是否得到想要的结果 console.log(res.text); var name_reg = /<p class="person_title_1" title="(\S*)">/g; var name = name_reg.exec(res.text); if (name) { name = name[1]; } else { reject('出错了'); }
2021-12-27