- 身份证OCR识别 img_url 41005错误?
身份证识别,POST https://api.weixin.qq.com/cv/ocr/idcard?access_token=ACCESS_TOKEN 接口 图片地址是http://xxxx:8001/xxx.png 查询后说是图片无效,也无法上传至微信获取"media_id",因为我的是身份证识别,微信要求是 media_id(目前只用于品牌申请品牌和类目),1:返回链接, 2:返回微信支付media_id图片, 文档中有些参数根本没有提到,比如type 代码片段: public synchronized String OCRIdCard(@RequestParam("OCRCard") MultipartFile OCRCard,HttpServletRequest request) throws IOException { //上传图片并返回图片地址 // String data = icommissionService.upPicture(OCRCard).getData(); // System.out.println(data); HashMap map = new HashMap(); String url = "https://api.weixin.qq.com/cv/ocr/idcard?type=photo&access_token=" + getToken(request); map.put("img_url","http://xxx:8001/xxx.png"); String post = sendGetOrPost.doGetPost(url, "POST", map); System.out.println("请求结果"); System.out.println(post); JSONObject jsonObject = JSONObject.parseObject(post); Integer errcode = Integer.valueOf(jsonObject.getString("errcode")); if (errcode.equals("0")){ System.out.println("识别成功"); System.out.println(jsonObject.toJSONString()); } return null; }
09-05 - wx.uploadfile的回调中可以赋值也能打印,但出了success回调打印undefined?
我是做后端的,对前端懂一点,有没有大佬帮我指正一下,我在uploadfile的success中赋值打印没有问题,但是在回调成功外层在打印就拿不到值,let、var定义变量都试过,that=this调用setData也试过,但在回调外层都拿不到值,后台可以确认没有问题 这是代码 let imgtemp1 = ''; wx.uploadFile({ url:'http://localhost:10101/commission/commission/upPicture', filePath: imagepath, name: 'file', formData: { 'user': 'test' }, success: function (res) { console.log(res,"上传图片结果"); imgtemp1 = res.data console.log(imgtemp1); // _that.setData({ // imgtemp:imgtemp1 // }) // _that.imgtemp = res.data // console.log(_that.imgtemp); }, fail: function(err){ console.log(err,"上传文件出错"); } }) console.log(imgtemp1); [图片] 这是打印 other.js:347 other.js:413 {data: true, header: {…}, statusCode: 200, cookies: Array(0), errMsg: "request:ok"} "asdasdasdasdasdsa" other.js:334 {statusCode: 200, data: "http://172.21.xx.xx/2024031973.png", header: {…}, cookies: Array(0), errMsg: "uploadFile:ok"} "上传图片结果" other.js:336 http://172.21.xx.xx/2024031973.png
03-19