1、更正渠道获取
This commit is contained in:
shenzuqiang 2026-03-13 14:17:19 +08:00
parent 990104ded1
commit bd07f14d41
2 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ class HeaderInterceptor : Interceptor {
mBuilder.header("x-mobile-model", android.os.Build.MODEL) mBuilder.header("x-mobile-model", android.os.Build.MODEL)
mBuilder.header("x-package", BuildConfig.APPLICATION_ID) mBuilder.header("x-package", BuildConfig.APPLICATION_ID)
mBuilder.header("x-base-version", getAppVersionName()?:"") mBuilder.header("x-base-version", getAppVersionName()?:"")
mBuilder.header("x-channel", "rabbit_${ChannelUtils.getChannel(applicationContext)}") mBuilder.header("x-channel", ChannelUtils.getChannel(applicationContext))
mBuilder.header("x-click-id", "${ChannelUtils.getBdVid(applicationContext)}") mBuilder.header("x-click-id", "${ChannelUtils.getBdVid(applicationContext)}")
mBuilder.header("x-app-id", Constants.AppId) mBuilder.header("x-app-id", Constants.AppId)
@ -41,7 +41,7 @@ class HeaderInterceptor : Interceptor {
stringBuilder.append("│ x-mobile-brand = ${android.os.Build.BRAND}\n") stringBuilder.append("│ x-mobile-brand = ${android.os.Build.BRAND}\n")
stringBuilder.append("│ x-mobile-model = ${android.os.Build.MODEL}\n") stringBuilder.append("│ x-mobile-model = ${android.os.Build.MODEL}\n")
stringBuilder.append("│ x-base-version = ${getAppVersionName()}\n") stringBuilder.append("│ x-base-version = ${getAppVersionName()}\n")
stringBuilder.append("│ x-channel = rabbit_${ChannelUtils.getChannel(applicationContext)}\n") stringBuilder.append("│ x-channel = ${ChannelUtils.getChannel(applicationContext)}\n")
stringBuilder.append("│ x-click-id = ${ChannelUtils.getBdVid(applicationContext)}\n") stringBuilder.append("│ x-click-id = ${ChannelUtils.getBdVid(applicationContext)}\n")
stringBuilder.append("│ x-package = ${BuildConfig.APPLICATION_ID}\n") stringBuilder.append("│ x-package = ${BuildConfig.APPLICATION_ID}\n")
stringBuilder.append("-------------> header end <-------------") stringBuilder.append("-------------> header end <-------------")

View File

@ -15,13 +15,13 @@ object ChannelUtils {
fun getChannel(context: Context?): String { fun getChannel(context: Context?): String {
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
MMKVUtils.put("app_channel", "test") MMKVUtils.put("app_channel", "debug_${getChannelBy(context?:return "general")}")
} else { } else {
if (TextUtils.isEmpty(MMKVUtils.getString("app_channel"))) { if (TextUtils.isEmpty(MMKVUtils.getString("app_channel"))) {
MMKVUtils.put("app_channel", getChannelBy(context?:return "")) MMKVUtils.put("app_channel", getChannelBy(context?:return "general"))
} }
} }
return MMKVUtils.getString("app_channel") ?: "" return MMKVUtils.getString("app_channel") ?: "general"
} }
private fun getChannelBy(context: Context): String? { private fun getChannelBy(context: Context): String? {
@ -51,7 +51,7 @@ object ChannelUtils {
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
return "" return "general"
} }
fun getBdVid(context: Context?): String? { fun getBdVid(context: Context?): String? {