阿凡达

阿凡达平台对接外部渠道,如果渠道方需要使用专用接口,即对接使用渠道方的接口文档。如果渠道方没有定制接口需求,则按照阿凡达平台接口文档规范进行交互


前言

<p>[TOC]</p> <h1>文档目的</h1> <p>华农阿凡达平台对接外部渠道,如果渠道方需要使用专用接口,即对接使用渠道方的接口文档。如果渠道方没有定制接口需求,则按照华农阿凡达平台接口文档规范进行交互</p> <h1>文档说明</h1> <p>文档中必传字段展示,Y标识必传,CY标识条件必传,N标识不必传</p> <h1>注意</h1> <p>投标保证险等保司使用的电子保函、电子保单链接为HTTP请求302的重定向链接,会出现无法直接下载获取的情况,jdk8以上请使用该方法再试一次方可解决403或无法现在电子保单保函的问题</p> <h3>JAVA</h3> <pre><code class="language-java">import java.io.*; import java.net.HttpURLConnection; import java.net.URL; /** * 从网络Url中下载文件并加密成base64 * * @param urlStr * @throws IOException * @return */ public static byte[] downLoadByUrlBase64(String urlStr) throws IOException { URL url = new URL(urlStr); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //设置超时间为3秒 conn.setConnectTimeout(5 * 1000); //302重定向则获取重定向后的地址重新下载 int responseCode = conn.getResponseCode(); if (responseCode == 302) { return downLoadByUrlBase64(conn.getHeaderField(&amp;quot;location&amp;quot;)); } //得到输入流 InputStream inputStream = conn.getInputStream(); //获取自己数组 byte[] getData = readInputStream(inputStream); if (inputStream != null) { inputStream.close(); } return getData; }</code></pre> <h3>PHP</h3> <pre><code class="language-php">function downloadByUrlBase64($urlStr) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $urlStr); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); $data = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); curl_close($ch); if ($httpCode == 302) { return downloadByUrlBase64($data); } else { return base64_encode($data); } }</code></pre> <h3>python</h3> <pre><code class="language-python">import requests import base64 def download_by_url_base64(url): response = requests.get(url, timeout=5) if response.status_code == 302: return download_by_url_base64(response.headers['location']) elif response.status_code != 200: raise Exception('请求失败,HTTP状态码为{}'.format(response.status_code)) else: return base64.b64encode(response.content).decode()</code></pre>

页面列表

ITEM_HTML