更新记录
1.0.1(2025-05-03)
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog,
and this project adheres to Semantic Versioning.
[Unreleased]
Added
- (新功能或特性,尚未发布)
Changed
- (现有功能的变更)
Fixed
- (问题修复)
Deprecated
- (即将废弃的功能)
Removed
- (已删除的功能)
Security
- (安全相关更新)
[1.0.1] - 2025-05-03
Fixed
- 修正安卓回调出错的问题
[1.0.0] - 2025-04-01
Initial Release
- 插件核心功能上线:支持基础 API 调用和 UI 渲染。
1.0.0(2025-05-03)
[1.0.0] - 2025-04-01
Initial Release
- 插件核心功能上线:支持基础 API 调用和 UI 渲染。
平台兼容性
uni-app
Vue2 | Vue3 | Chrome | Safari | app-vue | app-nvue | Android | iOS | 鸿蒙 |
---|---|---|---|---|---|---|---|---|
√ | √ | - | - | - | - | 6.0 | 13 | - |
微信小程序 | 支付宝小程序 | 抖音小程序 | 百度小程序 | 快手小程序 | 京东小程序 | 鸿蒙元服务 | QQ小程序 | 飞书小程序 | 快应用-华为 | 快应用-联盟 |
---|---|---|---|---|---|---|---|---|---|---|
- | - | - | - | - | - | - | - | - | - | - |
uni-app x
Chrome | Safari | Android | iOS | 鸿蒙 | 微信小程序 |
---|---|---|---|---|---|
- | - | 6.0 | 13 | - | - |
📦 安装
npm install alipay-face --save
🚀 快速开始
初始化 SDK
import { initSDK } from 'alipay-face';
const result = initSDK(3);
console.log('初始化状态:', result.status);
调用人脸核身
import { verify } from 'alipay-face';
verify({
certifyId: 'your_certify_id_from_alipay',
success: (res) => {
console.log('核身成功:', res);
},
fail: (err) => {
console.error('核身失败:', err.errCode, err.errMsg);
}
});
📚 API 文档
initSDK(retryCount: number): InitResult
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
retryCount | number | 是 | 最大重试次数 |
返回值:
interface InitResult {
status: boolean
}
verify(options: VerifyOptions): void
参数结构:
interface VerifyOptions {
certifyId: string
success?: (res: VerifyResult) => void
fail?: (err: VerifyFail) => void
complete?: (res: any) => void
}
interface VerifyResult {
code: number
reason: string
retCode: number
retMsg: string
}
interface VerifyFail extends IUniError {
errCode: 9010001 | 9010002
}
⚠️ 错误码说明
错误码 | 描述 |
---|---|
9010001 | 核身流程ID无效 |
9010002 | 支付宝SDK初始化失败 |
🔧 集成准备
支付宝配置
- 登录支付宝开放平台
- 添加「人脸核身」功能
- 获取
certifyId
Uni-App 配置
{
"app-plus": {
"plugins": {
"alipay-face": {
"version": "1.0.0",
"provider": "alipay"
}
}
}
}
📝 注意事项
- Android需相机权限
- iOS需添加 NSCameraUsageDescription
- 建议使用沙箱环境测试
📜 许可证
MIT © 2023 MiKoo NetWrok