Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
af85fad7
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1054
Star
31
Fork
43
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello_uni-id-pages
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
af85fad7
编写于
2月 08, 2023
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: frv validator error
上级
7382e31f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
43 deletion
+47
-43
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
...d-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
+1
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
...i-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
+5
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-auth-result.js
...id-co/module/facial-recognition-verify/get-auth-result.js
+40
-41
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js
...-id-co/module/facial-recognition-verify/get-certify-id.js
+1
-0
未找到文件。
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/utils.js
浏览文件 @
af85fad7
...
...
@@ -195,7 +195,7 @@ function isMatchUserApp (userAppList, matchAppList) {
}
function
checkIdCard
(
idCardNumber
)
{
if
(
!
idCardNumber
)
return
false
if
(
!
idCardNumber
||
typeof
idCardNumber
!==
'
string
'
)
return
false
const
coefficient
=
[
7
,
9
,
10
,
5
,
8
,
4
,
2
,
1
,
6
,
3
,
7
,
9
,
10
,
5
,
8
,
4
,
2
]
const
checkCode
=
[
1
,
0
,
'
x
'
,
9
,
8
,
7
,
6
,
5
,
4
,
3
,
2
]
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
浏览文件 @
af85fad7
...
...
@@ -148,7 +148,11 @@ module.exports = {
}
})
this
.
validator
.
mixin
(
'
realName
'
,
function
(
realName
)
{
if
(
!
/^
[\u
4e00-
\u
9fa5
]
+$/
.
test
(
realName
))
{
if
(
typeof
realName
!==
'
string
'
||
realName
.
length
<
2
||
!
/^
[\u
4e00-
\u
9fa5
]{1,10}(
·
?[\u
4e00-
\u
9fa5
]{1,10}){0,5}
$/
.
test
(
realName
)
)
{
return
{
errCode
:
ERROR
.
INVALID_REAL_NAME
}
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-auth-result.js
浏览文件 @
af85fad7
...
...
@@ -68,53 +68,52 @@ module.exports = async function (params) {
}
}
if
(
res
.
authState
===
'
SUCCESS
'
)
{
const
frvLogs
=
await
frvLogsCollection
.
where
({
certify_id
:
certifyId
}).
get
()
const
log
=
frvLogs
.
data
&&
frvLogs
.
data
[
0
]
const
updateData
=
{
realname_auth
:
{
auth_status
:
REAL_NAME_STATUS
.
CERTIFIED
,
real_name
:
log
.
real_name
,
identity
:
log
.
identity
,
auth_date
:
Date
.
now
(),
type
:
0
}
if
(
res
.
authState
!==
'
SUCCESS
'
)
{
console
.
log
(
ERROR
.
UNKNOWN_ERROR
,
'
source res:
'
,
res
)
throw
{
errCode
:
ERROR
.
UNKNOWN_ERROR
}
}
if
(
res
.
base64Photo
)
{
const
{
fileID
}
=
await
uniCloud
.
uploadFile
({
cloudPath
:
`user/id-card/
${
uid
}
.bin`
,
fileContent
:
Buffer
.
from
(
encryptData
.
call
(
this
,
res
.
base64Photo
))
})
updateData
.
realname_auth
.
in_hand
=
fileID
}
const
frvLogs
=
await
frvLogsCollection
.
where
({
certify_id
:
certifyId
}).
get
()
const
log
=
frvLogs
.
data
&&
frvLogs
.
data
[
0
]
await
Promise
.
all
([
userCollection
.
doc
(
uid
).
update
(
updateData
),
frvLogsCollection
.
where
({
certify_id
:
certifyId
}).
update
({
status
:
REAL_NAME_STATUS
.
CERTIFIED
})
])
return
{
errCode
:
0
,
authStatus
:
REAL_NAME_STATUS
.
CERTIFIED
,
realName
:
dataDesensitization
(
decryptData
.
call
(
this
,
log
.
real_name
),
{
onlyLast
:
true
}),
identity
:
dataDesensitization
(
decryptData
.
call
(
this
,
log
.
identity
))
const
updateData
=
{
realname_auth
:
{
auth_status
:
REAL_NAME_STATUS
.
CERTIFIED
,
real_name
:
log
.
real_name
,
identity
:
log
.
identity
,
auth_date
:
Date
.
now
(),
type
:
0
}
}
console
.
log
(
ERROR
.
UNKNOWN_ERROR
,
'
source res:
'
,
res
)
if
(
res
.
base64Photo
)
{
const
{
fileID
}
=
await
uniCloud
.
uploadFile
({
cloudPath
:
`user/id-card/
${
uid
}
.bin`
,
fileContent
:
Buffer
.
from
(
encryptData
.
call
(
this
,
res
.
base64Photo
))
})
updateData
.
realname_auth
.
in_hand
=
fileID
}
await
Promise
.
all
([
userCollection
.
doc
(
uid
).
update
(
updateData
),
frvLogsCollection
.
where
({
certify_id
:
certifyId
}).
update
({
status
:
REAL_NAME_STATUS
.
CERTIFIED
})
])
throw
{
errCode
:
ERROR
.
UNKNOWN_ERROR
return
{
errCode
:
0
,
authStatus
:
REAL_NAME_STATUS
.
CERTIFIED
,
realName
:
dataDesensitization
(
decryptData
.
call
(
this
,
log
.
real_name
),
{
onlyLast
:
true
}),
identity
:
dataDesensitization
(
decryptData
.
call
(
this
,
log
.
identity
))
}
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/facial-recognition-verify/get-certify-id.js
浏览文件 @
af85fad7
...
...
@@ -53,6 +53,7 @@ module.exports = async function (params) {
}
const
frvLogs
=
await
frvLogsCollection
.
where
({
user_id
:
uid
,
real_name
:
realName
,
identity
:
idCard
,
status
:
REAL_NAME_STATUS
.
WAITING_CERTIFIED
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录