Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
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
杨凯
YDL-Component-Medical
Commits
84f993a9
Commit
84f993a9
authored
Aug 16, 2022
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 请求头添加参数
parent
d21d486d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+18
-0
No files found.
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
84f993a9
...
...
@@ -2,8 +2,11 @@ package com.ydl.ydlcommon.base.config
import
android.annotation.SuppressLint
import
android.content.Context
import
android.os.Build
import
android.text.TextUtils
import
com.google.gson.Gson
import
com.ydl.devicesidlib.DeviceIDHelper
import
com.ydl.devicesidlib.Utils
import
com.ydl.pushserver.pushagent.YdlPushAgent
import
com.ydl.ydlcommon.app.Apm
import
com.ydl.ydlcommon.base.BaseApp
...
...
@@ -16,6 +19,7 @@ import com.ydl.ydlcommon.data.http.GsonProvider
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.api.ApiRequestUtil
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.utils.DeviceTool
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.YDLCacheUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
...
...
@@ -55,6 +59,7 @@ class HttpConfig {
private
const
val
YDL
=
"Ydl"
private
const
val
UID
=
"uid"
private
const
val
FFROM
=
"ffrom"
private
const
val
FID
=
"fid"
private
const
val
IS_FROM_APP
=
"isFromApp"
private
const
val
OS_BUILD
=
"osBuild"
private
const
val
TS
=
"ts"
...
...
@@ -471,6 +476,19 @@ class HttpConfig {
if
(
loginBean
!=
null
)
{
builder
.
addHeader
(
TOKEN
,
loginBean
.
token
)
.
addHeader
(
UID
,
loginBean
.
userId
)
}
else
{
builder
.
addHeader
(
UID
,
"0"
)
}
// 请求头添加fid参数
if
(
DeviceTool
.
checkHasAgreeSecret
())
{
val
deviceId
=
if
(
Build
.
VERSION
.
SDK_INT
<=
Build
.
VERSION_CODES
.
P
)
{
//获取imei
Utils
.
getIMEI
(
BaseApp
.
getApp
())
}
else
{
//android Q及以上取oaid
DeviceIDHelper
.
getInstance
().
deviceId
}
builder
.
addHeader
(
FID
,
deviceId
)
}
it
.
proceed
(
builder
.
build
())
}
...
...
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