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
3ba508c9
Commit
3ba508c9
authored
May 22, 2021
by
宋永孟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 联调token
parent
d5579c1d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
52 additions
and
2 deletions
+52
-2
URLs.kt
...onLib/Common/src/main/java/com/yidian/common/http/URLs.kt
+1
-0
ApiService.kt
...va/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
+16
-0
CommonService.kt
...com/yidian/shenghuoquan/newscontent/http/CommonService.kt
+5
-1
IdentifyIdOcrVerifyBean.kt
...quan/newscontent/http/httpbean/IdentifyIdOcrVerifyBean.kt
+10
-0
IdentifyIdOcrVerifyCallback.kt
.../newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
+7
-0
AliveTestActivity.kt
...an/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
+13
-1
No files found.
CommonLib/Common/src/main/java/com/yidian/common/http/URLs.kt
View file @
3ba508c9
...
...
@@ -47,5 +47,6 @@ class URLs {
const
val
authPersonalGetToken
=
"/Identify/IdOcr/getBizToken"
const
val
getKSYunToken
=
"/ksy/Ksyun/getToken"
const
val
getIDCardOCR
=
"Identify/IdOcr/idCardOcr"
const
val
identifyIdOcrVerify
=
"/Identify/IdOcr/verify"
}
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/ApiService.kt
View file @
3ba508c9
...
...
@@ -22,6 +22,22 @@ import org.json.JSONObject
class
ApiService
{
companion
object
{
//获取活体检测接口
fun
identifyIdOcrVerify
(
apiCallback
:
IdentifyIdOcrVerifyCallback
,
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
)
{
val
paramsMap
=
HttpParamsUtils
.
getParamsMap
()
ServiceFactory
.
getInstance
().
createService
(
CommonService
::
class
.
java
)
.
identifyIdOcrVerify
(
paramsMap
,
requestParams
)
.
compose
(
TransformUtil
.
defaultSchedulers
())
.
subscribe
(
object
:
HttpResultSubscriber
<
Any
?>()
{
override
fun
onSuccess
(
result
:
HttpResult
<
Any
?
>?)
{
apiCallback
.
identifyIdOcrVerifySuccess
(
result
)
}
override
fun
onFailer
(
result
:
HttpResult
<
Any
?
>?)
{
}
})
}
//获取活体检测接口
fun
authPersonalGetToken
(
apiCallback
:
AuthPersonalGetTokenCallback
,
requestParams
:
AuthPersonalGetTokenBean
.
Request
)
{
val
paramsMap
=
HttpParamsUtils
.
getParamsMap
()
...
...
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/CommonService.kt
View file @
3ba508c9
...
...
@@ -115,5 +115,9 @@ interface CommonService {
@Headers
(
"Content-Type: application/json"
)
@POST
(
URLs
.
getIDCardOCR
)
fun
getIDCardOCR
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
GetIDCardOCRBean
.
Request
)
:
Observable
<
HttpResult
<
GetIDCardOCRBean
.
Response
?
>>
fun
getIDCardOCR
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
GetIDCardOCRBean
.
Request
):
Observable
<
HttpResult
<
GetIDCardOCRBean
.
Response
?
>>
@Headers
(
"Content-Type: application/json"
)
@POST
(
URLs
.
identifyIdOcrVerify
)
fun
identifyIdOcrVerify
(
@QueryMap
commonParams
:
Map
<
String
,
String
>,
@Body
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
):
Observable
<
HttpResult
<
Any
?
>>
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/IdentifyIdOcrVerifyBean.kt
0 → 100644
View file @
3ba508c9
package
com.yidian.shenghuoquan.newscontent.http.httpbean
class
IdentifyIdOcrVerifyBean
(
var
request
:
Request
,
val
response
:
Response
)
{
data class
Request
(
var
biz_token
:
String
,
var
meglive_data
:
String
)
data class
Response
(
val
biz_token
:
String
)
}
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/http/httpbean/IdentifyIdOcrVerifyCallback.kt
0 → 100644
View file @
3ba508c9
package
com.yidian.shenghuoquan.newscontent.http.httpbean
import
com.yidian.common.http.HttpResult
interface
IdentifyIdOcrVerifyCallback
{
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
Any
?
>?)
}
\ No newline at end of file
Components/newscontent/src/main/java/com/yidian/shenghuoquan/newscontent/ui/alive/AliveTestActivity.kt
View file @
3ba508c9
...
...
@@ -13,6 +13,8 @@ import com.yidian.shenghuoquan.newscontent.databinding.ActivityAliveLayoutBindin
import
com.yidian.shenghuoquan.newscontent.http.ApiService
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AuthPersonalGetTokenBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.AuthPersonalGetTokenCallback
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IdentifyIdOcrVerifyBean
import
com.yidian.shenghuoquan.newscontent.http.httpbean.IdentifyIdOcrVerifyCallback
import
java.io.File
import
java.io.FileOutputStream
import
java.io.InputStream
...
...
@@ -24,6 +26,7 @@ import java.io.InputStream
*/
class
AliveTestActivity
:
BaseActivity
<
ActivityAliveLayoutBinding
>(),
PreCallback
,
DetectCallback
{
private
var
sign
=
""
private
var
bizToken
=
""
private
var
megLiveManager
:
MegLiveManager
?
=
null
private
var
modelPath
=
""
// 模型本地存放路径
private
var
mProgressDialog
:
ProgressDialog
?
=
null
...
...
@@ -64,7 +67,8 @@ 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
)
megLiveManager
?.
preDetect
(
this
@AliveTestActivity
,
t
?.
result
?.
biz_token
,
"zh"
,
"https://api.megvii.com"
,
modelPath
,
this
@AliveTestActivity
)
bizToken
=
t
?.
result
?.
biz_token
!!
megLiveManager
?.
preDetect
(
this
@AliveTestActivity
,
bizToken
,
"zh"
,
"https://api.megvii.com"
,
modelPath
,
this
@AliveTestActivity
)
}
}
...
...
@@ -132,6 +136,9 @@ 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
())
}
val
requestParams
:
IdentifyIdOcrVerifyBean
.
Request
=
IdentifyIdOcrVerifyBean
.
Request
(
bizToken
,
data
!!
)
ApiService
.
identifyIdOcrVerify
(
identifyIdOcrVerifyCallback
,
requestParams
)
}
}
...
...
@@ -139,5 +146,10 @@ class AliveTestActivity : BaseActivity<ActivityAliveLayoutBinding>(), PreCallbac
showDialogDismiss
()
}
private
val
identifyIdOcrVerifyCallback
=
object
:
IdentifyIdOcrVerifyCallback
{
override
fun
identifyIdOcrVerifySuccess
(
t
:
HttpResult
<
Any
?
>?)
{
//人脸验证成功
}
}
}
\ 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