- 云开发 security.imgSecCheck 调用响应错误
使用云函数调用 security.imgSecCheck ,对图片进行鉴黄请求响应为: [代码]{[代码] [代码]errMsg: [代码][代码]"cloud.callFunction:ok",[代码] [代码]result:{[代码][代码] errCode: 41005[代码][代码] errMsg: [代码][代码]"openapi.security.imgSecCheck:fail media data missing hint: [9ZGoCA02628622]" [代码] [代码] }[代码] [代码]}[代码] 云函数代码如下: [代码]const cloud = require([代码][代码]'wx-server-sdk'[代码][代码])[代码] [代码]cloud.init();[代码] [代码]// 云函数入口函数[代码][代码]exports.main = (event) => {[代码][代码] [代码][代码]console.log(event);[代码][代码] [代码][代码]return[代码] [代码]cloud.openapi.security[代码][代码] [代码][代码].imgSecCheck({[代码][代码] [代码][代码]media: {[代码][代码] [代码][代码]contentType: [代码][代码]'image/png'[代码][代码],[代码][代码] [代码][代码]value: event.img[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码].then(result => {[代码][代码] [代码][代码]return[代码] [代码]result;[代码][代码] [代码][代码]})[代码][代码] [代码][代码].[代码][代码]catch[代码][代码](err => {[代码][代码] [代码][代码]return[代码] [代码]err;[代码][代码] [代码][代码]})[代码][代码]}[代码] 调用代码如下: [代码]uploadImg: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]this[代码][代码].selectImg().then(img => {[代码][代码] [代码][代码]console.log(img);[代码][代码] [代码][代码]return[代码] [代码]this[代码][代码].imgSecCheck(img);[代码][代码] [代码][代码]}).then(res => {[代码][代码] [代码][代码]console.log([代码][代码]"success:"[代码][代码], res);[代码][代码] [代码][代码]}).[代码][代码]catch[代码][代码](err => {[代码][代码] [代码][代码]console.log([代码][代码]"fail"[代码][代码], err);[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] // 选择图片并转为 buffer [代码] [代码][代码]selectImg: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]wx.chooseImage({[代码][代码] [代码][代码]count: 1,[代码][代码] [代码][代码]sizeType: [[代码][代码]'original'[代码][代码], [代码][代码]'compressed'[代码][代码]],[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]let params = {[代码][代码] [代码][代码]filePath: res.tempFilePaths[0][代码][代码] [代码][代码]};[代码][代码] [代码][代码]wx.getFileSystemManager()[代码][代码] [代码][代码].readFile({[代码][代码] [代码][代码]filePath: res.tempFilePaths[0],[代码][代码] [代码][代码]success: res => {[代码][代码] [代码][代码]console.log([代码][代码]"readSuccess:"[代码][代码], res);[代码][代码] [代码][代码]resolve(res.data);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: err => {[代码][代码] [代码][代码]console.log([代码][代码]"readFail:"[代码][代码], err);[代码][代码] [代码][代码]reject(err);[代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] // 调用云函数[代码] [代码][代码]imgSecCheck: [代码][代码]function[代码][代码](img) {[代码][代码] [代码][代码]return[代码] [代码]wx.cloud.callFunction({[代码][代码] [代码][代码]name: [代码][代码]"imgSecCheck"[代码][代码],[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]img: img[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码]
2019-07-18 - 微信长按识别二维码问题
- 当前 Bug 的表现(可附上截图) 生成的小程序二维码在部分手机的微信聊天页中不能长按识别,而在一些手机就可以。 [图片] [图片] - 预期表现 - 复现路径 - 提供一个最简复现 Demo
2018-11-01 - 小程序 request 乱码问题
发送 request GET 请求,返回的的结果为乱码。代码如下: [代码]wx.request({[代码][代码] [代码][代码]url: 'https:[代码][代码]//wenku.qianjia.com/UploadFile/Document/%E6%99%BA%E8%83%BD%E5%AE%B6%E5%B1%85/%E5%AE%B6%E5%B1%85%E5%AE%89%E9%98%B2%E7%B3%BB%E7%BB%9F/%E8%A7%86%E9%A2%91%E7%9B%91%E6%8E%A7/8bfcbc10ea824fc788b500392a24c930/html/1.html',[代码][代码] [代码][代码]header: { [代码][代码]'content-type'[代码][代码]: [代码][代码]'application/x-www-form-urlencoded;charset=utf-8'[代码] [代码]},[代码][代码] [代码][代码]method: [代码][代码]"GET"[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.debug([代码][代码]"请求详情成功!"[代码][代码]);[代码] [代码] [代码][代码]let html = [代码]res.data[代码];[代码][代码] [代码][代码]console.debug(html);[代码] [代码] [代码][代码]/**[代码][代码] [代码][代码]* 1.数据的绑定键[代码][代码] [代码][代码]* 2.解析数据类型 html/md[代码][代码] [代码][代码]* 3.上下文[代码][代码] [代码][代码]* 4.解析文本中的图片 Padding 值[代码][代码] [代码][代码]* 5.解析文档中的图片的域名路径[代码][代码] [代码][代码]*/[代码][代码] [代码][代码]WxParse.wxParse([代码][代码]'details'[代码][代码], [代码][代码]'html'[代码][代码], html, that, 0, that.data.contentUrl);[代码][代码] [代码][代码]},[代码] [代码] [代码][代码]fail: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]console.debug([代码][代码]"请求详情失败!"[代码][代码]);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete: [代码][代码]function[代码] [代码]() {[代码][代码] [代码][代码]console.debug([代码][代码]"请求详情结束"[代码][代码]);[代码][代码] [代码][代码]wx.hideLoading();[代码][代码] [代码][代码]},[代码][代码] [代码][代码]});[代码] 该请求访问的是一个静态网页,而请求返回的结果在 模拟器上是正常的,而在 Android 手机上则是显示乱码。
2017-10-19