export const ocrAction = async (filePath: string) => {
wx.showLoading({
title: "正在处理",
})
let img_url = await tempFilePathToBase64(filePath)
console.log('%c 😐 [ img_url ]-510', 'font-size:15px; background:#7B479A; color:#4DAB55;', img_url, typeof img_url);
try {
const res = await wx.serviceMarket.invokeService({
api: "OcrAllInOne",
service: "wx79ac3de8be320b71",
data: {
img_url: img_url,
data_type: 2,
ocr_type: 10,
},
})
console.log('%c 😠 [ ocrAction res ]-699', 'font-size:15px; background:#4BCD23; color:#9B1033;', res);
wx.hideLoading()
} catch (e) {
console.log('%c 🙌 [ ocrAction e ]-91', 'font-size:15px; background:#CEF45D; color:#7D8CF5;', e);
wx.hideLoading()
throw e
}
}


你好,可以参考:https://developers.weixin.qq.com/community/develop/doc/0002a49c82cae0be8bd2635a466000?highLine=invokeService%253Afail