🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
**本地厂商车场在广告位获取广告的接口 显示广告的接口** * 根据条件获取要显示的车场 * @param cityCode 当前广告的车场 * @param parkType 车场类型 * @param carType 汽车类型 * @param parkId 车场唯一id * @param adPosId 广告位id * @param plateNumber 车牌号 * @param clientId 用户id,写入用户里的随机cookieid,用来计算uv. * @param orderId 订单id,能反查出来订单号,如果没有就不写. * @param addPv 是否写一条pv http://s.bolink.club/bolinkad/showad?params=base64(cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&addPv=true) 这个接口的参数params是通过Base64编码后的 比如: params = "cityCode=110100&parkType=1&carType=1&parkId=1&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&addPv=true"; 通过params进行Base64编码: BASE64Encoder encoder = new BASE64Encoder(); byte[] textByte = params.getBytes("UTF-8"); String encodedText = encoder.encode(textByte); 编码后: encodedText=Y2l0eUNvZGU9MTEwMTAwJnBhcmtUeXBlPTEmY2FyVHlwZT0xJnBhcmtJZD0xJmFkUG9zSWQ9MSZwbGF0ZU51bWJlcj3kuqxEMTEyMTEmY2xpZW50SWQ9MjMzMjQyNDIzNDIzNHNhZnNhJm9yZGVySWQ9MzQzNDM0MzQzNDM0MzQzNDM0MyZhZGRQdj10cnVl 对encodeText进行解码: BASE64Decoder decoder = new BASE64Decoder(); String params = new String(decoder.decodeBuffer(encodedText), "UTF-8"); 解码后: params = "cityCode=110100&parkType=1&carType=1&parkId=1&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&addPv=true"; //解决乱码问题 String paramStr = URLDecoder.decode(param, "utf-8"); 调用接口后,手机上显示这个页面 ![](https://box.kancloud.cn/b6cf83b092398e3df0d22d661ebb51cd_199x352.png) | 参数名 | 数据类型 | 参数含义| | --- | --- | --- | cityCode|long| 车场城市id,http://www.mca.gov.cn/article/sj/xzqh/2018/201804-12/20180608021501.html| parkType |long |车场类型| carType| long| 汽车类型| parkId| long |本地车场唯一id | adPosId| long |广告位id| plateNumber |String |车牌号| clientId |String| 用户id,写入用户里的随机cookieid,用来计算uv| orderId |String |订单id,能反查出来订单号,如果没有就不写 | addPv|boolean |是否写一条记录| **点击广告接口** * 广告点击统计,用户点击到这里统计点击,然后跳到相应的url * * @param cityCode 当前广告的车场 * @param parkType 车场类型 * @param carType 汽车类型 * @param parkId 车场唯一id * @param adPosId 广告位id * @param plateNumber 车牌号 * @param clientId 用户id,写入用户里的随机cookieid,用来计算uv. * @param orderId 订单id,泊链的订单id,能反查出来订单号,如果没有就不写. * @param adId 广告id http://s.bolink.club/bolinkad/clickad?params=base64(cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&adId=105) 这个接口的参数params是通过Base64编码后的 比如: params = "cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&adId=105"; 通过params进行Base64编码: BASE64Encoder encoder = new BASE64Encoder(); byte[] textByte = params.getBytes("UTF-8"); String encodedText = encoder.encode(textByte); 编码后: encodedText=Y2l0eUNvZGU9MTEwMTAwJnBhcmtUeXBlPTEmY2FyVHlwZT0xJnBhcmtJZD0xJmFkUG9zSWQ9MiZwbGF0ZU51bWJlcj3kuqxEMTEyMTEmY2xpZW50SWQ9MjMzMjQyNDIzNDIzNHNhZnNhJm9yZGVySWQ9MzQzNDM0MzQzNDM0MzQzNDM0MyZhZElkPTEwNQ== 对encodeText进行解码: BASE64Decoder decoder = new BASE64Decoder(); String params = new String(decoder.decodeBuffer(encodedText), "UTF-8"); 解码后: params = "cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&adId=105"; //解决乱码问题 String paramStr = URLDecoder.decode(param, "utf-8"); ![](https://box.kancloud.cn/daec07e629b5f58287e49beae810ea14_192x336.png) **广告显示接口** (http://s.bolink.club/bolinkad/showad?params=base64(cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&addPv=true))返回参数: clickUrl: (点击图片时的路径) "https://s.bolink.club/bolinkad/clickad?cityCode=110100&parkType=1&carType=1&parkId=21450&adPosId=1&plateNumber=京D11211&clientId=2332424234234safsa&orderId=3434343434343434343&adId=105" pic: (图片路径) "https://image.bolink.club/FoJs1WIAgniQo6ULQ0OJ_ufjjrFx" **该图片显示的代码:** ``` <a data-v-3d1a5cb8="" target="_blank" href="https://s.bolink.club/bolinkad/clickad?cityCode=110100&amp;parkType=1&amp;carType=1&amp;parkId=21450&amp;adPosId=1&amp;plateNumber=京D11211&amp;clientId=2332424234234safsa&amp;orderId=3434343434343434343&amp;adId=105"><img data-v-3d1a5cb8="" src="https://image.bolink.club/FoJs1WIAgniQo6ULQ0OJ_ufjjrFx" style="width: 300px;"></a> ``` | 参数名 | 数据类型 | 参数含义| | --- | --- | --- | cityCode |long| 车场城市id,http://www.mca.gov.cn/article/sj/xzqh/2018/201804-12/20180608021501.html| parkType |long|车场类型| carType |long| 汽车类型| parkId| long |本地车场唯一id| adPosId |long|广告位id| plateNumber |String|车牌号 | clientId |String|用户id,写入用户里的随机cookieid,用来计算uv | orderId |String|订单id,能反查出来订单号,如果没有就不写 | adId |Integer|订单id,能反查出来订单号,如果没有就不写 |