|
@@ -1,2313 +0,0 @@
|
|
|
-[TOC]
|
|
|
-
|
|
|
-# HHAROME接入文档
|
|
|
-
|
|
|
-## 更新日志
|
|
|
-
|
|
|
-2024/2/2 更新初始化刷脸,及传参
|
|
|
-2024/2/18 更新小程序调试流程和命令
|
|
|
-2024/2/20 更新scope注意点
|
|
|
-2024/3/8 新增小程序登录代码逻辑、获取设备参数
|
|
|
-2024/3/15 新增刷脸1:1人证
|
|
|
-2024/3/19 新增语音播报
|
|
|
-2024/3/25 更新常见问题
|
|
|
-2024/3/26 新增手输身份证号和小票打印
|
|
|
-2024/3/27 开启刷二维码监听和刷身份证监听
|
|
|
-2024/4/16 更新常见问题
|
|
|
-2024/4/23 新增刷证超时和取消、麦克风录音
|
|
|
-2024/5/6 新增麦克风录音状态、红外感应
|
|
|
-2024/5/9 新增小程序超时
|
|
|
-2024/5/12 版式调整
|
|
|
-2024/5/13 调整红外感应
|
|
|
-2024/6/7 令牌授权的应用不相符问题新增解决方案。预览命令
|
|
|
-2024/6/18 新增语音播报最新和语音停止。更新常见问题——物联网卡导致无法进入小程序
|
|
|
-2024/6/19 更新常见问题——刷脸初始化失败提示E69015的解决方案
|
|
|
-2024/6/24 新增功能双屏异现
|
|
|
-2024/6/25 更新常见问题——设备连接有线网络无法进入小程序
|
|
|
-2024/6/25 新增社保卡读取功能
|
|
|
-2024/6/28 新增NFC
|
|
|
-2024/7/01 更新常见问题——读取身份证问题
|
|
|
-2024/7/08 更新常见问题
|
|
|
-2024/7/16 关闭小程序、显示/隐藏导航栏,禁用/启用通知栏(本次运行有效)
|
|
|
-2024/7/18 刷脸入库功能
|
|
|
-2024/7/22 更新常见问题
|
|
|
-2024/7/29 麦克风功能改版,发送源数据格式从MP3改为PCM,传送方式改为实时传送。
|
|
|
-2024/7/31 更新红外感应问题
|
|
|
-2024/8/01 CPU卡添加APDU命令数组执行能力。
|
|
|
-2024/8/12 麦克风持续监听添加新的返回数据结构。
|
|
|
-2024/8/14 更新常见问题——读取身份证问题、小票打印机。
|
|
|
-2024/09/12 新增新的身份证阅读器模块。
|
|
|
-2024/09/13 新增启动小程序时可配置跳转指定小程序页面。
|
|
|
-2024/09/18 新增右上角悬浮按钮,关闭指定appId小程序。
|
|
|
-## 小程序真机调试
|
|
|
-
|
|
|
-开发工具:支付宝小程序开发工具
|
|
|
-
|
|
|
-1. 开发环境安装node,检查版本 >= 16
|
|
|
-2. 安装minidev插件,文档地址:<https://opendocs.alipay.com/mini/02q17j>
|
|
|
- 1. 安装插件 npm i -g minidev --registry=<https://registry.npmmirror.com>
|
|
|
- 2. 更新插件(按需即可) npm update -g minidev && minidev -v
|
|
|
- 3. 工具授权,终端输入minidev login,小程序开发者支付宝扫码授权
|
|
|
-3. 发起真机预览 (预览当前的开发代码)
|
|
|
- 1. 终端指令:minidev remote-debug -c ampe -a \[miniprogram\_appid] --ampe-device-id \[machine\_sn] --ampe-product-id \[machine\_ productId] --ampe-host-app-id \[ampe\_appid]
|
|
|
- 2. 示例调试指令:minidev remote-debug -c ampe -a ==2021004113634033(改成服务商需要调试的小程序appid)== --ampe-device-id ==13AK008002200004(改成服务商设备的sn号)== --ampe-product-id 9705850 --ampe-host-app-id 2021004108608975
|
|
|
- 3. 预览指令:minidev preview -c ampe -a ==2021004113634033(改成服务商需要调试的小程序appid)== --ampe-device-id ==13AK008002200004(改成服务商设备的sn号)== --ampe-product-id 9705850 --ampe-host-app-id 2021004108608975
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-## 小程序接入代码
|
|
|
-
|
|
|
-### 一. 消息发送接收主函数
|
|
|
-
|
|
|
-```javascript
|
|
|
-/******* my.call方法支持小程序发送指令对象 params 给 app ,app 处理完后通过 res 返回,单次有效 *******/
|
|
|
-my.call('ampeHHCommunication', params , res => {
|
|
|
- console.log(res)
|
|
|
-});
|
|
|
-
|
|
|
-/******* my.on方法支持小程序打开一个持续监听方法,app 会持续发送数据 res *******/
|
|
|
-my.on('xxxxxxxxxx', res => {
|
|
|
- console.log(res)
|
|
|
-});
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-### 二. params指令对象列表
|
|
|
-
|
|
|
-#### 请求参数
|
|
|
-
|
|
|
-| 字段 | 是否必填 | 类型 | 说明 |
|
|
|
-| ------ | -------- | ------ | ------------------------------------------------------------------------------------------------------------------------ |
|
|
|
-| action | 是 | String | getQRCode---------二维码,<br />getIDCardInfo-----身份证,<br />getFaceInfo---------刷脸,<br />getDeviceInfo------设备信息 |
|
|
|
-| event | 是 | String | open-开启/close-关闭 |
|
|
|
-| taskId | 是 | String | 任务id耗时任务时与其他任务区分比对用 |
|
|
|
-| params | 是 | Object | 配置参数,见下文 |
|
|
|
-
|
|
|
-#### 返回参数
|
|
|
-
|
|
|
-| 字段 | 是否必填 | 类型 | 说明 |
|
|
|
-| ------- | -------- | ------- | ------------------------- |
|
|
|
-| action | 是 | String | 与请求action对应 |
|
|
|
-| event | 是 | String | 与请求event对应 |
|
|
|
-| taskId | 是 | String | 与请求taskId对应 |
|
|
|
-| success | 是 | boolean | success-成功 / false-失败 |
|
|
|
-| message | 是 | String | 结果描述 |
|
|
|
-| data | 是 | Object | 返回结果数据 |
|
|
|
-
|
|
|
-==指令是否成功执行可根据 success 参数判断==
|
|
|
-
|
|
|
-==true----解析 data==
|
|
|
-
|
|
|
-==false---处理 message==
|
|
|
-
|
|
|
-#### 1. 刷脸指令
|
|
|
-
|
|
|
-##### 1.1 初始化
|
|
|
-
|
|
|
-```javascript
|
|
|
-/***建议在 app.js 的onLaunch 钩子里执行一次初始化即可(若失败,可以执行 3s 再次尝试初始化操作)***/
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "initFace",
|
|
|
- "event": "open",
|
|
|
- "taskId": "12345",
|
|
|
- "params": {
|
|
|
- "serviceId": "",
|
|
|
- "query": "",
|
|
|
- "scope": "auth_user,yingpin"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| --------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- | -------- |
|
|
|
-| scope | String | 聚合授权参数,scope的值如果有多个,逗号后不要有空格,避免产生弹框不出来或者没有对应要授权的信息展示。<br />正确值示例:auth\_user,yingpin | 必填 |
|
|
|
-| serviceId | String | 刷脸参数,无特殊需要不填 | 非必填 |
|
|
|
-| query | String | 刷脸参数,无特殊需要不填 | 非必填 |
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-初始化调用后约两秒后返回结果,注意增加友好提示
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "initFace",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "12345",
|
|
|
- "message ": "成功",
|
|
|
- "data": {}
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定,taskId可自定义
|
|
|
-
|
|
|
-##### 1.2 唤起 1:N 刷脸
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "2"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-/***extInfo中的authCode就是对应刷脸返回的结果,用来获取用户信息必备值
|
|
|
-注意。刷脸失败的时候,success为false,需要展示下messge,防止看起来刷脸了,但没有反应和提示***/
|
|
|
-
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "2",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "alipayUid": "2088612116677214",
|
|
|
- "code": 1000,
|
|
|
- "extInfo": "{\"authCode\":\"5dc39621fe5a49deb21a87c98876HA21\"}",
|
|
|
- "ftoken": "fp19bcc44f3a8be610d4d6833607201ah99",
|
|
|
- "isvResult": true,
|
|
|
- "subCode": "",
|
|
|
- "subMessage": "",
|
|
|
- "vid": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-刷脸成功后,会返回authcode(extInfo参数中),然后再去调用支付宝接口获取用户信息
|
|
|
-需要开发商自己申请带有用户信息三要素权限
|
|
|
-https://opendocs.alipay.com/open/a74a7068_alipay.user.info.share?pathHash=af2476d4
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-刷脸失败,在data里会有originFaceInfo字段,里面是支付宝刷脸返回所有的信息
|
|
|
-
|
|
|
-
|
|
|
-##### 1.3 唤起 1: 1 刷脸
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getFaceInfoPersonCard",
|
|
|
- "event": "open",
|
|
|
- "taskId": "7",
|
|
|
- "params": {
|
|
|
- "certName": "",
|
|
|
- "certNo": "",
|
|
|
- "certPhotoBase64Str": ""
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ------------------ | ------ | -------------- | -------- |
|
|
|
-| certName | String | 用户姓名 | 必填 |
|
|
|
-| certNo | String | 用户身份证号 | 必填 |
|
|
|
-| certPhotoBase64Str | String | 用户头像base64 | 非必填 |
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getFaceInfoPersonCard",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "7",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "alipayUid": "2088612116677214",
|
|
|
- "code": 1000,
|
|
|
- "extInfo": "{\"authCode\":\"\"}",
|
|
|
- "ftoken": "fp19bcc44f3a8be610d4d6833607201ah99",
|
|
|
- "isvResult": true,
|
|
|
- "subCode": "",
|
|
|
- "subMessage": "",
|
|
|
- "vid": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-注意。刷脸失败的时候,success为false,需要展示下messge,防止看起来刷脸了,但没有反应和提示
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-##### 1.4.1 刷脸入库
|
|
|
-
|
|
|
-仅适用于刷脸信息授权开通
|
|
|
-(1)通过 authCode 获取 auth_token
|
|
|
-商家服务端调用 [alipay.system.oauth.token](https://opendocs.alipay.com/open/02xtla)(换取授权访问令牌),通过 authCode 换取 auth_token 。authCode 作为换取 access_token 的票据,authCode 只能使用一次,24 小时未被使用将自动过期。可查看 换取 access_token 和 userId。
|
|
|
-(2)通过 auth_token 获取用户会员信息
|
|
|
-商家服务端调用 [alipay.user.info.share](https://opendocs.alipay.com/open/02xtlb)(支付宝会员授权信息查询接口),通过 access_token 获取用户的 userId、昵称、头像等基础信息及手机号、身份证号、姓名等隐私信息。可查看 获取用户信息。
|
|
|
-(3)记录授权成功后的返回参数中[vid]字段,用于绑定关系(授权用户信息:例如姓名、身份证等等)来实现自身业务。
|
|
|
-(4)机构用户出库
|
|
|
- [alipay.open.iotvsp.user.delete](https://opendocs.alipay.com/pre-apis/034a9i)(机构用户出库)
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "doStorageFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "7",
|
|
|
- "params": {
|
|
|
- "appid": "",
|
|
|
- "orgOutId": "",
|
|
|
- "componentOutId": "",
|
|
|
- "isvPid": ""
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| -------------- | ------ | ------------------------------------------------- | -------- |
|
|
|
-| appid | String | 商户appid | 必填 |
|
|
|
-| orgOutId | String | 机构编码 | 必填 |
|
|
|
-| componentOutId | String | 组件编码,示例:老年食堂(day_label_sign_online) | 必填 |
|
|
|
-| isvPid | String | 支付宝平台ISV的PID | 必填 |
|
|
|
-
|
|
|
-**注意:下方返回值中data对应的是JSONString,解析格式需注意 !!!**
|
|
|
-
|
|
|
-**返回值:新用户同意授权**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "doStorageFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "7",
|
|
|
- "message ": "成功",
|
|
|
- "data": "{
|
|
|
- "eventType": "rocketResult",
|
|
|
- "eventData": {
|
|
|
- "uid": "",
|
|
|
- "ftoken": "",
|
|
|
- "authCode": "",
|
|
|
- "vid": "",
|
|
|
- "subCode": "SUCCESS",
|
|
|
- "subMessage": "成功",
|
|
|
- "bizId": ""
|
|
|
- }
|
|
|
- }"
|
|
|
-}
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-**返回值:老用戶**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "doStorageFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "7",
|
|
|
- "message ": "成功",
|
|
|
- "data": "{
|
|
|
- "eventType": "rocketResult",
|
|
|
- "eventData": {
|
|
|
- "ftoken": "",
|
|
|
- "uid": "",
|
|
|
- "vid": "",
|
|
|
- "subCode": "SUCCESS",
|
|
|
- "subMessage": "成功"
|
|
|
- }
|
|
|
- }"
|
|
|
-}
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:新用户拒绝授权**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "doStorageFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "success": false,
|
|
|
- "taskId": "7",
|
|
|
- "message ": "失败",
|
|
|
- "data": "{
|
|
|
- "eventType": "rocketResult",
|
|
|
- "eventData": {
|
|
|
- "uniqueId": "5644040309543232",
|
|
|
- "subCode": "90001",
|
|
|
- "subMessage": "请走上传个人信息的链路"
|
|
|
- }
|
|
|
- }"
|
|
|
-}
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-##### 1.4.2 刷身份证或手动输入个人信息入库
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "doStorageFaceInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "7",
|
|
|
- "params": {
|
|
|
- "appid": "",
|
|
|
- "orgOutId": "",
|
|
|
- "componentOutId": "",
|
|
|
- "isvPid": "",
|
|
|
- "uniqueId": "",
|
|
|
- "name": "",
|
|
|
- "certNo": "",
|
|
|
- "phone": ""
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| -------------- | ------ | ------------------------------------------------- | -------- |
|
|
|
-| appid | String | 商户appid | 必填 |
|
|
|
-| orgOutId | String | 机构编码 | 必填 |
|
|
|
-| componentOutId | String | 组件编码,示例:老年食堂(day_label_sign_online) | 必填 |
|
|
|
-| isvPid | String | 支付宝平台ISV的PID | 必填 |
|
|
|
-| uniqueId | String | 操作流水ID(用户拒绝授权返回的字段信息) | 必填 |
|
|
|
-| name | String | 用户姓名 | 必填 |
|
|
|
-| certNo | String | 用户身份证 | 必填 |
|
|
|
-| phone | String | 用户手机号 | 选填 |
|
|
|
-
|
|
|
-**返回值:与1.4.1返回的数据格式类似**
|
|
|
-
|
|
|
-**常见错误码:**
|
|
|
-| 错误码subCode | 错误信息subMessage | 备注 |
|
|
|
-| -------------- | ------ | ------------------------------------------------- |
|
|
|
-| SUCCESS | 成功 | 用户开通成功 |
|
|
|
-| 90001 | 请走上传个人信息的链路 | 用户刷脸授权开通链路点击拒绝授权时会返回uniqueId,需要走传入身份信息开通链路 |
|
|
|
-| 90002 | 超时退出 | 20s倒计时结束退出 |
|
|
|
-| 90003 | 主动退出 | 用户点击右上角关闭按钮退出 |
|
|
|
-| 90004 | 参数有误 | 参数有误,可能原因如下:1、启动组件缺少必传参 2、刷脸信息授权链路多传uniqueId 3、传入身份信息链路没传uniqueId |
|
|
|
-| E90612 | ISV信息不存在 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90609 | ISV下线 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90604 | 应用信息不存在 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90201 | 组件不存在 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90204 | 组件下线 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90506 | 只支持机构刷脸入库 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90301 | 机构信息不存在 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90306 | 机构下线 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90305 | 机构关联的身份验证表信息不存在 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E90703 | 未签约 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| E60002 | 网络异常 | 机具端网络连接异常 |
|
|
|
-| E60001 | BPaaS Service系统异常 | 系统异常 |
|
|
|
-| Z1006 | 刷脸重试次数超过阈值 | 请咨询对接的支付宝业务同学进行申请 |
|
|
|
-| Z1208 | 抱歉,无法认出你 | 抱歉,无法认出你 没有识别到人脸,稍后重试 |
|
|
|
-
|
|
|
-
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-
|
|
|
-
|
|
|
-#### 2.刷身份证
|
|
|
-
|
|
|
-##### 2.1 刷身份证(单次)
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getIDCardInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3",
|
|
|
- "params": {
|
|
|
- "infoType": "base,photo,other"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-请求参数infoType中三个值分别对应data中返回结果
|
|
|
-
|
|
|
-base
|
|
|
-
|
|
|
- "name": "",
|
|
|
- "idNum": "",
|
|
|
-
|
|
|
-photo
|
|
|
-
|
|
|
- "photoBase64": "/9j/4AAQSkZJRgABAgAAAQABABntRS5Sj//"
|
|
|
-
|
|
|
-other
|
|
|
-
|
|
|
- "signingOrganization": "杭州市公安局余杭分局",
|
|
|
- "address": "杭州市XXX",
|
|
|
- "nation": "汉",
|
|
|
- "sex": "男",
|
|
|
- "beginTime": "20230529",
|
|
|
- "endTime": "20430529",
|
|
|
- "birthDate": "19800101",
|
|
|
-
|
|
|
-**返回值-成功**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getIDCardInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "3",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "name": "姓名",
|
|
|
- "idNum": "身份证号",
|
|
|
- "signingOrganization": "杭州市公安局余杭分局",
|
|
|
- "address": "杭州市XXX",
|
|
|
- "nation": "汉",
|
|
|
- "sex": "男",
|
|
|
- "beginTime": "20230529",
|
|
|
- "endTime": "20430529",
|
|
|
- "birthDate": "19800101",
|
|
|
- "photoBase64": "/9j/4AAQSkZJRgABAgAAAQABABntRS5Sj//"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------------- | ------ | ------------------------------------------------------------------- |
|
|
|
-| name | String | 姓名 |
|
|
|
-| idNum | String | 身份证号 |
|
|
|
-| signingOrganization | String | 签发机关 |
|
|
|
-| address | String | 地址,注意门牌号返回的138,正常的数字是138。可能会搜索时对应不上 |
|
|
|
-| nation | String | 民族 |
|
|
|
-| sex | String | 性别 |
|
|
|
-| beginTime | String | 有效期开始时间 |
|
|
|
-| endTime | String | 有效期截止时间 |
|
|
|
-| birthDate | String | 出身年月日 |
|
|
|
-| photoBase64 | String | 头像base64 |
|
|
|
-
|
|
|
-**返回值-15s 未刷证超时**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getIDCardInfo",
|
|
|
- "data": {},
|
|
|
- "event": "open",
|
|
|
- "message": "超时",
|
|
|
- "success": false,
|
|
|
- "taskId": "3"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-##### 2.2 关闭刷身份证(单次)
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "closeIDCardInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3",
|
|
|
- "params": {
|
|
|
- "infoType": "base,photo,other"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-若是持续监听时要关闭,my.on可以不写,不处理返回数据,会在app程序关闭时,自动处理关闭
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "closeIDCardInfo",
|
|
|
- "data": {},
|
|
|
- "event": "close",
|
|
|
- "message": "关闭成功",
|
|
|
- "success": true,
|
|
|
- "taskId": "3"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-##### 2.3 开启刷身份证监听(持续)
|
|
|
-
|
|
|
-在线识别的暂不可用,离线识别可用该监听
|
|
|
-开启后,持续监听。若有刷身份证,则会回调以下函数。
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('initIDCardListener',res =>{
|
|
|
- console.log('刷身份证监听',res.data)
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-返回结果同——刷身份证(单次)中的data
|
|
|
-
|
|
|
-#### 3.二维码
|
|
|
-
|
|
|
- [小程序代码生成二维码](https://www.yuque.com/u37221582/lm1yvd/hyv7avgaglpnvk38?singleDoc# )
|
|
|
-
|
|
|
-##### 3.1 开启刷二维码(单次)
|
|
|
-
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getQRCode",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getQRCode",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "1",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "qrCode": "11"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------ | ------ | ------------------ |
|
|
|
-| qrCode | String | 刷二维码返回的结果 |
|
|
|
-
|
|
|
-##### 3.2 开启刷二维码监听(持续)
|
|
|
-
|
|
|
-开启后,持续监听。若有刷码,则会回调以下函数
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('initQRListener',res =>{
|
|
|
- console.log('刷二维码监听',res.data)
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-返回结果同“开启刷二维码返回”中的data
|
|
|
-
|
|
|
-#### 4.麦克风
|
|
|
-
|
|
|
-
|
|
|
-##### 4.1 开启麦克风(持续),app持续发录音数据给小程序
|
|
|
-先通过my.call的startMicrophoneListener开启录音,
|
|
|
-在my.on中持续接收(只需要开启一次),
|
|
|
-最后通过my.call的stopMicrophoneListener停止录音
|
|
|
-
|
|
|
-###### 4.1.1 开启麦克风监听
|
|
|
-
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "startMicrophoneListener",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3",
|
|
|
- "params": {
|
|
|
- "intervalTime": 1000 ,//2.9.0版本及之后版本已废弃该字段
|
|
|
- "isMicrophoneSourceData":false //2.9.8版本添加
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-###### 4.1.2 麦克风持续监听
|
|
|
-
|
|
|
-**返回值一:isMicrophoneSourceData=false**
|
|
|
-```javascript
|
|
|
-my.on('initMicrophoneListener',res =>{
|
|
|
- console.log('麦克风监听',res.data)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "data": {
|
|
|
- "voiceContent": "BwAHAAcABwAHAA=\n"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值二:isMicrophoneSourceData=true**
|
|
|
-```javascript
|
|
|
-my.on('initMicrophoneListener',res =>{
|
|
|
- console.log('麦克风监听',res.data)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "data": {
|
|
|
- "voicecontent":"[-106,-1,-62.....]"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------ | ---------------- | ----------------------------------------------------------------------------------------- |
|
|
|
-| voiceContent | String(base64) | 使用麦克风说话返回的结果,原始数据为采样率16K,采样位宽16bit的PCM。byte\[]-->base64 |
|
|
|
-| isMicrophoneSourceData | boolean | 是否返回源格式byte[],true:byte[]字符串格式传输,false:byte\[]转换为base64格式传输 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-###### 4.1.3 停止麦克风监听
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "stopMicrophoneListener",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "stopMicrophoneListener",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "3",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-<s>
|
|
|
-
|
|
|
-##### 4.2.1开启麦克风(单次)已废弃(2.9.0版本及之后版本)
|
|
|
-</s>
|
|
|
-单次录音生成一整个mp3格式,转换后返回
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "startMicrophone",
|
|
|
- "event": "open",
|
|
|
- "taskId": "1"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "startMicrophone",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "1",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-<s>
|
|
|
-
|
|
|
-##### 4.2.2 结束麦克风并返回录音结果(单次)已废弃(2.9.0版本及之后版本)
|
|
|
-</s>
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "stopMicrophone",
|
|
|
- "event": "open",
|
|
|
- "taskId": "1"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "stopMicrophone",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "1",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "voiceContent": "11"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------ | ---------------- | ----------------------------------------------------------------------------------------- |
|
|
|
-| voiceContent | String(base64) | 使用麦克风说话返回的结果,原始数据为采样率16K,采样位宽16bit的mp3。mp3-->byte\[]-->base64 |
|
|
|
-
|
|
|
-
|
|
|
-<s>
|
|
|
-
|
|
|
-##### 4.3 麦克风录音状态 已废弃(2.9.0版本及之后版本)
|
|
|
-</s>
|
|
|
-
|
|
|
-当小程序崩溃,或者退出小程序时,录音可能还在继续。
|
|
|
-小程序可先通过该接口获取录音状态。如果在录音需要先停止,再开启
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getMicrophoneState",
|
|
|
- "event": "open",
|
|
|
- "taskId": "1"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getMicrophoneState",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "1",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "microphoneListenerState": 1,
|
|
|
- "microphoneState": 1
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ----------------------- | ---- | ---------------------------------- |
|
|
|
-| microphoneListenerState | int | 是否持续录音状态,1是在录音,0是不 |
|
|
|
-| microphoneState | int | 是否单次录音状态,1是在录音,0是不 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-#### 5.设备信息
|
|
|
-##### 5.1开启设备信息请求
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getDeviceInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "4"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getDeviceInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "4",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "sn": "设备sn",
|
|
|
- "deviceModel": "设备型号",
|
|
|
- "appVersion": "app版本号",
|
|
|
- "androidVersion": "7.1.2",
|
|
|
- "deviceIP": "192.168.1.1",
|
|
|
- "devicedDisplay": "设备固件号"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| -------------- | ------ | ------------- |
|
|
|
-| sn | String | 设备sn |
|
|
|
-| deviceModel | String | deviceModel |
|
|
|
-| appVersion | String | app版本号 |
|
|
|
-| androidVersion | String | Android版本号 |
|
|
|
-| deviceIP | String | 设备ip |
|
|
|
-| devicedDisplay | String | 设备固件号 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-#### 6. 语音播报请求
|
|
|
-
|
|
|
-##### 6.1 语音播报请求
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "speech",
|
|
|
- "event": "open",
|
|
|
- "taskId": "8",
|
|
|
- "params": {
|
|
|
- "text": "要播报的文字内容",
|
|
|
- "pitch": 1.0f,
|
|
|
- "rate": 1.0f,
|
|
|
- "speechQueue": 0
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定,taskId可自定义
|
|
|
-**请求参数:**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ----------- | ------ | ------------------------------------------------------------------------------------------ | ------------- |
|
|
|
-| text | String | 要播报的文字内容 | 必填 |
|
|
|
-| pitch | float | 设置音调,值越大声音越尖(女声),值越小则变成男声,1.0f是常规 | 非必填 |
|
|
|
-| rate | float | 设置语速,1.0f是常规 | 非必填 |
|
|
|
-| speechQueue | int | 设置当前播报是否打断上次播报。0表示播完上次才开始播当前。1表示打断上一次播报内容,播报当前 | 非必填,默认0 |
|
|
|
-
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "speech",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "8",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-##### 6.2 语音停止请求
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "speechStop",
|
|
|
- "event": "open",
|
|
|
- "taskId": "8"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定,taskId可自定义
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "speechStop",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "8",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-#### 7. 手输身份证号
|
|
|
-
|
|
|
-##### 7.1 手输身份证号
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "enterIDNumber",
|
|
|
- "event": "open",
|
|
|
- "taskId": "9"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "enterIDNumber",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "9",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "idNum": "410922199611150054",
|
|
|
- "alipayUid": "2088132815051624",
|
|
|
- "code": 1000,
|
|
|
- "extInfo": "{\"authCode\":\"\"}",
|
|
|
- "ftoken": "fp1142504423f1f6fa7a618313e23919h60",
|
|
|
- "isvResult": true,
|
|
|
- "subCode": "OK_SUCCESS",
|
|
|
- "subMessage": "SUCCESS",
|
|
|
- "vid": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-超时返回,message返回手输证件号超时
|
|
|
-取消返回,message返回取消手输证件号
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-#### 8. 小票打印机小程序
|
|
|
-
|
|
|
-##### 8.1 小票打印机小程序
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "receiptPrinting",
|
|
|
- "event": "open",
|
|
|
- "taskId": "10",
|
|
|
- "params": {
|
|
|
- "printList": [{
|
|
|
- "text": "测试文字打印",
|
|
|
- "textSize": 26,
|
|
|
- "bold": false,
|
|
|
- "algin": "left"
|
|
|
- }, {
|
|
|
- "imageBase64": "测试图片打印,实际传入base64图片值/9j/4AAQSkZJRgABAgAAAQABABntRS5Sj//",
|
|
|
- "width": 376,
|
|
|
- "height": 376
|
|
|
- }]
|
|
|
- }
|
|
|
- }
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定,taskId可自定义
|
|
|
-
|
|
|
-**请求参数:**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ----------- | ------- | ------------------------------------------------------------ | -------- |
|
|
|
-| text | String | 打印的文字内容,默认"" | 必填 |
|
|
|
-| textSize | int | 字体大小,默认26 | 必填 |
|
|
|
-| bold | Boolean | 是否加粗,默认false | 必填 |
|
|
|
-| algin | String | 对齐方式,默认left,left -左对齐 center -居中 right -右对齐 | 必填 |
|
|
|
-| imageBase64 | String | Base64图片,不需要前缀,默认"" | 必填 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "receiptPrinting",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "10",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-#### 9. 小程序超时
|
|
|
-##### 9.1 小程序超时
|
|
|
-
|
|
|
-在app.js中的onLaunch中写
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('ampeOperationTimeout', e => {
|
|
|
-console.log("小程序超时", e);
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-然后在需要倒计时的地方去发送ampeStartOperationWatcher指令
|
|
|
-```javascript
|
|
|
-my.call('ampeStartOperationWatcher', {}, res => {
|
|
|
- console.log(res)
|
|
|
-});
|
|
|
-```
|
|
|
-
|
|
|
-超时时间配置,需要进app的设置,输入密码,功能配置,里面可以配置时间,默认30秒。
|
|
|
-如果不需要该超时功能,设置0即可。
|
|
|
-设置完时间后,设备重启,以便配置生效
|
|
|
-
|
|
|
-
|
|
|
-#### 10. 红外感应
|
|
|
-
|
|
|
-先通过my.call的startInfraredInductionListener开启红外感应,
|
|
|
-在my.on中持续接收(只需要开启一次),
|
|
|
-最后通过my.call的stopInfraredInductionListener停止红外感应
|
|
|
-
|
|
|
-
|
|
|
-##### 10.1 开启红外感应监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "startInfraredInductionListener",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3",
|
|
|
- "params": {
|
|
|
- "intervalTime": 3000
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ------------ | ---- | ------------------------------------------------------------- | ---------------- |
|
|
|
-| intervalTime | int | 间隔多久返回红外感应信息,(取值范围2000-5000,建议3000)毫秒 | 非必填,默认3000 |
|
|
|
-
|
|
|
-**返回值**
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "startInfraredInductionListener",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "3",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-##### 10.2 红外感应持续监听
|
|
|
-```javascript
|
|
|
-my.on('initInfraredInductionListener',res =>{
|
|
|
- console.log('红外感应监听',res.data)
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-```
|
|
|
- {"inductionCode":"1"}
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------- | ---- | ------------------------------ |
|
|
|
-| inductionCode | int | 1是代表感应到有人,0是未感应到 |
|
|
|
-
|
|
|
-##### 10.3 停止红外感应监听
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "stopInfraredInductionListener",
|
|
|
- "event": "open",
|
|
|
- "taskId": "3"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "stopInfraredInductionListener",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "3",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-红外感应持续返回的数据,在my.on中
|
|
|
-
|
|
|
-
|
|
|
-#### 11. 双屏异显
|
|
|
-
|
|
|
-##### 11.1 副屏显示不同页面
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "openSecondaryScreen",
|
|
|
- "event": "open",
|
|
|
- "taskId": "11",
|
|
|
- "params": {
|
|
|
- "secondaryScreenBase64": "xx"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| --------------------- | ------ | ------------ | -------- |
|
|
|
-| secondaryScreenBase64 | String | 图片的base64 | 必填 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "openSecondaryScreen",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "11",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-##### 11.2 副屏关闭不同页面
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "closeSecondaryScreen",
|
|
|
- "event": "open",
|
|
|
- "taskId": "12"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "closeSecondaryScreen",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "12",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-##### 11.3 获取副屏显示关闭的状态
|
|
|
-
|
|
|
-```javascript
|
|
|
-
|
|
|
-let params = {
|
|
|
- "action": "getSecondaryScreenState",
|
|
|
- "event": "open",
|
|
|
- "taskId": "13"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值:**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getSecondaryScreenState",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "13",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "getSecondaryScreenState": 0
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-**返回参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 说明 |
|
|
|
-| ----------------------- | ---- | -------- | ----------------------------- |
|
|
|
-| getSecondaryScreenState | int | 副屏状态 | 显示1 close 0 没加载到副屏-1 |
|
|
|
-#### 12.社保卡
|
|
|
-
|
|
|
-##### 12.1 读取社保卡信息(单次)
|
|
|
-
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "getSocialSecurityCardInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "14"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "getSocialSecurityCardInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "14",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "cardNumber": "",
|
|
|
- "name": "",
|
|
|
- "sex": "",
|
|
|
- "idNumber": "",
|
|
|
- "birthDate": "",
|
|
|
- "issueDate": "",
|
|
|
- "expireDate": "",
|
|
|
- "nation": "",
|
|
|
- "cityCode": "",
|
|
|
- "address": "",
|
|
|
- "fullVersion": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ----------- | ------ | ------------ |
|
|
|
-| cardNumber | String | 卡号 |
|
|
|
-| name | String | 姓名 |
|
|
|
-| sex | String | 性别 |
|
|
|
-| idNumber | String | 社会保障号码 |
|
|
|
-| birthDate | String | 出生日期 |
|
|
|
-| issueDate | String | 发证日期 |
|
|
|
-| expireDate | String | 有效日期 |
|
|
|
-| nation | String | 民族 |
|
|
|
-| cityCode | String | 城市代码 |
|
|
|
-| address | String | 地址 |
|
|
|
-| fullVersion | String | 社保卡版本 |
|
|
|
-
|
|
|
-##### 12.2 获取社保卡配置信息(单次)
|
|
|
-
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "socialSecurityCardConfig",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "socialSecurityCardConfig",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-##### 12.3 开启社保卡读取监听(持续)
|
|
|
-
|
|
|
-开启后,持续监听。若读取社保卡信息,则会回调以下函数
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('socialSecurityCardListener',res =>{
|
|
|
- console.log('读取社保卡信息',res.data)
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('socialSecurityCardListener',res =>{
|
|
|
- console.log('读取社保卡信息',res.data)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "data": {
|
|
|
- "cardNumber": "",
|
|
|
- "name": "",
|
|
|
- "sex": "",
|
|
|
- "idNumber": "",
|
|
|
- "birthDate": "",
|
|
|
- "issueDate": "",
|
|
|
- "expireDate": "",
|
|
|
- "nation": "",
|
|
|
- "cityCode": "",
|
|
|
- "address": "",
|
|
|
- "fullVersion": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ----------- | ------ | ------------ |
|
|
|
-| cardNumber | String | 卡号 |
|
|
|
-| name | String | 姓名 |
|
|
|
-| sex | String | 性别 |
|
|
|
-| idNumber | String | 社会保障号码 |
|
|
|
-| birthDate | String | 出生日期 |
|
|
|
-| issueDate | String | 发证日期 |
|
|
|
-| expireDate | String | 有效日期 |
|
|
|
-| nation | String | 民族 |
|
|
|
-| cityCode | String | 城市代码 |
|
|
|
-| address | String | 地址 |
|
|
|
-| fullVersion | String | 社保卡版本 |
|
|
|
-
|
|
|
-#### 13.NFC
|
|
|
-##### CPU卡
|
|
|
-1. 监听卡片是否放置步骤:
|
|
|
- ①.开启监听(startCPUCardLoopRead)
|
|
|
- ②.接收监听结果(CPUCardListener)
|
|
|
- ③.关闭监听(stopCPUCardLoopRead)
|
|
|
-2. <p style="color: blue;">单次对卡片进行单条APDU命令操作步骤:</p>
|
|
|
-
|
|
|
- ①.获取卡信息"上电"(readOnceCPUCardInfo)
|
|
|
- ②.执行APDU命令一(sendCPUCardCommand)
|
|
|
- ③.执行APDU命令二(sendCPUCardCommand)
|
|
|
- ④.命令三、命令四....
|
|
|
-3. <p style="color: blue;">单次对卡片进行多条APDU命令操作步骤:</p>
|
|
|
-
|
|
|
- ①.获取卡信息"上电"(readOnceCPUCardInfo)
|
|
|
- ②.执行APDU命令集(sendCPUCardApduCommands)
|
|
|
- </br>
|
|
|
- <p style="color: red;">注意:①.部分类型卡片时间间隔不能过长,执行命令时酌情删减使用。
|
|
|
- </br> ②.单次对卡片进行APDU命令操作时,请先停止监听(stopCPUCardLoopRead)!!!</p>
|
|
|
-
|
|
|
-##### PSAM卡
|
|
|
-1. 单次对PSAM卡进行操作步骤:
|
|
|
- ①.冷复位(psamCardColdReset)
|
|
|
- ②.执行APDU命令(sendCPUCardCommand)
|
|
|
-
|
|
|
-##### 13.1 开启监听(startCPUCardLoopRead)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "startCPUCardLoopRead",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15",
|
|
|
- "params": {
|
|
|
- "intervalTime": "1000",
|
|
|
- "isComeBackFailed":true //2.9.8版本添加
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ------------ | ------- | ------------------------------- | -------- |
|
|
|
-| intervalTime | Integer | 同卡推送间隔时间(ms),默认1000ms | 选填 |
|
|
|
-| isComeBackFailed | boolean | 是否返回寻卡失败结果,true:返回寻卡失败结果 | 选填 |
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "startCPUCardLoopRead",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-##### 13.2 接收监听结果(CPUCardListener)
|
|
|
-
|
|
|
-开启后,持续监听。若读取CPU卡信息,则会回调以下函数
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('CPUCardListener',res =>{
|
|
|
- console.log('CPU卡信息',res.data)
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.on('CPUCardListener',res =>{
|
|
|
- console.log('CPU卡信息',res.data)
|
|
|
-/**** todo
|
|
|
- {
|
|
|
- "data": {
|
|
|
- "nfc_cardInfo": "1078809002209000000000002E20419F",
|
|
|
- "code":0 //2.9.8版本添加
|
|
|
- }
|
|
|
- }
|
|
|
-****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------ | ------ | ------------- |
|
|
|
-| nfc_cardInfo | String | cpu卡读取信息 |
|
|
|
-| code | Integer | -1:寻卡失败,0:成功 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-##### 13.3 关闭监听(stopCPUCardLoopRead)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "stopCPUCardLoopRead",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "stopCPUCardLoopRead",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-##### 13.4 获取卡复位信息"上电"(readOnceCPUCardInfo)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "readOnceCPUCardInfo",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15"
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "readOnceCPUCardInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "nfc_cardInfo": "1078809002209000000000002E20419F"
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| ------------ | ------ | ------------- |
|
|
|
-| nfc_cardInfo | String | cpu卡读取信息 |
|
|
|
-
|
|
|
-**错误码**
|
|
|
-| 错误码 | 说明 |
|
|
|
-| ------ | ---------- |
|
|
|
-| -1 | 初始化失败 |
|
|
|
-| -2 | 寻卡失败 |
|
|
|
-| -3 | 防碰撞失败 |
|
|
|
-| -4 | 选卡失败 |
|
|
|
-| -5 | 上电失败 |
|
|
|
-
|
|
|
-**错误示例**
|
|
|
-```javascript
|
|
|
-
|
|
|
- {
|
|
|
- "action": "readOnceCPUCardInfo",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- "data": {"nfc_cardInfo": "-1"}
|
|
|
-}
|
|
|
-
|
|
|
-```
|
|
|
-
|
|
|
-##### 13.5 执行APDU命令(sendCPUCardCommand)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "sendCPUCardCommand",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15",
|
|
|
- "params": {
|
|
|
- "commandApdu": "0084000008",
|
|
|
- "type": "1",
|
|
|
- "slot": "1"
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ----------- | ------- | --------------------------------------------------- | -------- |
|
|
|
-| commandApdu | String | APDU命令 | 必填 |
|
|
|
-| type | Integer | 1-CPU卡命令,2-PSAM卡命令 | 必填 |
|
|
|
-| slot | Integer | 选择卡槽(1-SAM1,2-SAM2),默认SAM1,搭配type=2使用 | 选填 |
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "sendCPUCardCommand",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功",
|
|
|
- "data": {
|
|
|
- "nfc_resultInfo": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| -------------- | ------ | ---------------- |
|
|
|
-| nfc_resultInfo | String | APDU命令返回结果:<=0执行失败;>0执行APDU命令成功并作为有效数据的长度 |
|
|
|
-
|
|
|
-**错误码**
|
|
|
-| 错误码 | 说明 |
|
|
|
-| ------ | ------------ |
|
|
|
-| -1 | 初始化失败 |
|
|
|
-| -2 | 执行APDU失败 |
|
|
|
-
|
|
|
-**错误示例**
|
|
|
-```javascript
|
|
|
- {
|
|
|
- "action": "sendCPUCardCommand",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- "data": {"nfc_resultInfo": "-1"}
|
|
|
-}
|
|
|
-```
|
|
|
-##### 13.6 执行APDU命令集(sendCPUCardApduCommands)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params ={
|
|
|
- "action": "sendCPUCardApduCommands",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15",
|
|
|
- "params": {
|
|
|
- "commandApdus": ["0084000008", "0084000008", "0084000008"],
|
|
|
- "type": "1",
|
|
|
- "slot": "1"
|
|
|
-
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ----------- | ------- | --------------------------------------------------- | -------- |
|
|
|
-| commandApdus | String[] | APDU命令集 | 必填 |
|
|
|
-| type | Integer | 1-CPU卡命令,2-PSAM卡命令 | 必填 |
|
|
|
-| slot | Integer | 选择卡槽(1-SAM1,2-SAM2),默认SAM1,搭配type=2使用 | 选填 |
|
|
|
-
|
|
|
-**返回值:执行成功**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "sendCPUCardApduCommands",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- "data": {
|
|
|
- "nfc_commandResults": ["A8742A99CB4F90189000","D4C111A02852E9C09000","5E60C64C6E436E6A9000"]
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| -------------- | ------ | ---------------- |
|
|
|
-| nfc_commandResults | String[] | APDU命令结果 |
|
|
|
-
|
|
|
-**返回值:执行失败**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "sendCPUCardApduCommands",
|
|
|
- "event": "open",
|
|
|
- "success": false,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "失败:-2" //-2为错误码
|
|
|
- "data": {
|
|
|
- "nfc_commandResults": ["A8742A99CB4F90189000","D4C111A02852E9C09000","5E60C64C6E436E6A9000"]
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| -------------- | ------ | ---------------- |
|
|
|
-| nfc_commandResults | String[] | APDU命令返回结果 |
|
|
|
-
|
|
|
-**错误码**
|
|
|
-| 错误码 | 说明 |
|
|
|
-| ------ | ------------ |
|
|
|
-| -1 | 初始化失败 |
|
|
|
-| -2 | 执行APDU失败 |
|
|
|
-| -100 | 执行APDU命令成功但状态不对 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-##### 13.6 冷复位(psamCardColdReset)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "psamCardColdReset",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15",
|
|
|
- "params": {
|
|
|
- "slot": "1"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ---- | ------- | ----------------------------------- | -------- |
|
|
|
-| slot | Integer | 选择卡槽(1-SAM1,2-SAM2),默认SAM1 | 选填 |
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "psamCardColdReset",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- "data": {
|
|
|
- "nfc_resultInfo": ""
|
|
|
- }
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-| 字段 | 类型 | 说明 |
|
|
|
-| -------------- | ------ | ------------------ |
|
|
|
-| nfc_resultInfo | String | 冷复位命令返回结果 |
|
|
|
-
|
|
|
-**错误码**
|
|
|
-| 错误码 | 说明 |
|
|
|
-| ------ | ---------- |
|
|
|
-| -1 | 初始化失败 |
|
|
|
-| -2 | 冷复位失败 |
|
|
|
-
|
|
|
-**错误示例**
|
|
|
-```javascript
|
|
|
- {
|
|
|
- "action": "psamCardColdReset",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- "data": {"nfc_resultInfo": "-1"}
|
|
|
-}
|
|
|
-```
|
|
|
-
|
|
|
-##### 13.7 蜂鸣器(startBuzzer)
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "startBuzzer",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15"
|
|
|
- "params": {
|
|
|
- "beep": "50"
|
|
|
- }
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ---- | ------- | ---------- | -------- |
|
|
|
-| beep | Integer | 蜂鸣器时长 | 必填 |
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "startBuzzer",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "15",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-</br>
|
|
|
-
|
|
|
-#### 14.关闭小程序、显示/隐藏导航栏,禁用/启用通知栏(仅本次运行有效)
|
|
|
-
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- "action": "deviceConfig",
|
|
|
- "event": "open",
|
|
|
- "taskId": "15"
|
|
|
- "params":{
|
|
|
- "deviceConfig": {
|
|
|
- "exitApplet": 1,
|
|
|
- "hideNavigationBar": 1,
|
|
|
- "hindeNotificationBar": 1
|
|
|
- }
|
|
|
-}
|
|
|
-}
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ---- | ------- | ---------- | -------- |
|
|
|
-| exitApplet | Integer | 关闭小程序:1-关闭 | 选填 |
|
|
|
-| hideNavigationBar | Integer | 导航栏:1-隐藏 2-开启 | 选填 |
|
|
|
-| hindeNotificationBar | Integer | 通知栏:1-禁用 2-开启 | 选填 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "deviceConfig",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "16",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-#### 15.右上角悬浮关闭小程序按钮(根据指定AppId)
|
|
|
-
|
|
|
-请求一次,返回一次。无法持续监听
|
|
|
-
|
|
|
-```javascript
|
|
|
-let params = {
|
|
|
- action: "floatingExitButton",
|
|
|
- event: "open",
|
|
|
- taskId: "16"
|
|
|
- params:{
|
|
|
- isOpen: true,
|
|
|
- appId: "1234567"
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- //todo
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-action和event的值固定如上,taskId可自定义
|
|
|
-
|
|
|
-**请求参数**
|
|
|
-
|
|
|
-| 字段 | 类型 | 说明 | 是否必填 |
|
|
|
-| ---- | ------- | ---------- | -------- |
|
|
|
-| isOpen | Boolean | 是否打开右上角悬浮按钮,true:打开 false:关闭 | 必填 |
|
|
|
-| appId | String | 小程序appId,isOpen=true时必填 | 选填 |
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-**返回值**
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.call("ampeHHCommunication", params, (res)=>{
|
|
|
- console.log(res)
|
|
|
- /**** todo
|
|
|
- {
|
|
|
- "action": "floatingExitButton",
|
|
|
- "event": "open",
|
|
|
- "success": true,
|
|
|
- "taskId": "16",
|
|
|
- "message ": "成功"
|
|
|
- }
|
|
|
- ****/
|
|
|
-})
|
|
|
-```
|
|
|
-
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-</br>
|
|
|
-
|
|
|
-
|
|
|
-# 调试运行常见问题
|
|
|
-## 如何判断小程序运行在AMPE 设备上还是手机端
|
|
|
-
|
|
|
-```javascript
|
|
|
-my.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- // 判断获取设备系统信息中arome.deviceId参数是否为空
|
|
|
- if (res.arome_deviceId != null) {
|
|
|
- //todo 设置信标,当前为 ampe 设备
|
|
|
- //todo 获取用户信息
|
|
|
- my.call(...)
|
|
|
- }else{
|
|
|
- //todo 设置信标,当前为手机端
|
|
|
- //todo 获取用户信息
|
|
|
- my.getAuthCode({
|
|
|
- scopes: 'auth_user',
|
|
|
- success: res => {
|
|
|
- const authCode = res.authCode;
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- fail: (err) => {
|
|
|
- console.log(err);
|
|
|
- }
|
|
|
- })
|
|
|
-```
|
|
|
-
|
|
|
-**获取设备参数(包含设备号、当前小程序运行环境)**
|
|
|
-
|
|
|
- my.getSystemInfo({
|
|
|
- success: (res) => {
|
|
|
- console.log(res);
|
|
|
- },
|
|
|
- fail: (err) => {
|
|
|
- console.log(err);
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
-success结果
|
|
|
-
|
|
|
- {
|
|
|
- "apiLevel": 31,
|
|
|
- "app": "alipay",
|
|
|
- "appMode": "normal",
|
|
|
- "bluetoothEnabled": false,
|
|
|
- "bluetoothAuthorized": true,
|
|
|
- "brand": "Redmi",
|
|
|
- "cameraAuthorized": true,
|
|
|
- "currentBattery": "46%",
|
|
|
- "fontSizeSetting": 16,
|
|
|
- "isIphoneXSeries": false,
|
|
|
- "language": "zh-Hans",
|
|
|
- "locationAuthorized": true,
|
|
|
- "locationEnabled": true,
|
|
|
- "microphoneAuthorized": false,
|
|
|
- "model": "Xiaomi M2012K11AC",
|
|
|
- "notificationAuthorized": true,
|
|
|
- "overlayAuthorized": false,
|
|
|
- "performance": "high",
|
|
|
- "pixelRatio": 2.75,
|
|
|
- "platform": "Android",
|
|
|
- "screen": {
|
|
|
- "height": 828,
|
|
|
- "width": 393
|
|
|
- },
|
|
|
- "screenHeight": 2276,
|
|
|
- "screenWidth": 1080,
|
|
|
- "statusBarHeight": 30,
|
|
|
- "storage": "242 GB",
|
|
|
- "system": "12",
|
|
|
- "titleBarHeight": 48,
|
|
|
- "transparentTitle": false,
|
|
|
- "version": "10.3.50.8100",
|
|
|
- "wifiEnabled": false,
|
|
|
- "windowHeight": 725,
|
|
|
- "windowWidth": 393
|
|
|
- }
|
|
|
-
|
|
|
-以上每个参数含义,参考
|
|
|
-<https://opendocs.alipay.com/mini/api/system-info>
|
|
|
-中的success 回调函数
|
|
|
-
|
|
|
-## 运行命令后提示——移动应用未绑定该小程序
|
|
|
-
|
|
|
-1.先必须有个正式版
|
|
|
-2.有正式版后,就可以用文档里的小程序调试代码进行真机预览
|
|
|
-
|
|
|
-## 运行命令后提示——业务请求失败:设备不存在
|
|
|
-
|
|
|
-检查sn有没有错,再检查sn是否有进件授权,@xinxin 授权
|
|
|
-
|
|
|
-
|
|
|
-## 运行命令后提示——移动应用未关联设备产品
|
|
|
-一般是命令输错,有空格啥的,仔细检查下
|
|
|
-
|
|
|
-
|
|
|
-## 真机调试无反应
|
|
|
-
|
|
|
-minidev真机调试是有这个毛病,我们自己调试时也经常遇到,发现最好的解决办法是,重启设备且进入小程序,新增一个终端,再minidev login 登陆一下,再执行真机调试 minidev remote
|
|
|
-
|
|
|
-minidev这两个命令,需要进入小程序后,新增一个终端运行,才能生效
|
|
|
-
|
|
|
-还不行的话。再尝试以下
|
|
|
-关掉开发者工具,重新打开
|
|
|
-换好点的wifi
|
|
|
-
|
|
|
-## 小程序启动后——进度卡在99%,或页面提示“该小程序已暂停服务”
|
|
|
-
|
|
|
-首先检查网络
|
|
|
-
|
|
|
-<https://open.alipay.com/>
|
|
|
-进开放平台查一下,是不是把小程序暂停了
|
|
|
-检查小程序类型,不支持支付宝iot小程序,必须是支付宝小程序才行
|
|
|
-
|
|
|
-## 页面提示ampe启动失败
|
|
|
-
|
|
|
-提供sn号,@xinxin检查进件和配置。
|
|
|
-若已经进件和配置,查看iot相关的所有安装包(含小程序引擎)是否都已经安装
|
|
|
-
|
|
|
-## 小程序运行后,卡在小程序服务引擎界面
|
|
|
-
|
|
|
-停在小程序服务引擎界面的话要技术支持查一下,一般都是网络状态不好再重新拉要打开的小程序运行包
|
|
|
-
|
|
|
-## 调试时,刷脸提示“点击过快”
|
|
|
-
|
|
|
-点击过快可能是由于反复真机预览造成的,反复初始化刷脸。建议重启设备
|
|
|
-
|
|
|
-## 刷脸提示“关闭服务时找不到当前任务(E69016)”
|
|
|
-
|
|
|
-一般是刷脸未初始化成功,就调用刷脸
|
|
|
-1.app确认是否为2.7.5及以后的版本
|
|
|
-2.smile版本确认是否为2455及以后的版本
|
|
|
-3.建议小程序开发者在 app.js 的onLaunch 钩子里执行一次初始化initFace即可(若失败,可以执行 3s 再次尝试初始化操作)。要等到initFace返回成功后,才能调用刷脸getFaceInfo的指令
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-## 刷脸初始化失败。Message提示E69015
|
|
|
-点击设备上的IoT,查看smile。一般是smile未安装
|
|
|
-如果没有,联系厂商人员安装下
|
|
|
-
|
|
|
-
|
|
|
-## 刷脸初始化成功,但是没有唤起刷脸页面
|
|
|
-
|
|
|
-1.一般是网络连接问题,建议在小程序页面上增加网络监听提示,方便排查原因
|
|
|
-2.启动时的小程序调用了各类刷脸、获取设备信息等初始化指令,再运行mindev调试命令,调试小程序就不会再收到上述的返回结果。解决方案就是启动一个不会各类初始化指令的小程序,再运行调试小程序
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-## 刷脸获取用户信息
|
|
|
-
|
|
|
-刷脸成功后,会返回authcode,然后再去调用支付宝接口获取用户信息
|
|
|
-
|
|
|
-## 刷脸后一直刷脸
|
|
|
-
|
|
|
-提供sn号,@xinxin检查配置,看看是否场景配置政务。
|
|
|
-
|
|
|
-## 刷脸后无反应
|
|
|
-
|
|
|
-看下刷脸getFaceInfo结果是否有返回。如果有返回,但刷脸失败success为false,展示message
|
|
|
-
|
|
|
-## 刷脸获取用户信息提示——获取支付宝AccessToken失败\:Invalid Arguments,调用接口的应用标识(app\_id)与令牌授权的应用不相符
|
|
|
-
|
|
|
-需要开发商自己申请带有三要素权限
|
|
|
-<https://opendocs.alipay.com/open/a74a7068_alipay.user.info.share?pathHash=af2476d4>
|
|
|
-
|
|
|
-如已经提供,@xinxin进行配置和检查
|
|
|
-要检查下公私钥是不是这个appid下
|
|
|
-
|
|
|
-
|
|
|
-如果已经配置,且平常使用ok,偶现后,重启可以。那就需要替换成smile6.1.0.2455
|
|
|
-
|
|
|
-### 支付宝接口获取用户信息接口
|
|
|
-
|
|
|
-需要开发商自己申请带有用户信息三要素权限
|
|
|
-<https://opendocs.alipay.com/open/a74a7068_alipay.user.info.share?pathHash=af2476d4>
|
|
|
-
|
|
|
-## 刷脸失败
|
|
|
-
|
|
|
-返回系统异常(E69001),检查smile版本,建议6.1.0
|
|
|
-
|
|
|
-## 刷脸授权框出现HHK8
|
|
|
-由merchantAppid小程序名称决定,检查startBasspass入参
|
|
|
-当merchantAppid 为空时,会拿初始化用的刷脸应用 appid 的三要素权限,应该是配置问题
|
|
|
-
|
|
|
-## 进入小程序出现扫码授权弹框
|
|
|
-这个扫码弹框,不是我们app端弹出的
|
|
|
-是支付宝小程序引擎和ampe弹出的,具体由@去央解决处理
|
|
|
-支付宝技术反馈是触发了my.getauthcode
|
|
|
-
|
|
|
-
|
|
|
-## 小程序更新
|
|
|
-
|
|
|
-小程序更新后,在设备上进入小程序,会有更新弹框,然后工作人员点击更新就行
|
|
|
-
|
|
|
-
|
|
|
-## 设备使用了物联网卡,导致无法进入小程序
|
|
|
-联系去央,找支付宝人员,将支付宝的ip和域名加到了物联网卡的白名单中
|
|
|
-
|
|
|
-
|
|
|
-## 设备连接有线网络,导致无法进入小程序
|
|
|
-更新小程序引擎版本到10.3.34.725及以后
|
|
|
-更新smile版本到6.1.0.2455及以后
|
|
|
-
|
|
|
-更新完后,重启
|
|
|
-
|
|
|
-如果还有问题。安装浏览器查看下网络
|
|
|
-
|
|
|
-## 小程序出错排查日志
|
|
|
-
|
|
|
-1.iot和小程序引擎等apk已安装,且已进件和配置
|
|
|
-2.安装下debug的apk版本
|
|
|
-3.进入小程序,右上角会有三个小圆点,长按,进入日志上传页面,点确定就行,然后拍下日志ID
|
|
|
-4.@对接群中的支付宝技术支持进行排查
|
|
|
-
|
|
|
-##### HHarome仅提供刷脸、刷证等硬件功能,小程序操作后出现不符合预期的页面,请先联系小程序开发技术
|
|
|
-
|
|
|
-## 导航栏开启状态下,设备后台请勿强制退出应用
|
|
|
-错误示范:![alt text](image.png) ![alt text](image-1.png)
|
|
|
-
|
|
|
-##### <p style="color: red;">导航栏开启状态下强制后台退出应用!!!</p>
|
|
|
-##### 导致问题现象:再次进入应用后会导致应用紊乱。
|
|
|
-##### 解决方式:重启设备后使用/调试。
|
|
|
-
|
|
|
-
|
|
|
-
|