Commit 84f993a9 by YKai

feat: 请求头添加参数

parent d21d486d
......@@ -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())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment