有赞新零售社区

发帖
API使用问题»消息推送,解析不出json

[API调用-其它] 消息推送,解析不出json

木一 08-16 863 浏览 4 评论 | 只看楼主 [打印]
消息id:E20240815090503094506197
源消息:
{"msg":"%7B%22delivery_order%22%3A%5B%5D%2C%22order_promotion%22%3A%7B%22order_discount_fee%22%3A%221.00%22%2C%22item%22%3A%5B%5D%2C%22adjust_fee%22%3A%220.00%22%2C%22order%22%3A%5B%7B%22promotion_type%22%3A%22pointDeduction%22%2C%22sub_promotion_type%22%3A%22%22%2C%22promotion_title%22%3A%22%E7%A7%AF%E5%88%86%E6%8A%B5%E7%8E%B0%22%2C%22coupon_id%22%3A%22%22%2C%22promotion_condition%22%3A%22%22%2C%22promotion_type_name%22%3A%22%E7%A7%AF%E5%88%86%E6%8A%B5%E7%8E%B0%22%2C%22promotion_content%22%3A%22%22%2C%22promotion_id%22%3A0%2C%22discount_fee%22%3A%221.00%22%2C%22promotion_type_id%22%3A256%7D%5D%7D%2C%22refund_order%22%3A%5B%5D%2C%22full_order_info%22%3A%7B%22address_info%22%3A%7B%22self_fetch_info%22%3A%22%22%2C%22delivery_address%22%3A%22%22%2C%22delivery_postal_code%22%3A%22%22%2C%22receiver_name%22%3A%22%22%2C%22delivery_province%22%3A%22%22%2C%22delivery_city%22%3A%22%22%2C%22address_extra%22%3A%22%7B%7D%22%2C%22delivery_district%22%3A%22%22%2C%22receiver_tel%22%3A%22%22%7D%2C%22remark_info%22%3A%7B%22buyer_message%22%3A%22%22%7D%2C%22pay_info%22%3A%7B%22outer_transactions%22%3A%5B%224200002357202408152687478280%22%5D%2C%22post_fee%22%3A%220.00%22%2C%22total_fee%22%3A%221.01%22%2C%22payment%22%3A%220.01%22%2C%22transaction%22%3A%5B%222408150905052624090950%22%5D%7D%2C%22buyer_info%22%3A%7B%22outer_user_id%22%3A%22QOTSgFcC1272585677493534720%22%2C%22buyer_phone%22%3A%22%24OdwTFAJRt7hnVOBj95IwCA%3D%3D%241%24%22%2C%22yz_open_id%22%3A%22jqmzo2Rn609860769449779200%22%2C%22fans_type%22%3A547836%2C%22buyer_id%22%3A14965681%2C%22fans_nickname%22%3A%22%24uvc0%2Fh292TdDrDUAFKp2lQ%3D%3D%241%24%22%2C%22fans_id%22%3A20950314904%7D%2C%22orders%22%3A%5B%7B%22is_cross_border%22%3A%22%22%2C%22outer_item_id%22%3A%2210003%22%2C%22discount_price%22%3A%221.01%22%2C%22item_type%22%3A182%2C%22num%22%3A1%2C%22oid%22%3A%223025632767062704394%22%2C%22title%22%3A%22%E4%BC%9A%E5%91%98%E8%A7%86%E9%A2%91%22%2C%22fenxiao_payment%22%3A%220.00%22%2C%22item_message%22%3A%22%22%2C%22item_no%22%3A%2210003%22%2C%22buyer_messages%22%3A%22%22%2C%22cross_border_trade_mode%22%3A%22%22%2C%22is_present%22%3Afalse%2C%22sub_order_no%22%3A%22%22%2C%22price%22%3A%221.01%22%2C%22fenxiao_price%22%3A%220.00%22%2C%22total_fee%22%3A%221.01%22%2C%22alias%22%3A%222fzl5tj5sc6wb5s%22%2C%22payment%22%3A%220.01%22%2C%22item_barcode%22%3A%22%22%2C%22outer_sku_id%22%3A%2210002%22%2C%22goods_url%22%3A%22https%3A%2F%2Fh5.youzan.com%2Fv2%2Fshowcase%2Fgoods%3Falias%3D2fzl5tj5sc6wb5s%22%2C%22customs_code%22%3A%22%22%2C%22item_id%22%3A3167625116%2C%22sku_properties_name%22%3A%22%5B%7B%5C%22k%5C%22%3A%5C%22%E5%A5%97%E9%A4%90%5C%22%2C%5C%22k_id%5C%22%3A506%2C%5C%22v%5C%22%3A%5C%22%E5%B9%B4%E5%8D%A1%5C%22%2C%5C%22v_id%5C%22%3A372408%7D%5D%22%2C%22sku_id%22%3A25639184026%2C%22pic_path%22%3A%22https%3A%2F%2Fimg01.yzcdn.cn%2Fupload_files%2F2024%2F03%2F15%2FFp6dLwNuzDRvfkboUmii8qMSe_wJ.jpg%22%2C%22sku_no%22%3A%2210002%22%2C%22points_price%22%3A%220%22%2C%22sku_barcode%22%3A%22%22%7D%5D%2C%22source_info%22%3A%7B%22is_offline_order%22%3Afalse%2C%22book_key%22%3A%225f74b71b-6711-4639-aa2c-a43c3ba321ea%22%2C%22source%22%3A%7B%22platform%22%3A%22merchant_3rd%22%2C%22wx_entrance%22%3A%22direct_buy%22%7D%7D%2C%22order_info%22%3A%7B%22consign_time%22%3A%22%22%2C%22order_extra%22%3A%7B%22is_from_cart%22%3A%22false%22%2C%22is_points_order%22%3A%220%22%7D%2C%22created%22%3A%222024-08-15+09%3A05%3A05%22%2C%22status_str%22%3A%22%E5%B7%B2%E6%94%AF%E4%BB%98%22%2C%22expired_time%22%3A%222024-08-15+10%3A05%3A05%22%2C%22success_time%22%3A%22%22%2C%22type%22%3A0%2C%22confirm_time%22%3A%22%22%2C%22tid%22%3A%22E20240815090503094506197%22%2C%22pay_time%22%3A%222024-08-15+09%3A05%3A18%22%2C%22update_time%22%3A%222024-08-15+09%3A05%3A18%22%2C%22is_retail_order%22%3Afalse%2C%22team_type%22%3A0%2C%22pay_type%22%3A19%2C%22refund_state%22%3A0%2C%22close_type%22%3A0%2C%22order_tags%22%3A%7B%22is_virtual%22%3Atrue%2C%22is_member%22%3Atrue%2C%22is_secured_transactions%22%3Atrue%2C%22is_payed%22%3Atrue%7D%2C%22express_type%22%3A9%2C%22status%22%3A%22TRADE_PAID%22%7D%7D%7D","kdt_name":"慧树优品商城","test":false,"sign":"c36cfb4ad4fbfe462aacf788fb777587","type":"trade_TradePaid","sendCount":1,"version":1723683918,"client_id":"d3dd5cc2bf70042f59","mode":1,"kdt_id":137048027,"id":"E20240815090503094506197","msg_id":"61a078fa-4a25-49c2-839b-32a69d9eacd0","root_kdt_id":137048027,"status":"TRADE_PAID"}


url解码后:
{
    "msg": "{"delivery_order":[],"order_promotion":{"order_discount_fee":"1.00","item":[],"adjust_fee":"0.00","order":[{"promotion_type":"pointDeduction","sub_promotion_type":"","promotion_title":"积分抵现","coupon_id":"","promotion_condition":"","promotion_type_name":"积分抵现","promotion_content":"","promotion_id":0,"discount_fee":"1.00","promotion_type_id":256}]},"refund_order":[],"full_order_info":{"address_info":{"self_fetch_info":"","delivery_address":"","delivery_postal_code":"","receiver_name":"","delivery_province":"","delivery_city":"","address_extra":"{}","delivery_district":"","receiver_tel":""},"remark_info":{"buyer_message":""},"pay_info":{"outer_transactions":["4200002357202408152687478280"],"post_fee":"0.00","total_fee":"1.01","payment":"0.01","transaction":["2408150905052624090950"]},"buyer_info":{"outer_user_id":"QOTSgFcC1272585677493534720","buyer_phone":"$OdwTFAJRt7hnVOBj95IwCA==$1$","yz_open_id":"jqmzo2Rn609860769449779200","fans_type":547836,"buyer_id":14965681,"fans_nickname":"$uvc0/h292TdDrDUAFKp2lQ==$1$","fans_id":20950314904},"orders":[{"is_cross_border":"","outer_item_id":"10003","discount_price":"1.01","item_type":182,"num":1,"oid":"3025632767062704394","title":"会员视频","fenxiao_payment":"0.00","item_message":"","item_no":"10003","buyer_messages":"","cross_border_trade_mode":"","is_present":false,"sub_order_no":"","price":"1.01","fenxiao_price":"0.00","total_fee":"1.01","alias":"2fzl5tj5sc6wb5s","payment":"0.01","item_barcode":"","outer_sku_id":"10002","goods_url":"https://h5.youzan.com/v2/showcase/goods?alias=2fzl5tj5sc6wb5s","customs_code":"","item_id":3167625116,"sku_properties_name":"[{\"k\":\"套餐\",\"k_id\":506,\"v\":\"年卡\",\"v_id\":372408}]","sku_id":25639184026,"pic_path":"https://img01.yzcdn.cn/upload_files/2024/03/15/Fp6dLwNuzDRvfkboUmii8qMSe_wJ.jpg","sku_no":"10002","points_price":"0","sku_barcode":""}],"source_info":{"is_offline_order":false,"book_key":"5f74b71b-6711-4639-aa2c-a43c3ba321ea","source":{"platform":"merchant_3rd","wx_entrance":"direct_buy"}},"order_info":{"consign_time":"","order_extra":{"is_from_cart":"false","is_points_order":"0"},"created":"2024-08-15+09:05:05","status_str":"已支付","expired_time":"2024-08-15+10:05:05","success_time":"","type":0,"confirm_time":"","tid":"E20240815090503094506197","pay_time":"2024-08-15+09:05:18","update_time":"2024-08-15+09:05:18","is_retail_order":false,"team_type":0,"pay_type":19,"refund_state":0,"close_type":0,"order_tags":{"is_virtual":true,"is_member":true,"is_secured_transactions":true,"is_payed":true},"express_type":9,"status":"TRADE_PAID"}}}",
    "kdt_name": "慧树优品商城",
    "test": false,
    "sign": "c36cfb4ad4fbfe462aacf788fb777587",
    "type": "trade_TradePaid",
    "sendCount": 1,
    "version": 1723683918,
    "client_id": "d3dd5cc2bf70042f59",
    "mode": 1,
    "kdt_id": 137048027,
    "id": "E20240815090503094506197",
    "msg_id": "61a078fa-4a25-49c2-839b-32a69d9eacd0",
    "root_kdt_id": 137048027,
    "status": "TRADE_PAID"
}


但是解码后的消息,解析不成json。用hutool工具,
URLUtil.decode(json);

本帖最后由 木一 于 2024-8-16 10:10 编辑
用手机打开
收藏 ··· 回复
    尊敬的有赞用户 您好,我们已收到您的问题,并已安排相关技术支持正在处理中,请耐心等待。您可以关注之前预留的邮箱seattlerain@ye注意问题解决进度提醒邮件。

      您好,msg是被urlencode过的,开发者接收消息成功后,需要进行一次urldecode。
      参考https://doc.youzanyun.com/resource/doc/3406/3926
      • 木一 08-16
        我已经urldecode了啊,看我decode之后的数据,不对啊。不能转成json.
      • 千寻 回复 木一 08-16
        您好,这测试是可以的,您在试下%7B%22delivery_order%22%3A%5B%5D%2C%22order_promotion%22%3A%7B%22order_discount_fee%22%3A%221.00%22%2C%22item%22%3A%5B%5D%2C%22adjust_fee%22%3A%220.00%22%2C%22order%22%3A%5B%7B%22promotion_type%22%3A%22pointDeduction%22%2C%22sub_promotion_type%22%3A%22%22%2C%22promotion_title%22%3A%22%E7%A7%AF%E5%88%86%E6%8A%B5%E7%8E%B0%22%2C%22coupon_id%22%3A%22%22%2C%22promotion_condition%22%3A%22%22%2C%22promotion_type_name%22%3A%22%E7%A7%AF%E5%88%86%E6%8A%B5%E7%8E%B0%22%2C%22promotion_content%22%3A%22%22%2C%22promotion_id%22%3A0%2C%22discount_fee%22%3A%221.00%22%2C%22promotion_type_id%22%3A256%7D%5D%7D%2C%22refund_order%22%3A%5B%5D%2C%22full_order_info%22%3A%7B%22address_info%22%3A%7B%22self_fetch_info%22%3A%22%22%2C%22delivery_address%22%3A%22%22%2C%22delivery_postal_code%22%3A%22%22%2C%22receiver_name%22%3A%22%22%2C%22delivery_province%22%3A%22%22%2C%22delivery_city%22%3A%22%22%2C%22address_extra%22%3A%22%7B%7D%22%2C%22delivery_district%22%3A%22%22%2C%22receiver_tel%22%3A%22%22%7D%2C%22remark_info%22%3A%7B%22buyer_message%22%3A%22%22%7D%2C%22pay_info%22%3A%7B%22outer_transactions%22%3A%5B%224200002357202408152687478280%22%5D%2C%22post_fee%22%3A%220.00%22%2C%22total_fee%22%3A%221.01%22%2C%22payment%22%3A%220.01%22%2C%22transaction%22%3A%5B%222408150905052624090950%22%5D%7D%2C%22buyer_info%22%3A%7B%22outer_user_id%22%3A%22QOTSgFcC1272585677493534720%22%2C%22buyer_phone%22%3A%22%24OdwTFAJRt7hnVOBj95IwCA%3D%3D%241%24%22%2C%22yz_open_id%22%3A%22jqmzo2Rn609860769449779200%22%2C%22fans_type%22%3A547836%2C%22buyer_id%22%3A14965681%2C%22fans_nickname%22%3A%22%24uvc0%2Fh292TdDrDUAFKp2lQ%3D%3D%241%24%22%2C%22fans_id%22%3A20950314904%7D%2C%22orders%22%3A%5B%7B%22is_cross_border%22%3A%22%22%2C%22outer_item_id%22%3A%2210003%22%2C%22discount_price%22%3A%221.01%22%2C%22item_type%22%3A182%2C%22num%22%3A1%2C%22oid%22%3A%223025632767062704394%22%2C%22title%22%3A%22%E4%BC%9A%E5%91%98%E8%A7%86%E9%A2%91%22%2C%22fenxiao_payment%22%3A%220.00%22%2C%22item_message%22%3A%22%22%2C%22item_no%22%3A%2210003%22%2C%22buyer_messages%22%3A%22%22%2C%22cross_border_trade_mode%22%3A%22%22%2C%22is_present%22%3Afalse%2C%22sub_order_no%22%3A%22%22%2C%22price%22%3A%221.01%22%2C%22fenxiao_price%22%3A%220.00%22%2C%22total_fee%22%3A%221.01%22%2C%22alias%22%3A%222fzl5tj5sc6wb5s%22%2C%22payment%22%3A%220.01%22%2C%22item_barcode%22%3A%22%22%2C%22outer_sku_id%22%3A%2210002%22%2C%22goods_url%22%3A%22https%3A%2F%2Fh5.youzan.com%2Fv2%2Fshowcase%2Fgoods%3Falias%3D2fzl5tj5sc6wb5s%22%2C%22customs_code%22%3A%22%22%2C%22item_id%22%3A3167625116%2C%22sku_properties_name%22%3A%22%5B%7B%5C%22k%5C%22%3A%5C%22%E5%A5%97%E9%A4%90%5C%22%2C%5C%22k_id%5C%22%3A506%2C%5C%22v%5C%22%3A%5C%22%E5%B9%B4%E5%8D%A1%5C%22%2C%5C%22v_id%5C%22%3A372408%7D%5D%22%2C%22sku_id%22%3A25639184026%2C%22pic_path%22%3A%22https%3A%2F%2Fimg01.yzcdn.cn%2Fupload_files%2F2024%2F03%2F15%2FFp6dLwNuzDRvfkboUmii8qMSe_wJ.jpg%22%2C%22sku_no%22%3A%2210002%22%2C%22points_price%22%3A%220%22%2C%22sku_barcode%22%3A%22%22%7D%5D%2C%22source_info%22%3A%7B%22is_offline_order%22%3Afalse%2C%22book_key%22%3A%225f74b71b-6711-4639-aa2c-a43c3ba321ea%22%2C%22source%22%3A%7B%22platform%22%3A%22merchant_3rd%22%2C%22wx_entrance%22%3A%22direct_buy%22%7D%7D%2C%22order_info%22%3A%7B%22consign_time%22%3A%22%22%2C%22order_extra%22%3A%7B%22is_from_cart%22%3A%22false%22%2C%22is_points_order%22%3A%220%22%7D%2C%22created%22%3A%222024-08-15+09%3A05%3A05%22%2C%22status_str%22%3A%22%E5%B7%B2%E6%94%AF%E4%BB%98%22%2C%22expired_time%22%3A%222024-08-15+10%3A05%3A05%22%2C%22success_time%22%3A%22%22%2C%22type%22%3A0%2C%22confirm_time%22%3A%22%22%2C%22tid%22%3A%22E20240815090503094506197%22%2C%22pay_time%22%3A%222024-08-15+09%3A05%3A18%22%2C%22update_time%22%3A%222024-08-15+09%3A05%3A18%22%2C%22is_retail_order%22%3Afalse%2C%22team_type%22%3A0%2C%22pay_type%22%3A19%2C%22refund_state%22%3A0%2C%22close_type%22%3A0%2C%22order_tags%22%3A%7B%22is_virtual%22%3Atrue%2C%22is_member%22%3Atrue%2C%22is_secured_transactions%22%3Atrue%2C%22is_payed%22%3Atrue%7D%2C%22express_type%22%3A9%2C%22status%22%3A%22TRADE_PAID%22%7D%7D%7D

      1跳至
      您需要登录后才可以回帖 登录 | 立即注册

      本版积分规则

      复制链接
      新浪微博
      QQ空间
      微信扫码
      • 回复

      • 评分

      客服工作时间是9:00-18:00,客服妹子当前不在线,若不能及时回复请谅解。试试右上角的搜索吧,论坛有丰富的经验贴、公告贴,相信一定能够帮到您~

      复制成功