调用最新OCR接口出现的重大问题,求解决?
发布于 6 年前 作者 cjia 8682 次浏览 来自 官方Issues
changeImg() {
    // let self = this
    wx.chooseImage({
      count:1,
      successfunction (res{
        console.log(res);
        // self.setData({
        //   hasUpload: true,
        //   uploadFile: res.tempFilePaths[0],
        //   'list.EmployeePhoto': res.tempFilePaths[0]
        // })
        var d = Date.now()
        wx.serviceMarket.invokeService({
          service'wx79ac3de8be320b71'// 'wx_mp_appid',
          api'OcrAllInOne',
          data: {
            img_url: res.tempFilePaths[0],
            data_type3,
            ocr_type1,
          },
        }).then(res => {
          console.log(res)
          console.log('invokeService success', res)
          wx.showModal({
            title'cost',
            content: (Date.now() - d) + '',
          })
        }).catch(err => {
          console.error('invokeService fail', err)
          wx.showModal({
            title'fail',
            content: err + '',
          })
        })
      },
      failfunction (err{
        console.error(err)
      },
    })
  },

上传身份证图片出现这个报错,我是按照官方文档给的例子写的,而且我也购买了这个接口,这是啥原因

1 回复

你好,例子有点问题,我们后续更正一下,url不支持填filepath,需要填写真实url,例如:”http://www.qq.com/xxx.jpg"

回到顶部