Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ShenghuoquanBusiness
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
ShenghuoquanBusiness
Commits
ac87f58d
Commit
ac87f58d
authored
May 27, 2021
by
yinjiacheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Demo 身份证OCR后调起活体检测
parent
03cb3b39
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
1 deletion
+19
-1
ApiService.kt
...va/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
+1
-0
IdentifyIdOcrVerifyCallback.kt
.../newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
+1
-0
AliveTestActivity.kt
...an/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
+11
-1
IDCardTestActivity.kt
.../shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
+6
-0
No files found.
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
View file @
ac87f58d
...
...
@@ -87,6 +87,7 @@ class ApiService {
}
override
fun
onFailer
(
result
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
apiCallback
.
identifyIdOcrVerifyFailure
(
result
)
}
})
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
View file @
ac87f58d
...
...
@@ -4,4 +4,5 @@ import com.yidian.common.http.HttpResult
interface
IdentifyIdOcrVerifyCallback
{
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
fun
identifyIdOcrVerifyFailure
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
View file @
ac87f58d
...
...
@@ -34,6 +34,9 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
private
var
dataPath
=
""
// 模型本地存放路径
private
var
mProgressDialog
:
ProgressDialog
?
=
null
private
var
idCardName
:
String
?
=
null
private
var
idCardNo
:
String
?
=
null
override
fun
createViewBinding
():
ActivityAliveLayoutBinding
{
return
ActivityAliveLayoutBinding
.
inflate
(
layoutInflater
)
...
...
@@ -47,6 +50,8 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
super
.
onCreate
(
savedInstanceState
)
initSign
()
setOnListener
()
idCardName
=
intent
.
getStringExtra
(
"idCardName"
)
idCardNo
=
intent
.
getStringExtra
(
"idCardNo"
)
}
private
fun
initSign
()
{
...
...
@@ -61,7 +66,8 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
private
fun
setOnListener
()
{
viewBind
.
btActionYy
.
setOnClickListener
{
val
requestParams
:
AuthPersonalGetTokenBean
.
Request
=
AuthPersonalGetTokenBean
.
Request
(
"13010519881211121X"
,
"宋永孟"
,
"meglive"
,
"merchant"
)
val
requestParams
:
AuthPersonalGetTokenBean
.
Request
=
AuthPersonalGetTokenBean
.
Request
(
idCardNo
!!
,
idCardName
!!
,
"meglive"
,
AppConfig
.
appid
)
ApiService
.
authPersonalGetToken
(
authPersonalGetTokenCallback
,
requestParams
)
}
}
...
...
@@ -155,6 +161,10 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
Toast
.
makeText
(
this
@AliveTestActivity
,
"活体检测结果失败 msg = ${t.reason}"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
override
fun
identifyIdOcrVerifyFailure
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
progressDialogDismiss
()
}
}
// 将字节流转换成文件
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/idcard/IDCardTestActivity.kt
View file @
ac87f58d
...
...
@@ -19,6 +19,7 @@ import com.yidian.shenghuoquan.newscontent.databinding.ActivityIdcardBinding
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.GetIDCardOCRBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IGetIDCardOCRCallback
import
com.yidian.shenghuoquan.newscontent.ui.alive.AliveTestActivity
import
com.yidian.shenghuoquan.newscontent.utils.KS3Core
import
com.yidian.utils.ToastUtil
import
java.io.File
...
...
@@ -122,6 +123,11 @@ class IDCardTestActivity : BaseActivity<ActivityIdcardBinding>() {
override
fun
getIDCardOCRSuccess
(
result
:
GetIDCardOCRBean
.
Response
?)
{
Log
.
d
(
KS3Core
.
TAG
,
"name: ${result?.posit?.name}, id num: ${result?.posit?.idcard_number}"
)
ToastUtil
.
showToast
(
this
@IDCardTestActivity
,
"ocr result, name: ${result?.posit?.name}, number: ${result?.posit?.idcard_number}"
)
// 身份证OCR成功后执行活体检测
val
intent
=
Intent
(
this
@IDCardTestActivity
,
AliveTestActivity
::
class
.
java
)
intent
.
putExtra
(
"idCardName"
,
result
?.
posit
?.
name
)
intent
.
putExtra
(
"idCardNo"
,
result
?.
posit
?.
idcard_number
)
startActivity
(
intent
)
}
override
fun
getIDCardOCRFailure
(
message
:
String
?)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment