微信小程序调用云函数,实现OCR银行卡识别成功拿不到银行卡number,很疑惑?
//选择图片
chooseImage: function(callBack) {
let self = this;
let type = "yinhangka"
wx.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['camera', 'album'],
success: function(res) {
let tempFilePath = res.tempFilePaths[0]
let imgUrl = tempFilePath
self.uploadImg(type,imgUrl)
network.uploadFile(tempFilePath).then(res => {
if (typeof callBack === 'function')
callBack({
tempFilePath,
fjid: res.data.data.fjid
})
})
}
})
},
/* 修改开始 */
// 上传图片到云存储
uploadImg(type, imgUrl) {
let that = this
wx.cloud.uploadFile({
cloudPath: 'add/' + type + '.png',
filePath: imgUrl, // 文件路径
success: res => {
console.log("上传成功", res.fileID)
that.getImgUrl(type, res.fileID)
},
fail: err => {
console.log("上传失败", err)
}
})
},
//获取云存储里的图片url
getImgUrl(type, imgUrl) {
let that = this
wx.cloud.getTempFileURL({
fileList: [imgUrl],
success: res => {
let imgUrl = res.fileList[0].tempFileURL
console.log("获取图片url成功", imgUrl)
that.shibie(type, imgUrl)
},
fail: err => {
console.log("获取图片url失败", err)
}
})
},
//调用云函数,实现OCR识别
shibie(type, imgUrl) {
wx.cloud.callFunction({
name: "add",
data: {
type: type,
imgUrl: imgUrl
},
success(res) {
console.log("识别成功", res)
},
fail(res) {
console.log("识别失败", res)
}
})
},
//上传图片
uploadCard: function(e) {
this.chooseImage(res => {
var item = this.data.item
item.src = res.tempFilePath
this.setData({
item: item
})
this.data.clxxItem = {
fjid: res.fjid,
cllx: item.cllx
}
})
},
已经是成功调用了OCR的银行卡方法,就是拿不到number,这个是为什么呢,网上帖子发出来都有个number的:网上帖子截图如下
希望有大神帮忙解答下