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
87878d30
Commit
87878d30
authored
May 24, 2021
by
宋永孟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 完成活体检测功能
parent
20b26012
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
100 additions
and
18 deletions
+100
-18
AndroidManifest.xml
Components/newscontent/src/main/AndroidManifest.xml
+3
-0
ApiService.kt
...va/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
+3
-3
CommonService.kt
...com/yidian/shenghuoquan/newscontent/http/CommonService.kt
+1
-1
IdentifyIdOcrVerifyBean.kt
...quan/newscontent/http/httpbean/IdentifyIdOcrVerifyBean.kt
+1
-3
IdentifyIdOcrVerifyCallback.kt
.../newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
+1
-1
FlashActivity.kt
...a/com/yidian/shenghuoquan/newscontent/ui/FlashActivity.kt
+5
-4
TempListActivity.kt
...om/yidian/shenghuoquan/newscontent/ui/TempListActivity.kt
+38
-0
AliveTestActivity.kt
...an/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
+9
-6
activity_temp_list.xml
...ts/newscontent/src/main/res/layout/activity_temp_list.xml
+39
-0
No files found.
Components/newscontent/src/main/AndroidManifest.xml
View file @
87878d30
...
...
@@ -79,6 +79,9 @@
<activity
android:name=
".ui.idcard.IDCardTestActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.TempListActivity"
android:theme=
"@style/Transparent"
/>
<activity
android:name=
".ui.idcard.IDCardResultActivity"
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
View file @
87878d30
...
...
@@ -28,12 +28,12 @@ class ApiService {
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
)
.
identifyIdOcrVerify
(
paramsMap
,
requestParams
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
Any
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
Any
?
>?)
{
.
subscribe
(
object
:
HttpResultSubscriber
<
IdentifyIdOcrVerifyBean
.
Response
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
apiCallback
.
identifyIdOcrVerifySuccess
(
result
)
}
override
fun
onFailer
(
result
:
HttpResult
<
Any
?
>?)
{
override
fun
onFailer
(
result
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
}
})
}
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/CommonService.kt
View file @
87878d30
...
...
@@ -119,7 +119,7 @@ interface CommonService {
@Headers
(
"Content-Type: application/json"
)
@POST
(
URLs
.
identifyIdOcrVerify
)
fun
identifyIdOcrVerify
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
):
Observable
<
HttpResult
<
Any
?
>>
fun
identifyIdOcrVerify
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
):
Observable
<
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>>
@GET
(
URLs
.
getKSYunObjectId
)
fun
getKSYunObjectId
(
@QueryMap
commonParams
:
Map
<
String
,
String
>)
:
Observable
<
HttpResult
<
GetKSYunObjectIdBean
.
Response
>>
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/IdentifyIdOcrVerifyBean.kt
View file @
87878d30
...
...
@@ -2,9 +2,7 @@ package com.yidian.shenghuoquan.newscontent.http.httpbean
class
IdentifyIdOcrVerifyBean
(
var
request
:
Request
,
val
response
:
Response
)
{
data class
Request
(
var
biz_token
:
String
,
var
meglive_objectid
:
String
)
data class
Response
(
val
biz_token
:
String
)
data class
Response
(
val
verify_result
:
Boolean
)
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
View file @
87878d30
...
...
@@ -3,5 +3,5 @@ package com.yidian.shenghuoquan.newscontent.http.httpbean
import
com.yidian.common.http.HttpResult
interface
IdentifyIdOcrVerifyCallback
{
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
Any
?
>?)
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/FlashActivity.kt
View file @
87878d30
package
com.yidian.shenghuoquan.newscontent.ui
import
android.content.Intent
import
android.os.Bundle
import
com.orhanobut.hawk.Hawk
import
com.yidian.common.HawkConfig
...
...
@@ -15,7 +16,6 @@ import com.yidian.shenghuoquan.newscontent.http.httpbean.IGuestLoginCallback
import
com.yidian.shenghuoquan.newscontent.subscription.subscriptionManager
import
com.yidian.shenghuoquan.newscontent.ui.dialog.ProtocolDialog
import
com.yidian.shenghuoquan.newscontent.utils.AccountUtil
import
com.yidian.xpage.XPageManager
class
FlashActivity
:
BaseActivity
<
ActivityFlashBinding
>()
{
private
var
protocolDialog
:
ProtocolDialog
?
=
null
...
...
@@ -56,10 +56,11 @@ class FlashActivity: BaseActivity<ActivityFlashBinding>() {
private
fun
launcher
(){
val
isAgree
=
Hawk
.
get
<
Boolean
>(
HawkConfig
.
ProtocolIsAgree
,
false
)
if
(
isAgree
){
viewBind
.
clRoot
.
postDelayed
(
{
XPageManager
.
push
(
XRouterPathConstants
.
LOGIN_LIFE_CIRCLE
,
paramsMap
)
viewBind
.
clRoot
.
postDelayed
({
// XPageManager.push(XRouterPathConstants.LOGIN_LIFE_CIRCLE, paramsMap)
startActivity
(
Intent
(
this
@FlashActivity
,
TempListActivity
::
class
.
java
))
finish
()
},
2000
)
},
2000
)
}
else
{
viewBind
.
clRoot
.
postDelayed
(
{
protocolPopupShow
()
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/TempListActivity.kt
0 → 100644
View file @
87878d30
package
com.yidian.shenghuoquan.newscontent.ui
import
android.content.Intent
import
android.os.Bundle
import
com.yidian.common.base.BaseActivity
import
com.yidian.shenghuoquan.newscontent.databinding.ActivityTempListBinding
import
com.yidian.shenghuoquan.newscontent.ui.alive.AliveTestActivity
import
com.yidian.shenghuoquan.newscontent.ui.idcard.IDCardTestActivity
/**
* Author: sym
* Date: 2021/5/24 3:44 PM
* Describe:
*/
class
TempListActivity
:
BaseActivity
<
ActivityTempListBinding
>()
{
override
fun
createViewBinding
():
ActivityTempListBinding
{
return
ActivityTempListBinding
.
inflate
(
layoutInflater
)
}
override
fun
getXPageName
():
String
{
return
""
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
viewBind
.
btActionCard
.
setOnClickListener
{
startActivity
(
Intent
(
this
@TempListActivity
,
IDCardTestActivity
::
class
.
java
))
}
viewBind
.
btActionYy
.
setOnClickListener
{
startActivity
(
Intent
(
this
@TempListActivity
,
AliveTestActivity
::
class
.
java
))
}
viewBind
.
btBusinessLicense
.
setOnClickListener
{
startActivity
(
Intent
(
this
@TempListActivity
,
AliveTestActivity
::
class
.
java
))
}
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
View file @
87878d30
...
...
@@ -2,7 +2,7 @@ package com.yidian.shenghuoquan.newscontent.ui.alive
import
android.app.ProgressDialog
import
android.os.Bundle
import
android.
util.Log
import
android.
widget.Toast
import
com.megvii.meglive_sdk.listener.DetectCallback
import
com.megvii.meglive_sdk.listener.PreCallback
import
com.megvii.meglive_sdk.manager.MegLiveManager
...
...
@@ -33,7 +33,6 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
private
var
modelPath
=
""
// 模型本地存放路径
private
var
dataPath
=
""
// 模型本地存放路径
private
var
mProgressDialog
:
ProgressDialog
?
=
null
private
val
VERIFY_URL
=
"https://api.megvii.com/faceid/v3/sdk/verify"
override
fun
createViewBinding
():
ActivityAliveLayoutBinding
{
...
...
@@ -69,11 +68,9 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
private
val
authPersonalGetTokenCallback
=
object
:
AuthPersonalGetTokenCallback
{
override
fun
getTokenSuccess
(
t
:
HttpResult
<
AuthPersonalGetTokenBean
.
Response
?
>?)
{
Log
.
d
(
"song_test"
,
t
?.
result
?.
biz_token
)
bizToken
=
t
?.
result
?.
biz_token
!!
megLiveManager
?.
preDetect
(
this
@AliveTestActivity
,
bizToken
,
"zh"
,
"https://api.megvii.com"
,
modelPath
,
this
@AliveTestActivity
)
}
}
private
fun
saveAssets
(
fileName
:
String
,
path
:
String
):
String
?
{
...
...
@@ -139,6 +136,8 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
override
fun
onDetectFinish
(
token
:
String
?,
errorCode
:
Int
,
errorMessage
:
String
?,
data
:
String
?)
{
if
(
errorCode
==
1000
)
{
token
?.
let
{
verify
(
it
,
data
!!
.
toByteArray
())
}
}
else
{
Toast
.
makeText
(
this
@AliveTestActivity
,
errorMessage
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
...
...
@@ -148,8 +147,13 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
}
private
val
identifyIdOcrVerifyCallback
=
object
:
IdentifyIdOcrVerifyCallback
{
override
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
Any
?
>?)
{
override
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
IdentifyIdOcrVerifyBean
.
Response
?
>?)
{
progressDialogDismiss
()
if
(
t
!!
.
result
!!
.
verify_result
)
{
Toast
.
makeText
(
this
@AliveTestActivity
,
"活体检测结果成功 verify_result = true "
,
Toast
.
LENGTH_SHORT
).
show
()
}
else
{
Toast
.
makeText
(
this
@AliveTestActivity
,
"活体检测结果失败 msg = ${t.reason}"
,
Toast
.
LENGTH_SHORT
).
show
()
}
}
}
...
...
@@ -185,7 +189,6 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
override
fun
onTaskSuccess
(
bucket
:
String
?,
objectKey
:
String
?)
{
val
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
=
IdentifyIdOcrVerifyBean
.
Request
(
bizToken
,
objectKey
!!
)
ApiService
.
identifyIdOcrVerify
(
identifyIdOcrVerifyCallback
,
requestParams
)
}
...
...
Components/newscontent/src/main/res/layout/activity_temp_list.xml
0 → 100644
View file @
87878d30
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<Button
android:id=
"@+id/bt_action_card"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"200dp"
android:text=
"身份证OCR"
android:textColor=
"@android:color/black"
android:textSize=
"20sp"
/>
<Button
android:id=
"@+id/bt_action_yy"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"50dp"
android:text=
"活体检测"
android:textColor=
"@android:color/black"
android:textSize=
"20sp"
/>
<Button
android:id=
"@+id/bt_business_license"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginTop=
"50dp"
android:text=
"执照采集"
android:textColor=
"@android:color/black"
android:textSize=
"20sp"
/>
</LinearLayout>
\ No newline at end of file
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